1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/homeassistant_ynh.git synced 2024-09-03 19:26:16 +02:00
homeassistant_ynh/scripts/backup

33 lines
1 KiB
Text
Raw Normal View History

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"
2018-09-25 19:03:30 +02:00
home_path="/home/$app"
2020-11-17 18:20:52 +01:00
ynh_script_progression --message="Storing the python version in settings..."
# 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
2020-11-17 18:20:52 +01:00
ynh_script_progression --message="Backuping the app, datas & ystem files..."
2020-08-12 22:22:59 +02:00
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$home_path"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/sudoers.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app@$app.service"
2020-11-17 18:20:52 +01:00
ynh_script_progression --message="Backup of $app completed" --last