Browse Source

Fix an nginx conf typo

Julien VAUBOURG 10 years ago
parent
commit
266a68bcea
3 changed files with 52 additions and 47 deletions
  1. 50 45
      conf/init_ynh-hotspot
  2. 1 1
      conf/nginx_wifiadmin.conf
  3. 1 1
      scripts/install

+ 50 - 45
conf/init_ynh-hotspot

@@ -141,6 +141,7 @@ set_dhcpd() {
   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
 }
 
@@ -235,55 +236,59 @@ moulinette_set() {
   fi
 }
 
-# Restart php5-fpm at the first start (it needs to be restarted after the slapd start)
-if [ ! -e /tmp/.ynh-hotspot-boot ]; then
-  touch /tmp/.ynh-hotspot-boot
-  service php5-fpm restart
-fi
-
-# Variables
-
-echo -n "Retrieving Yunohost settings... "
-
-ynh_wifi_device=$(moulinette_get wifi_device)
-ynh_wifi_ssid=$(moulinette_get wifi_ssid)
-ynh_wifi_passphrase=$(moulinette_get wifi_passphrase)
-ynh_wifi_channel=$(moulinette_get wifi_channel)
-ynh_wifi_n=$(moulinette_get wifi_n)
-ynh_ip6_addr=$(moulinette_get ip6_addr)
-ynh_ip6_net=$(moulinette_get ip6_net)
-ynh_ip6_dns0=$(moulinette_get ip6_dns0)
-ynh_ip6_dns1=$(moulinette_get ip6_dns1)
-ynh_ip4_dns0=$(moulinette_get ip4_dns0)
-ynh_ip4_dns1=$(moulinette_get ip4_dns1)
-ynh_ip4_nat_prefix=$(moulinette_get ip4_nat_prefix)
-
-old_internet_device=$(moulinette_get internet_device)
-new_internet_device=$(ip route | awk '/default via/ { print $NF; }')
-
-# Switch the NAT interface if there is a VPN
-ip link show dev tun0 &> /dev/null
-if [ "$?" -eq 0 ]; then
-  new_internet_device=tun0
-fi
-
-echo "OK"
-
-# Check IPv6 delegated prefix from vpnclient
-vpnclient_ip6_net=$(moulinette_vpnclient_get ip6_net)
+if [ "$1" != restart ]; then
 
-if [ ! -z "${vpnclient_ip6_addr}" ]; then
-  if [ "${ynh_ip6_net}" == none ]; then
-    ynh_ip6_net=$vpnclient_ip6_net
-    ynh_ip6_addr=$(moulinette_vpnclient_get ip6_addr)
+  # Restart php5-fpm at the first start (it needs to be restarted after the slapd start)
+  if [ ! -e /tmp/.ynh-hotspot-boot ]; then
+    touch /tmp/.ynh-hotspot-boot
+    service php5-fpm restart
+  fi
   
-    moulinette_set ip6_net "${ynh_ip6_net}"
-    moulinette_set ip6_addr "${ynh_ip6_addr}"
-  else
-    if [ "${ynh_ip6_net}" != "${vpnclient_ip6_net}" ]; then
-      echo "[WARN] The IPv6 delegated prefix is different from the vpnclient one"
+  # Variables
+  
+  echo -n "Retrieving Yunohost settings... "
+  
+  ynh_wifi_device=$(moulinette_get wifi_device)
+  ynh_wifi_ssid=$(moulinette_get wifi_ssid)
+  ynh_wifi_passphrase=$(moulinette_get wifi_passphrase)
+  ynh_wifi_channel=$(moulinette_get wifi_channel)
+  ynh_wifi_n=$(moulinette_get wifi_n)
+  ynh_ip6_addr=$(moulinette_get ip6_addr)
+  ynh_ip6_net=$(moulinette_get ip6_net)
+  ynh_ip6_dns0=$(moulinette_get ip6_dns0)
+  ynh_ip6_dns1=$(moulinette_get ip6_dns1)
+  ynh_ip4_dns0=$(moulinette_get ip4_dns0)
+  ynh_ip4_dns1=$(moulinette_get ip4_dns1)
+  ynh_ip4_nat_prefix=$(moulinette_get ip4_nat_prefix)
+  
+  old_internet_device=$(moulinette_get internet_device)
+  new_internet_device=$(ip route | awk '/default via/ { print $NF; }')
+  
+  # Switch the NAT interface if there is a VPN
+  ip link show dev tun0 &> /dev/null
+  if [ "$?" -eq 0 ]; then
+    new_internet_device=tun0
+  fi
+  
+  echo "OK"
+  
+  # Check IPv6 delegated prefix from vpnclient
+  vpnclient_ip6_net=$(moulinette_vpnclient_get ip6_net)
+  
+  if [ ! -z "${vpnclient_ip6_addr}" ]; then
+    if [ "${ynh_ip6_net}" == none ]; then
+      ynh_ip6_net=$vpnclient_ip6_net
+      ynh_ip6_addr=$(moulinette_vpnclient_get ip6_addr)
+    
+      moulinette_set ip6_net "${ynh_ip6_net}"
+      moulinette_set ip6_addr "${ynh_ip6_addr}"
+    else
+      if [ "${ynh_ip6_net}" != "${vpnclient_ip6_net}" ]; then
+        echo "[WARN] The IPv6 delegated prefix is different from the vpnclient one"
+      fi
     fi
   fi
+
 fi
 
 # Script

+ 1 - 1
conf/nginx_wifiadmin.conf

@@ -18,7 +18,7 @@
 location <TPL:NGINX_LOCATION> {
   alias <TPL:NGINX_REALPATH>;
 
-  if($scheme = http) {
+  if ($scheme = http) {
     rewrite ^ https://$server_name$request_uri? permanent;
   }
 

+ 1 - 1
scripts/install

@@ -55,7 +55,7 @@ if [ ! $? -eq 0 ]; then
 fi
 
 # Install packages
-packages='php5-fpm sipcalc hostapd iptables wireless-tools'
+packages='php5-fpm sipcalc hostapd iptables wireless-tools dnsmasq'
 
 # Packaged USB Wireless Device firmwares
 # Based on https://wiki.debian.org/WiFi#USB_Devices