mirror of
https://github.com/YunoHost-Apps/restic_ynh.git
synced 2024-09-03 20:16:22 +02:00
8d57e11cd1
This is an adaptation of https://github.com/YunoHost-Apps/borg_ynh/blob/master/conf/backup-with-borg.j2
58 lines
1.7 KiB
Bash
Executable file
58 lines
1.7 KiB
Bash
Executable file
#!/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)
|
|
|
|
#=================================================
|
|
# INSTALL DEPENDENCIES
|
|
#=================================================
|
|
ynh_install_app_dependencies $pkg_dependencies
|
|
install_restic
|
|
|
|
#=================================================
|
|
# ACTIVATE BACKUP METHODS
|
|
#=================================================
|
|
mkdir -p /etc/yunohost/hooks.d/backup_method
|
|
mkdir -p /usr/share/yunohost/backup_method
|
|
|
|
#=================================================
|
|
# RESTORE FILES
|
|
#=================================================
|
|
ynh_restore
|
|
|
|
#=================================================
|
|
# 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
|
|
|