1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zwave-js-ui_ynh.git synced 2024-09-03 18:06:00 +02:00
zwave-js-ui_ynh/scripts/restore

76 lines
2.4 KiB
Text
Raw Normal View History

2022-11-13 11:25:39 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
2022-11-26 18:26:31 +01:00
if grep dialout -q < /etc/group; then
usermod -a -G dialout "$app"
fi
if grep i2c -q < /etc/group; then
usermod -a -G i2c "$app"
fi
if grep gpio -q < /etc/group; then
usermod -a -G gpio "$app"
fi
2022-11-25 11:15:42 +01:00
2022-11-13 11:25:39 +01:00
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
2023-02-24 00:06:37 +01:00
ynh_restore_file --origin_path="$install_dir"
2022-11-13 11:25:39 +01:00
2023-02-24 00:06:37 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app: "$install_dir"
2022-11-13 11:25:39 +01:00
2023-02-24 00:06:37 +01:00
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
2022-11-13 11:25:39 +01:00
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
2022-11-19 17:37:14 +01:00
mkdir -p /var/log/$app
chown -R $app:$app /var/log/$app
yunohost service add $app --description="Zwave integration in domoticz" --log="/var/log/$app/$app.log"
2022-11-13 11:25:39 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
2022-11-25 23:21:29 +01:00
ynh_systemd_action --service_name=$app --action="start" --line_match="Listening on port" -t 30 --log_path="/var/log/$app/$app.log"
2022-11-13 11:25:39 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
2022-11-13 11:25:39 +01:00
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last