Files
technitium-dns_ynh/scripts/restore
T
2026-06-15 19:06:15 -06:00

68 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression "Restoring the app main directory..."
ynh_restore "$install_dir"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression "Restoring the data directory..."
ynh_restore "$data_dir"
#=================================================
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/var/log/$app"
ynh_hide_warnings yunohost firewall allow Both 53
ynh_restore "/etc/systemd/system/$app.service"
systemctl enable "$app.service" --quiet
yunohost service add "$app" --description="Technitium DNS Server" --log="/var/log/$app/$app.log" --needs_exposed_ports=53
ynh_config_add --template="dnsmasq.conf" --destination="/etc/dnsmasq.d/$app.conf"
ynh_systemctl --service="dnsmasq" --action="restart"
#=================================================
# ADD A CRON JOB
#=================================================
ynh_config_add --template="logsymlink.cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="start" --log_path=systemd --wait_until="was started successfully"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression "Reloading NGINX web server..."
ynh_systemctl --service=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Restoration completed for $app"