2016-05-14 10:06:20 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-06-13 23:37:51 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# MANAGE FAILURE OF THE SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2016-05-17 22:13:59 +02:00
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
2016-05-14 10:06:20 +02:00
|
|
|
|
2017-06-13 23:37:51 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if [ ! -e _common.sh ]; then
|
|
|
|
# Rapatrie le fichier de fonctions si il n'est pas dans le dossier courant
|
|
|
|
sudo cp ../settings/scripts/_common.sh ./_common.sh
|
|
|
|
sudo chmod a+rx _common.sh
|
|
|
|
fi
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2016-05-14 10:06:20 +02:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
2017-06-13 23:37:51 +02:00
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD BACKUP STEPS
|
|
|
|
#=================================================
|
|
|
|
# BACKUP OF THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${YNH_APP_BACKUP_DIR}/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC BACKUP
|
|
|
|
#=================================================
|
|
|
|
# BACKUP TRANSMISSION CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup "/etc/transmission-daemon/settings.json" "${YNH_APP_BACKUP_DIR}/etc/transmission-daemon/settings.json"
|
2016-05-14 10:06:20 +02:00
|
|
|
|
2017-06-13 23:37:51 +02:00
|
|
|
#=================================================
|
|
|
|
# BACKUP DATA
|
|
|
|
#=================================================
|
2016-05-14 10:06:20 +02:00
|
|
|
|
2017-06-13 23:37:51 +02:00
|
|
|
CHECK_SIZE "/usr/share/transmission"
|
|
|
|
ynh_backup "/usr/share/transmission" "${YNH_APP_BACKUP_DIR}/usr/share/transmission"
|
2016-05-14 10:06:20 +02:00
|
|
|
|
2017-06-16 20:38:31 +02:00
|
|
|
CHECK_SIZE "/var/lib/transmission-daemon"
|
|
|
|
ynh_backup "/var/lib/transmission-daemon" "${YNH_APP_BACKUP_DIR}/var/lib/transmission-daemon"
|
|
|
|
|
2017-06-13 23:37:51 +02:00
|
|
|
backup_core_only=$(ynh_app_setting_get $app backup_core_only)
|
|
|
|
if [ -z $backup_core_only ] # Si backup_core_only a une valeur dans le fichier settings.yml, ne sauvegarde pas le dossier data
|
|
|
|
then
|
|
|
|
CHECK_SIZE "/home/yunohost.transmission"
|
|
|
|
ynh_backup "/home/yunohost.transmission" "${YNH_APP_BACKUP_DIR}/home/yunohost.transmission"
|
|
|
|
else
|
|
|
|
echo "Data dir will not saved, because backup_core_only is set." >&2
|
|
|
|
fi
|