2019-01-09 09:31:49 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-06-02 15:23:07 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2019-01-09 09:31:49 +01:00
|
|
|
|
2021-07-06 18:01:44 +02:00
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
2020-06-02 15:23:07 +02:00
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE THE APP MAIN DIR
|
|
|
|
#=================================================
|
2021-08-30 13:38:27 +02:00
|
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
2020-06-02 15:23:07 +02:00
|
|
|
|
2023-04-06 09:05:31 +02:00
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
2020-06-02 15:23:07 +02:00
|
|
|
|
2021-07-06 18:01:44 +02:00
|
|
|
# this will be treated as a security issue.
|
2023-04-06 09:05:31 +02:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:$app "$install_dir"
|
2021-09-21 18:27:40 +02:00
|
|
|
|
2023-04-06 09:05:31 +02:00
|
|
|
setcap 'CAP_NET_BIND_SERVICE=+eip CAP_NET_RAW=+eip' $install_dir/AdGuardHome
|
2021-07-06 18:01:44 +02:00
|
|
|
|
2022-01-04 14:00:07 +01:00
|
|
|
ynh_restore_file --origin_path="/etc/dnsmasq.d/$app"
|
|
|
|
|
|
|
|
systemctl restart dnsmasq
|
|
|
|
|
2022-07-29 21:30:38 +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-06-02 15:23:07 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
2023-09-07 18:07:12 +02:00
|
|
|
systemctl enable "$app.service" --quiet
|
2020-06-02 15:23:07 +02:00
|
|
|
|
2023-04-06 09:27:41 +02:00
|
|
|
yunohost service add $app --description="Ads & trackers blocking DNS server" --needs_exposed_ports $port_adguard
|
2020-06-02 15:23:07 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2021-08-30 13:38:27 +02:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
2020-06-02 15:23:07 +02:00
|
|
|
|
2023-09-07 18:07:12 +02:00
|
|
|
ynh_systemd_action --service_name="$app" --action="restart" --log_path="systemd"
|
2020-06-02 15:23:07 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2019-01-09 09:31:49 +01:00
|
|
|
|
2021-08-30 13:38:27 +02:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|