From a29661ca1a9cfdcc895c1daf976bf0c636d32a6a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 6 Apr 2021 20:43:40 +0200 Subject: [PATCH] Implement --is_big --- scripts/backup | 13 ++++++------- scripts/restore | 31 ++++++++++++++----------------- scripts/upgrade | 3 --- 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/scripts/backup b/scripts/backup index e163c5e..1f8656c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -41,13 +41,6 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only) -# If backup_core_only have any value in the settings.yml file, do not backup the data directory -if [ ! "$backup_core_only" ] -then - ynh_backup --src_path="$datadir" -fi - ynh_backup --src_path="$final_path" #================================================= @@ -74,6 +67,12 @@ ynh_backup --src_path="/etc/systemd/system/${app}-server.service" ynh_backup --src_path="/etc/systemd/system/${app}-worker.service" ynh_backup --src_path="/etc/systemd/system/$app.target" +#================================================= +# BACKUP VARIOUS FILES +#================================================= + +ynh_backup --src_path="$datadir" --is_big + #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index 78c0386..6fb0d91 100644 --- a/scripts/restore +++ b/scripts/restore @@ -59,24 +59,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Restoring the app main directory..." -backup_core_only=$(ynh_app_setting_get --app=$app --key=backup_core_only) - -# If backup_core_only have any value, then restore only code -if [ ! "$backup_core_only" ] -then - ynh_restore_file --origin_path="$datadir" -fi - ynh_restore_file --origin_path="$final_path" -# Remove the option backup_core_only if it's in the settings.yml file -ynh_app_setting_delete --app=$app --key=backup_core_only - -mkdir -p $datadir -pushd $datadir - mkdir -p static media music -popd - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -92,7 +76,6 @@ ynh_script_progression --message="Restoring user rights..." # Restore permissions on app files chown -R $app: $final_path -chown -R $app: $datadir #================================================= # SPECIFIC RESTORATION @@ -145,6 +128,20 @@ ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="sys ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Application startup complete" ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="Running with the following plugins enabled" +#================================================= +# RESTORE VARIOUS FILES +#================================================= +ynh_script_progression --message="Restoring the various files..." + +ynh_restore_file --origin_path="$datadir" --not_mandatory + +mkdir -p $datadir +pushd $datadir + mkdir -p static media music +popd + +chown -R $app: $datadir + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 3e5e9e3..d56a36b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,9 +63,6 @@ fi #================================================= ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." -# Inform the backup/restore process that it should not save the data directory -ynh_app_setting_set --app=$app --key=backup_core_only --value=1 - # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () {