contrib/meshwizard: add support for setting up qos on wan
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / setup_splash.sh
index 9741111..7cac3d6 100755 (executable)
@@ -5,6 +5,7 @@
 . $dir/functions.sh
 
 net=$1
+vap=$(uci -q get meshwizard.netconfig.${net}_vap)
 
 if [ ! "$has_luci_splash" == TRUE ]; then
        echo "    Luci Splash is not installed, skipping setup of it."
@@ -16,6 +17,14 @@ uci_commitverbose "Setup general splash settings" luci_splash
 
 dhcprange=$(uci -q get meshwizard.netconfig.$net\_dhcprange)
 
+splash_net_add() {
+       uci batch <<- EOF
+               set luci_splash.$1="iface"
+               set luci_splash.$1.network="$1"
+               set luci_splash.$1.zone="freifunk"
+       EOF
+}
+
 if [ "$(uci -q get meshwizard.netconfig.$net\_dhcp)" == 1 ] && [ -n "$dhcprange" ]; then
        handle_splash() {
                config_get network "$1" network
@@ -28,13 +37,16 @@ if [ "$(uci -q get meshwizard.netconfig.$net\_dhcp)" == 1 ] && [ -n "$dhcprange"
        config_load luci_splash
        config_foreach handle_splash iface
 
-       uci batch <<- EOF
-               set luci_splash.${netrenamed}dhcp="iface"
-               set luci_splash.${netrenamed}dhcp.network="${netrenamed}dhcp"
-               set luci_splash.${netrenamed}dhcp.zone="freifunk"
-       EOF
+       if [ "$supports_vap" = 1 -a "$vap" = 1 ]; then
+               splash_net_add ${netrenamed}dhcp                
+               uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash
+       fi
 
-       uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash
+       ahdhcp_when_vap="$(uci get profile_$community.profile.adhoc_dhcp_when_vap)"
+       if [ "$supports_vap" = 0 ] || [ "$supports_vap" = 1 -a "$vap" = 1 -a "$ahdhcp_when_vap" = 1 ]; then
+               splash_net_add ${netrenamed}ahdhcp              
+               uci_commitverbose "Setup dhcpsplash for ${netrenamed}ahdhcp" luci_splash
+       fi
        /etc/init.d/luci_splash enable
 fi