2020-02-23 12:02:10 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
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
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
server=$(ynh_app_setting_get $app server)
|
|
|
|
|
|
|
|
#=================================================
|
2020-04-12 17:13:11 +02:00
|
|
|
# INSTALL RESTIC
|
2020-02-23 12:02:10 +01:00
|
|
|
#=================================================
|
|
|
|
install_restic
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# ACTIVATE BACKUP METHODS
|
|
|
|
#=================================================
|
|
|
|
mkdir -p /etc/yunohost/hooks.d/backup_method
|
|
|
|
mkdir -p /usr/share/yunohost/backup_method
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE FILES
|
|
|
|
#=================================================
|
2020-11-12 08:23:18 +01:00
|
|
|
ynh_restore
|
2020-02-23 12:02:10 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
|
|
|
#=================================================
|
|
|
|
yunohost service add $app
|
|
|
|
systemctl enable $app.timer
|
|
|
|
systemctl start $app.timer
|
|
|
|
#yunohost service add $app.timer
|
|
|
|
#yunohost service enable $app.timer
|
|
|
|
#yunohost service start $app.timer
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE SYSTEMD
|
|
|
|
#=================================================
|
|
|
|
systemctl enable $app.service
|
|
|
|
|