diff --git a/scripts/upgrade b/scripts/upgrade index f468665..17eb0bb 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,6 +46,19 @@ ynh_secure_remove freeze.pip previous_version_template="../conf/settings_history/settings.$previous_version.py" test -e "$previous_version_template" || ynh_die "Previous version unknown: $previous_version" +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -111,23 +124,6 @@ if [ -z "$redis_db" ]; then ynh_app_setting_set "$app" redis_db "$redis_db" fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# ENSURE DOWNWARD COMPATIBILITY - impacting system -#================================================= - # (<2.20) remove complex uwsgi systemd template if [ -e "/etc/systemd/system/uwsgi-app@.service" ] then