1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/transmission_ynh.git synced 2024-09-04 01:46:12 +02:00

[fix] backup BACKUP_CORE_ONLY + add warnings

This commit is contained in:
Gofannon 2019-04-22 00:17:25 +02:00
parent cd9b5822d5
commit bd74f784cb
3 changed files with 19 additions and 12 deletions

View file

@ -14,7 +14,7 @@
"email": "apps@yunohost.org"
},
"requirements": {
"yunohost": ">= 2.7.2"
"yunohost": ">= 3.2"
},
"multi_instance": false,
"services": [

View file

@ -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

View file

@ -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