2018-06-14 02:13:59 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2021-04-08 20:20:10 +02:00
|
|
|
ynh_print_info --message="Loading installation settings..."
|
2018-06-14 02:13:59 +02:00
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2021-04-08 20:20:10 +02:00
|
|
|
export ssh_user="$(ynh_app_setting_get $app ssh_user)"
|
2022-09-30 01:16:55 +02:00
|
|
|
export datadir="$(ynh_app_setting_get $app datadir)"
|
2021-04-08 20:20:10 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
2022-09-30 01:16:55 +02:00
|
|
|
ynh_backup "$datadir/.ssh"
|
|
|
|
ynh_backup "$datadir/.nobackup"
|
2021-04-08 20:20:10 +02:00
|
|
|
ynh_backup "/etc/cron.d/$app"
|
|
|
|
|
2022-09-30 01:16:55 +02:00
|
|
|
ynh_print_info --message="Borg backup repo in $datadir/ won't be backup to avoid backup of backup loop issue."
|
2021-04-08 20:20:10 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|