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
44 lines
1.1 KiB
Bash
Executable file
44 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
#=================================================
|
|
# CHECK IF AN UPGRADE IS NEEDED
|
|
#=================================================
|
|
ynh_check_app_version_changed
|
|
|
|
#=================================================
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
#=================================================
|
|
|
|
# Backup the current version of the app
|
|
ynh_backup_before_upgrade
|
|
ynh_clean_setup () {
|
|
# restore it if the upgrade fails
|
|
ynh_restore_upgradebackup
|
|
}
|
|
# Exit if an error occurs during the execution of the script
|
|
ynh_abort_if_errors
|
|
|
|
|
|
if grep "restic.timer" /etc/yunohost/services.yml > /dev/null ; then
|
|
yunohost service remove $app.timer
|
|
systemctl enable $app.timer
|
|
systemctl start $app.timer
|
|
fi
|
|
|
|
# install
|
|
install_borg_with_pip
|