diff --git a/scripts/backup b/scripts/backup index be659ac..48daceb 100644 --- a/scripts/backup +++ b/scripts/backup @@ -24,6 +24,7 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME +final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -32,6 +33,12 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= ynh_print_info --message="Declaring files to be backed up..." +#================================================= +# BACKUP THE APP MAIN DIR +#================================================= + +ynh_backup --src_path="$final_path" + #================================================= # STANDARD BACKUP STEPS #================================================= diff --git a/scripts/restore b/scripts/restore index 7a89200..9d78ad9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -25,6 +25,7 @@ ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) path_url=$(ynh_app_setting_get --app=$app --key=path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name diff --git a/scripts/upgrade b/scripts/upgrade index c07f40c..819d017 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,12 +18,27 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up OnlyOffice before upgrading (may take a while)..." + +# 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 #================================================= @@ -57,20 +72,6 @@ fi ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list" ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list" -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up OnlyOffice before upgrading (may take a while)..." - -# 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 - #================================================= # CREATE DEDICATED USER #=================================================