2019-10-15 15:56:27 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2020-10-13 18:23:23 +02:00
|
|
|
|
2019-10-15 15:56:27 +02:00
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
2020-10-13 18:23:23 +02:00
|
|
|
|
2019-10-15 15:56:27 +02:00
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2020-10-13 18:23:23 +02:00
|
|
|
ynh_print_info --message="Loading installation settings..."
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
#=================================================
|
2020-10-13 18:23:23 +02:00
|
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
2019-10-15 15:56:27 +02:00
|
|
|
#=================================================
|
2020-10-13 18:23:23 +02:00
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
#=================================================
|
2019-10-23 10:16:15 +02:00
|
|
|
# BACKUP THE APP MAIN DIR AND CONFIG FILES
|
2019-10-15 15:56:27 +02:00
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup --src_path="/etc/default/tvheadend"
|
2019-10-23 10:16:15 +02:00
|
|
|
ynh_backup --src_path="$final_path"
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC BACKUP
|
|
|
|
#=================================================
|
2019-10-23 10:16:15 +02:00
|
|
|
# BACKUP LOGROTATE AND LOG FILE
|
2019-10-15 15:56:27 +02:00
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
2019-10-23 10:16:15 +02:00
|
|
|
ynh_backup --src_path="/var/log/$app.log"
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2020-10-13 18:23:23 +02:00
|
|
|
ynh_print_info --message="Backup script completed for Tvheadend. (YunoHost will then actually copy those files to the archive)."
|