Browse Source

Fix DHCP problem after the system boot

Julien VAUBOURG 10 years ago
parent
commit
56cc7e18a7
2 changed files with 9 additions and 8 deletions
  1. 8 8
      conf/init_ynh-hotspot
  2. 1 0
      scripts/install

+ 8 - 8
conf/init_ynh-hotspot

@@ -131,9 +131,6 @@ set_dhcpd() {
   sed "s|<TPL:IP4_DNS1>|${ynh_ip4_dns1}|g" -i /etc/dnsmasq.d/dhcpdv4.conf
   sed "s|<TPL:WIFI_DEVICE>|${ynh_wifi_device}|g" -i /etc/dnsmasq.d/dhcpdv4.conf
   sed "s|<TPL:IP4_NAT_PREFIX>|${ynh_ip4_nat_prefix}|g" -i /etc/dnsmasq.d/dhcpdv4.conf
-
-  service bind9 stop &> /dev/null
-  service dnsmasq restart
 }
 
 start_hostapd() {
@@ -335,17 +332,20 @@ case "$1" in
         set_forwarding
       fi
 
+      # Run hostapd
+      if ! is_hostapd_running; then
+        echo "Run hostapd"
+        start_hostapd
+      fi
+
       # Run DHCP servers
       if ( has_ip6delegatedprefix && ! is_dhcpdv6_set ) || ! is_dhcpdv4_set; then
         echo "Set DHCP servers (dnsmasq)"
         set_dhcpd
       fi
 
-      # Run hostapd
-      if ! is_hostapd_running; then
-        echo "Run hostapd"
-        start_hostapd
-      fi
+      service bind9 stop &> /dev/null
+      service dnsmasq restart
 
       # Update dynamic settings
       moulinette_set internet_device "${new_internet_device}"

+ 1 - 0
scripts/install

@@ -57,6 +57,7 @@ fi
 
 # Install packages
 packages='php5-fpm sipcalc hostapd iptables wireless-tools dnsmasq'
+export DEBIAN_FRONTEND=noninteractive
 
 # Packaged USB Wireless Device firmwares
 # Based on https://wiki.debian.org/WiFi#USB_Devices