2018-09-25 19:03:30 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# to test the functionnality :
|
|
|
|
# yunohost backup create -n "homeassistant-test" --apps homeassistant
|
|
|
|
# yunohost backup delete homeassistant-test
|
|
|
|
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# manage script failure
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
# retrieve arguments
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2020-11-16 15:10:12 +01:00
|
|
|
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
2018-09-25 19:03:30 +02:00
|
|
|
|
|
|
|
# definie useful vars
|
2018-10-18 05:16:40 +02:00
|
|
|
final_path="/opt/yunohost/$app"
|
2021-11-20 19:05:14 +01:00
|
|
|
data_path="/home/yunohost.app/$app"
|
2018-09-25 19:03:30 +02:00
|
|
|
|
2021-01-17 15:28:51 +01:00
|
|
|
ynh_print_info --message="Storing the python version in settings..."
|
2020-11-17 18:20:52 +01:00
|
|
|
# store python version
|
|
|
|
python=$(cat "$final_path/bin/python3" --version | cut -d ' ' -f 2)
|
|
|
|
ynh_app_setting_set --app="$app" --key=python --value="$python"
|
|
|
|
|
2018-09-25 19:03:30 +02:00
|
|
|
# backup source & conf files
|
2021-01-17 15:28:51 +01:00
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
2020-08-12 22:22:59 +02:00
|
|
|
ynh_backup --src_path="$final_path"
|
2021-11-20 19:05:14 +01:00
|
|
|
ynh_backup --src_path="$data_path"
|
2020-08-12 22:22:59 +02:00
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
ynh_backup --src_path="/etc/sudoers.d/$app"
|
2021-11-21 21:25:39 +01:00
|
|
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
2021-02-20 09:53:53 +01:00
|
|
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
2020-11-17 18:20:52 +01:00
|
|
|
|
2021-01-17 15:28:51 +01:00
|
|
|
ynh_print_info --message="Backup of $app completed"
|