diff --git a/conf/dnsmasq.conf.tpl b/conf/dnsmasq.conf.tpl deleted file mode 100644 index 7af2560..0000000 --- a/conf/dnsmasq.conf.tpl +++ /dev/null @@ -1,4 +0,0 @@ -# Wifi Hotspot app for YunoHost - -# Enable DNS resolution on wifi interface -interface=__WIFI_DEVICE__ diff --git a/conf/ynh-hotspot b/conf/ynh-hotspot index 0133dee..f190a78 100644 --- a/conf/ynh-hotspot +++ b/conf/ynh-hotspot @@ -296,6 +296,9 @@ start) # Update dynamic settings ynh_app_setting_set hotspot gateway_interface "${new_gateway_interface}" + + # Regen-conf dnsmasq to enable dns resolution on dnsmasq for the new interface + yunohost tools regen-conf dnsmasq ;; stop) echo "[hotspot] Stopping..." @@ -319,6 +322,9 @@ stop) echo "Stop hostapd" stop_hostapd fi + + # Regen-conf dnsmasq to disable dns resolution on dnsmasq for the previous interface + yunohost tools regen-conf dnsmasq ;; restart) $0 stop diff --git a/scripts/_common.sh b/scripts/_common.sh index 6ca2179..8d1c20d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -83,12 +83,6 @@ function configure_hostapd() ynh_add_config --template="/etc/hostapd/$app/hostapd.conf.tpl" --destination="/etc/hostapd/$app/hostapd.conf" } -function configure_dnsmasq() -{ - ynh_add_config --template="/etc/dnsmasq.$app/dnsmasq.conf.tpl" --destination="/etc/dnsmasq.d/$app.conf" - systemctl restart dnsmasq -} - function configure_dhcp() { ynh_add_config --template="/etc/dnsmasq.$app/dhcpdv4.conf.tpl" --destination="/etc/dnsmasq.$app/dhcpdv4.conf" diff --git a/scripts/backup b/scripts/backup index de71cba..a3dbd5e 100644 --- a/scripts/backup +++ b/scripts/backup @@ -43,7 +43,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="/etc/hostapd/$app/hostapd.conf.tpl" ynh_backup --src_path="/etc/hostapd/$app/hostapd.conf" --not_mandatory -ynh_backup --src_path="/etc/dnsmasq.$app/dnsmasq.conf.tpl" ynh_backup --src_path="/etc/dnsmasq.d/$app.conf" --not_mandatory ynh_backup --src_path="/etc/dnsmasq.$app/dhcpdv6.conf.tpl" diff --git a/scripts/config b/scripts/config index ff02211..1283d6b 100644 --- a/scripts/config +++ b/scripts/config @@ -205,7 +205,6 @@ ynh_app_config_apply() { if [[ "${service_enabled}" -eq 1 ]]; then configure_hostapd - configure_dnsmasq configure_dhcp # Start hotspot diff --git a/scripts/install b/scripts/install index 5f746d4..98588b2 100644 --- a/scripts/install +++ b/scripts/install @@ -162,7 +162,6 @@ mkdir -pm 0755 /etc/dnsmasq.$app/ chown root: /etc/dnsmasq.$app/ install -b -o root -g root -m 0644 ../conf/hostapd.conf.tpl /etc/hostapd/$app/hostapd.conf.tpl -install -b -o root -g root -m 0644 ../conf/dnsmasq.conf.tpl /etc/dnsmasq.$app/dnsmasq.conf.tpl install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv6.conf.tpl /etc/dnsmasq.$app/dhcpdv6.conf.tpl install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq.$app/dhcpdv4.conf.tpl @@ -192,9 +191,8 @@ systemctl stop hostapd 2>&1 systemctl unmask hostapd 2>&1 # On some system e.g. RPi, for some reason hostapd is masked after install ... if [[ -n "${wifi_device}" ]]; then - configure_hostapd - configure_dnsmasq - configure_dhcp + configure_hostapd + configure_dhcp fi #================================================= diff --git a/scripts/restore b/scripts/restore index 679bb30..7bfd49f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -74,10 +74,6 @@ fi ynh_restore_file --origin_path="/etc/hostapd/$app/hostapd.conf.tpl" ynh_restore_file --origin_path="/etc/hostapd/$app/hostapd.conf" --not_mandatory -ynh_restore_file --origin_path="/etc/dnsmasq.$app/dnsmasq.conf.tpl" -ynh_restore_file --origin_path="/etc/dnsmasq.d/$app.conf" --not_mandatory -systemctl restart dnsmasq - ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv6.conf.tpl" ynh_restore_file --origin_path="/etc/dnsmasq.$app/dhcpdv6.conf" --not_mandatory diff --git a/scripts/upgrade b/scripts/upgrade index 1d56a39..e3fdd59 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -214,14 +214,12 @@ mkdir -pm 0755 /etc/dnsmasq.$app/ chown root: /etc/dnsmasq.$app/ install -b -o root -g root -m 0644 ../conf/hostapd.conf.tpl /etc/hostapd/$app/hostapd.conf.tpl -install -b -o root -g root -m 0644 ../conf/dnsmasq.conf.tpl /etc/dnsmasq.$app/dnsmasq.conf.tpl install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv6.conf.tpl /etc/dnsmasq.$app/dhcpdv6.conf.tpl install -b -o root -g root -m 0644 ../conf/dnsmasq_dhcpdv4.conf.tpl /etc/dnsmasq.$app/dhcpdv4.conf.tpl if [[ -n "${wifi_device}" ]]; then - configure_hostapd - configure_dnsmasq - configure_dhcp + configure_hostapd + configure_dhcp fi # Copy init script