From bd74f784cb836935835f4ba996ba578408ae3442 Mon Sep 17 00:00:00 2001 From: Gofannon <17145502+Gofannon@users.noreply.github.com> Date: Mon, 22 Apr 2019 00:17:25 +0200 Subject: [PATCH] [fix] backup BACKUP_CORE_ONLY + add warnings --- manifest.json | 2 +- scripts/backup | 15 ++++++--------- scripts/upgrade | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/manifest.json b/manifest.json index 644455a..8af4f70 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 2.7.2" + "yunohost": ">= 3.2" }, "multi_instance": false, "services": [ diff --git a/scripts/backup b/scripts/backup index 6fba36d..4846588 100644 --- a/scripts/backup +++ b/scripts/backup @@ -53,12 +53,9 @@ ynh_backup "/usr/share/transmission" ynh_backup "/var/lib/transmission-daemon" -backup_core_only=$(ynh_app_setting_get $app backup_core_only) -# If backup_core_only have a value in settings.yml, do not backup the data directory -if [ -z $backup_core_only ] -then - CHECK_SIZE "/home/yunohost.transmission" - ynh_backup "/home/yunohost.transmission" -else - echo "Data dir will not saved, because backup_core_only is set." >&2 -fi +CHECK_SIZE "/home/yunohost.transmission" +# The "--is big" parameter indicates that the file/directory requires "a lot of disk space" +# It won't be backed up before 'upgrade' or while doing a 'backup' with: +# "sudo BACKUP_CORE_ONLY=1 yunohost backup create --apps nextcloud" +# See https://yunohost.org/#/backup +ynh_backup "/home/yunohost.transmission" --is_big diff --git a/scripts/upgrade b/scripts/upgrade index 4c07458..f7e0f8b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,8 +40,6 @@ yunohost firewall allow UDP $peer_port >/dev/null 2>&1 # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -# Inform the backup/restore process that it should not save the data directory -ynh_app_setting_set $app backup_core_only 1 ynh_backup_before_upgrade # Backup the current version of the app ynh_clean_setup () { ynh_restore_upgradebackup # restore it if the upgrade fails @@ -155,4 +153,16 @@ systemctl reload nginx # REMOVE BACKUP_CORE_ONLY #================================================= +backup_core_only=$(ynh_app_setting_get $app backup_core_only) +# If "backup_core_only" is still set in settings.yml, print a warning and run the upgrade as usual. +# Setting is deleted at the end of the script to avoid side effect ("ynh_backup_before_upgrade" maybe). +if [ -z $backup_core_only ] +then + ynh_print_info --message="Setting 'backup_core_only' is deprecated and cannot be used anymore" + ynh_print_info --message="Modify your backup script accordingly or next backup will be huge. See https://github.com/YunoHost/doc/blob/master/backup.md#apps-specific-configuration" +fi + +# Remove deprecated option "backup_core_only" if it's in the settings.yml file. +# Replaced by "environement variable" => sudo BACKUP_CORE_ONLY=1 yunohost backup create [...] +# See https://yunohost.org/#/backup. ynh_app_setting_delete $app backup_core_only