diff --git a/conf/dnsmasq b/conf/dnsmasq new file mode 100644 index 0000000..25847f6 --- /dev/null +++ b/conf/dnsmasq @@ -0,0 +1,4 @@ +# Created by __APP__ +# We assume that only one tailscale installation exists on the server, replace `tailscale0` below if needed +interface=tailscale0 +server=/__BASE_DOMAIN__/100.100.100.100 diff --git a/scripts/backup b/scripts/backup index 68a1633..e898622 100755 --- a/scripts/backup +++ b/scripts/backup @@ -41,6 +41,12 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# BACKUP DNSMASQ CONFIG +#================================================= + +ynh_backup --src_path="/etc/dnsmasq.d/$app" + #================================================= # BACKUP THE DATABASE #================================================= diff --git a/scripts/install b/scripts/install index 12a1000..eb106fc 100755 --- a/scripts/install +++ b/scripts/install @@ -75,6 +75,10 @@ ynh_add_config --template="config.yaml" --destination="$install_dir/config.yaml" chmod 600 "$install_dir/config.yaml" chown $app:$app "$install_dir/config.yaml" +# Add dnsmasq configuration to avoid overriding resolvconf +ynh_add_config --template="dnsmasq" --destination="/etc/dnsmasq.d/$app" +ynh_systemd_action --service_name="dnsmasq" --action="reload" + #================================================= # SETUP SYSTEMD #================================================= diff --git a/scripts/remove b/scripts/remove index 78d5d13..03198dc 100755 --- a/scripts/remove +++ b/scripts/remove @@ -73,6 +73,10 @@ ynh_script_progression --message="Removing various files..." --weight=1 # Remove the log files ynh_secure_remove --file="/var/log/$app" +# Remove dnsmasq configuration +ynh_secure_remove --file="/etc/dnsmasq.d/$app" +ynh_systemd_action --service_name=dnsmasq --action="reload" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 0dfc655..031fc5c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -46,6 +46,14 @@ ynh_script_progression --message="Restoring the logrotate configuration..." --we ynh_restore_file --origin_path="/etc/logrotate.d/$app" +#================================================= +# RESTORE THE DNSMASQ CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the dnsmasq configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/dnsmasq.d/$app" +ynh_systemd_action --service_name="dnsmasq" --action="reload" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 24948a7..caafce2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,6 +13,17 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # STANDARD UPGRADE STEPS +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +if [ ! -f "/etc/dnsmasq.d/$app" ]; then + # Add dnsmasq configuration to avoid overriding resolvconf + ynh_add_config --template="dnsmasq" --destination="/etc/dnsmasq.d/$app" + ynh_systemd_action --service_name="dnsmasq" --action="reload" +fi + #================================================= # STOP SYSTEMD SERVICE #=================================================