From 845149815c9cbf004948ed51d9f5730ffef50c22 Mon Sep 17 00:00:00 2001 From: Aeris One Date: Mon, 30 Mar 2020 14:00:17 +0200 Subject: [PATCH] Desperately trying to debug upgrade... --- scripts/upgrade | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e1307f5..cab2f09 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,7 +11,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 +ynh_script_progression --message="Loading installation settings..." --time --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -23,12 +23,24 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # CHECK VERSION #================================================= +### This helper will compare the version of the currently installed app and the version of the upstream package. +### $upgrade_type can have 2 different values +### - UPGRADE_APP if the upstream app version has changed +### - UPGRADE_PACKAGE if only the YunoHost package has changed +### ynh_check_app_version_changed will stop the upgrade if the app is up to date. +### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 + +# If final_path doesn't exist, create it +if [ -z "$final_path" ]; then + final_path=/var/www/$app + ynh_app_setting_set --app=$app --key=final_path --value=$final_path +fi # Cleaning legacy permissions is_public=$(ynh_app_setting_get --app=$app --key=is_public) @@ -56,16 +68,10 @@ if [ ! -z "$protected_uris" ]; then ynh_app_setting_delete --app=$app --key=protected_uris fi -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -fi - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=5 # Backup the current version of the app ynh_backup_before_upgrade @@ -100,7 +106,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=2 # Create a dedicated nginx config ynh_add_nginx_config @@ -114,15 +120,10 @@ ynh_add_nginx_config # Set permissions to app files chown -R root: $final_path -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -130,4 +131,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression --message="Upgrade of $app completed" --time --last