2019-02-20 12:08:50 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-11-16 19:38:35 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2019-02-20 12:08:50 +01:00
|
|
|
|
2022-03-13 21:51:45 +01:00
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
2020-11-16 19:38:35 +01:00
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2022-09-03 00:44:25 +02:00
|
|
|
#=================================================
|
|
|
|
# RESTORE THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
2020-11-16 19:38:35 +01:00
|
|
|
#=================================================
|
2022-03-13 21:51:45 +01:00
|
|
|
# RESTORE VARIOUS FILES
|
2020-11-16 19:38:35 +01:00
|
|
|
#=================================================
|
2022-09-03 00:44:25 +02:00
|
|
|
ynh_script_progression --message="Restoring various files..." --weight=1
|
2022-03-13 21:51:45 +01:00
|
|
|
|
|
|
|
ynh_replace_string --match_string="ListenStream=.*" --replace_string="ListenStream=$port" --target_file="/lib/systemd/system/cockpit.socket"
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart $app.socket
|
2020-11-16 19:38:35 +01:00
|
|
|
|
2022-03-13 21:51:45 +01:00
|
|
|
ynh_restore_file --origin_path="/etc/cockpit/cockpit.conf"
|
2020-11-16 19:38:35 +01:00
|
|
|
|
|
|
|
#=================================================
|
2022-03-13 21:51:45 +01:00
|
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
2020-11-16 19:38:35 +01:00
|
|
|
#=================================================
|
2022-03-13 21:51:45 +01:00
|
|
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
2020-11-16 19:38:35 +01:00
|
|
|
|
2023-08-12 10:41:47 +02:00
|
|
|
yunohost service add $app --description="Sysadmin login session in a web browser" --log="/var/log/$app/$app.log"
|
2020-11-16 19:38:35 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
|
|
|
|
2022-03-13 21:51:45 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Started"
|
2020-11-16 19:38:35 +01:00
|
|
|
|
|
|
|
#=================================================
|
2022-03-13 21:51:45 +01:00
|
|
|
# GENERIC FINALIZATION
|
2020-11-16 19:38:35 +01:00
|
|
|
#=================================================
|
|
|
|
# RELOAD NGINX
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
|
|
|
|
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2019-02-20 12:08:50 +01:00
|
|
|
|
2022-05-31 01:08:23 +02:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|