mirror of
https://github.com/YunoHost-Apps/lutim_ynh.git
synced 2024-09-03 19:36:24 +02:00
Misc upgrade
This commit is contained in:
parent
a934b73698
commit
750ea40195
12 changed files with 126 additions and 82 deletions
|
@ -18,11 +18,10 @@
|
||||||
port_already_use=1 (8095)
|
port_already_use=1 (8095)
|
||||||
change_url=1
|
change_url=1
|
||||||
;;; Levels
|
;;; Levels
|
||||||
# Level 5: https://github.com/YunoHost/package_linter/issues/36
|
Level 5=auto
|
||||||
Level 5=1
|
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=
|
Email=
|
||||||
Notification=down
|
Notification=change
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=4c29aa94f9d9048411c6e165e122e03574fb9b8d
|
; commit=4c29aa94f9d9048411c6e165e122e03574fb9b8d
|
||||||
name=08 Sep 2017 4c29aa94f9d9048411c6e165e122e03574fb9b8d
|
name=08 Sep 2017 4c29aa94f9d9048411c6e165e122e03574fb9b8d
|
||||||
|
|
|
@ -49,6 +49,9 @@
|
||||||
"fr": "L'upload des images est-il public ?"
|
"fr": "L'upload des images est-il public ?"
|
||||||
},
|
},
|
||||||
"default": false,
|
"default": false,
|
||||||
|
"help": {
|
||||||
|
"en": "If you set Lutim as public, everyone will be able to upload images and share them.<br>But even if not public, everyone can see an image from a link shared with your Lutim."
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "always_encrypt",
|
"name": "always_encrypt",
|
||||||
|
|
|
@ -9,11 +9,18 @@
|
||||||
source scripts/_common.sh
|
source scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,18 @@
|
||||||
source scripts/_common.sh
|
source scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,18 @@
|
||||||
source scripts/_common.sh
|
source scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,23 @@
|
||||||
source scripts/_common.sh
|
source scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
# Clean installation remaining that are not handle by the remove script.
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
|
|
|
@ -38,11 +38,13 @@ ynh_script_progression --message="Backing up the app before changing its url (ma
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
ynh_clean_check_starting
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
ynh_restore_upgradebackup
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
|
# restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -72,17 +74,6 @@ then
|
||||||
change_path=1
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE FAILURE OF THE SCRIPT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
# Clean installation remaining that are not handle by the remove script.
|
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
117
scripts/config
117
scripts/config
|
@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
@ -43,9 +43,11 @@ get_config_value() {
|
||||||
# always_encrypt
|
# always_encrypt
|
||||||
old_always_encrypt="$(get_config_value always_encrypt)"
|
old_always_encrypt="$(get_config_value always_encrypt)"
|
||||||
always_encrypt="${YNH_CONFIG_MAIN_CONFIGURATION_ALWAYS_ENCRYPT:-$old_always_encrypt}"
|
always_encrypt="${YNH_CONFIG_MAIN_CONFIGURATION_ALWAYS_ENCRYPT:-$old_always_encrypt}"
|
||||||
|
|
||||||
# antiflood
|
# antiflood
|
||||||
old_antiflood="$(get_config_value anti_flood_delay)"
|
old_antiflood="$(get_config_value anti_flood_delay)"
|
||||||
antiflood="${YNH_CONFIG_MAIN_CONFIGURATION_ANTIFLOOD:-$old_antiflood}"
|
antiflood="${YNH_CONFIG_MAIN_CONFIGURATION_ANTIFLOOD:-$old_antiflood}"
|
||||||
|
|
||||||
# delay
|
# delay
|
||||||
old_delay="$(get_config_value default_delay)"
|
old_delay="$(get_config_value default_delay)"
|
||||||
if [ $old_delay -eq 0 ]; then
|
if [ $old_delay -eq 0 ]; then
|
||||||
|
@ -101,62 +103,75 @@ show_config() {
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
apply_config() {
|
apply_config() {
|
||||||
restart_lutim=0
|
|
||||||
|
|
||||||
# Change configuration if needed
|
#=================================================
|
||||||
# always_encrypt
|
# MODIFY LUTIM CONFIGURATION
|
||||||
if [ "$always_encrypt" != "$old_always_encrypt" ]
|
#=================================================
|
||||||
then
|
|
||||||
ynh_replace_string --match_string=".*always_encrypt *=>.*" --replace_string=" always_encrypt => $always_encrypt," --target_file="$config_file"
|
|
||||||
restart_lutim=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# antiflood
|
restart_lutim=0
|
||||||
if [ "$antiflood" != "$old_antiflood" ]
|
|
||||||
then
|
|
||||||
ynh_replace_string --match_string=".*anti_flood_delay *=>.*" --replace_string=" anti_flood_delay => $antiflood," --target_file="$config_file"
|
|
||||||
# Disable anti_flood_delay if the delay is 0
|
|
||||||
if [ $antiflood = 0 ]; then
|
|
||||||
ynh_replace_string --match_string="\(anti_flood_delay *=>.*\)" --replace_string="#\1" --target_file="$config_file"
|
|
||||||
fi
|
|
||||||
ynh_app_setting_set --app=$app --key=antiflood --value="$antiflood"
|
|
||||||
restart_lutim=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# delay
|
# Change configuration if needed
|
||||||
if [ "$delay" != "$old_delay" ]
|
# always_encrypt
|
||||||
then
|
if [ "$always_encrypt" != "$old_always_encrypt" ]
|
||||||
if [ $delay = None ]; then
|
then
|
||||||
delay=0
|
ynh_replace_string --match_string=".*always_encrypt *=>.*" --replace_string=" always_encrypt => $always_encrypt," --target_file="$config_file"
|
||||||
elif [ $delay = Day ]; then
|
restart_lutim=1
|
||||||
delay=1
|
fi
|
||||||
elif [ $delay = Week ]; then
|
|
||||||
delay=7
|
|
||||||
elif [ $delay = Month ]; then
|
|
||||||
delay=30
|
|
||||||
else
|
|
||||||
delay=360
|
|
||||||
fi
|
|
||||||
ynh_replace_string --match_string=".*default_delay *=>.*" --replace_string=" default_delay => $delay," --target_file="$config_file"
|
|
||||||
ynh_app_setting_set --app=$app --key=delay --value="$delay"
|
|
||||||
restart_lutim=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $restart_lutim -eq 1 ]
|
# antiflood
|
||||||
then
|
if [ "$antiflood" != "$old_antiflood" ]
|
||||||
# Wait for lutim to be fully started
|
then
|
||||||
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
ynh_replace_string --match_string=".*anti_flood_delay *=>.*" --replace_string=" anti_flood_delay => $antiflood," --target_file="$config_file"
|
||||||
fi
|
# Disable anti_flood_delay if the delay is 0
|
||||||
|
if [ $antiflood = 0 ]; then
|
||||||
|
ynh_replace_string --match_string="\(anti_flood_delay *=>.*\)" --replace_string="#\1" --target_file="$config_file"
|
||||||
|
fi
|
||||||
|
ynh_app_setting_set --app=$app --key=antiflood --value="$antiflood"
|
||||||
|
restart_lutim=1
|
||||||
|
fi
|
||||||
|
|
||||||
# Set overwrite_settings
|
# delay
|
||||||
ynh_app_setting_set --app=$app --key=overwrite_settings --value="$overwrite_settings"
|
if [ "$delay" != "$old_delay" ]
|
||||||
# Set overwrite_nginx
|
then
|
||||||
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
|
if [ $delay = None ]; then
|
||||||
# Set overwrite_systemd
|
delay=0
|
||||||
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="$overwrite_systemd"
|
elif [ $delay = Day ]; then
|
||||||
|
delay=1
|
||||||
|
elif [ $delay = Week ]; then
|
||||||
|
delay=7
|
||||||
|
elif [ $delay = Month ]; then
|
||||||
|
delay=30
|
||||||
|
else
|
||||||
|
delay=360
|
||||||
|
fi
|
||||||
|
ynh_replace_string --match_string=".*default_delay *=>.*" --replace_string=" default_delay => $delay," --target_file="$config_file"
|
||||||
|
ynh_app_setting_set --app=$app --key=delay --value="$delay"
|
||||||
|
restart_lutim=1
|
||||||
|
fi
|
||||||
|
|
||||||
# Set admin_mail_html
|
if [ $restart_lutim -eq 1 ]
|
||||||
ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html"
|
then
|
||||||
|
# Wait for lutim to be fully started
|
||||||
|
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MODIFY OVERWRITTING SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Set overwrite_settings
|
||||||
|
ynh_app_setting_set --app=$app --key=overwrite_settings --value="$overwrite_settings"
|
||||||
|
# Set overwrite_nginx
|
||||||
|
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
|
||||||
|
# Set overwrite_systemd
|
||||||
|
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="$overwrite_systemd"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MODIFY EMAIL SETTING
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Set admin_mail_html
|
||||||
|
ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html"
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
# Load common variables for all scripts.
|
# Load common variables for all scripts.
|
||||||
source _variables
|
source _variables
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE FAILURE OF THE SCRIPT
|
# MANAGE FAILURE OF THE SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -259,4 +260,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --time --last
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -94,4 +94,4 @@ ynh_system_user_delete --username=$app
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --time --last
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source ../settings/scripts/_common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
# Load common variables for all scripts.
|
# Load common variables for all scripts.
|
||||||
source ../settings/scripts/_variables
|
source ../settings/scripts/_variables
|
||||||
|
|
||||||
|
source ../settings/scripts/_common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
# Load common variables for all scripts.
|
# Load common variables for all scripts.
|
||||||
source _variables
|
source _variables
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -209,7 +210,7 @@ ynh_system_user_create --username=$app
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LUTIM
|
# SETUP LUTIM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfigure Lutim"
|
ynh_script_progression --message="Reconfiguring Lutim..."
|
||||||
|
|
||||||
# Overwrite the settings config file only if it's allowed
|
# Overwrite the settings config file only if it's allowed
|
||||||
if [ $overwrite_settings -eq 1 ]
|
if [ $overwrite_settings -eq 1 ]
|
||||||
|
|
Loading…
Add table
Reference in a new issue