mirror of
https://github.com/YunoHost-Apps/restic_ynh.git
synced 2024-09-03 20:16:22 +02:00
66 lines
2 KiB
Bash
Executable file
66 lines
2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
|
source ../settings/scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# MANAGE SCRIPT FAILURE
|
|
#=================================================
|
|
|
|
#REMOVEME? ynh_clean_setup () {
|
|
ynh_clean_check_starting
|
|
}
|
|
# Exit if an error occurs during the execution of the script
|
|
#REMOVEME? ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
|
|
|
#REMOVEME? export app=$YNH_APP_INSTANCE_NAME
|
|
|
|
#REMOVEME? export server=$(ynh_app_setting_get --app=$app --key=server)
|
|
|
|
export install_dir="/opt/yunohost/${app}"
|
|
|
|
#=================================================
|
|
# INSTALL RESTIC
|
|
#=================================================
|
|
install_restic
|
|
|
|
#=================================================
|
|
# ACTIVATE BACKUP METHODS
|
|
#=================================================
|
|
mkdir -p /etc/yunohost/hooks.d/backup_method
|
|
mkdir -p /usr/share/yunohost/backup_method
|
|
|
|
#=================================================
|
|
# RESTORE FILES
|
|
#=================================================
|
|
|
|
ynh_restore
|
|
|
|
#=================================================
|
|
# ENABLE TIMER
|
|
#=================================================
|
|
|
|
systemctl enable --quiet ${app}.timer
|
|
systemctl enable --quiet ${app}_check.timer
|
|
systemctl enable --quiet ${app}_check_read_data.timer
|
|
systemctl start ${app}.timer
|
|
systemctl start ${app}_check.timer
|
|
systemctl start ${app}_check_read_data.timer
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoration completed for $app"
|