contrib/meshwizard: Better formatting
authorManuel Munz <freifunk@somakoma.de>
Wed, 26 Oct 2011 13:55:24 +0000 (13:55 +0000)
committerManuel Munz <freifunk@somakoma.de>
Wed, 26 Oct 2011 13:55:24 +0000 (13:55 +0000)
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh
contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh

index 51fb235c14ec3610e22c90c669607935562818eb..0a5c96b860c6e00ddebf2226c7766ea19b405171 100755 (executable)
@@ -18,8 +18,8 @@ config_load dhcp
 config_foreach handle_dnsmasq dhcp
 
 uci batch << EOF
 config_foreach handle_dnsmasq dhcp
 
 uci batch << EOF
-set dhcp.${netrenamed}dhcp="dhcp"
-set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp"
+       set dhcp.${netrenamed}dhcp="dhcp"
+       set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp"
 EOF
 
 set_defaults "dhcp_" dhcp.${netrenamed}dhcp
 EOF
 
 set_defaults "dhcp_" dhcp.${netrenamed}dhcp
index 26a896bc7ba982ebbcc6a7dccfedc38636eef0ac..2b32f24ab2b691604ad9aac4c7b0496366b7ad99 100755 (executable)
@@ -13,8 +13,10 @@ handle_dhcp() {
 config_load dhcp
 config_foreach handle_dhcp dnsmasq
 
 config_load dhcp
 config_foreach handle_dhcp dnsmasq
 
-uci set dhcp.dnsmasq.local="/$profile_suffix/"
-uci set dhcp.dnsmasq.domain="$profile_suffix"
+uci batch << EOF
+       set dhcp.dnsmasq.local="/$profile_suffix/"
+       set dhcp.dnsmasq.domain="$profile_suffix"
+EOF
 
 config_get addnhosts dnsmasq addnhosts
 if [ -z "${addnhosts/\var\/etc\/hosts.olsr/}" ]; then
 
 config_get addnhosts dnsmasq addnhosts
 if [ -z "${addnhosts/\var\/etc\/hosts.olsr/}" ]; then
index f5c44161ec6dec54d4867e39743260c60706db21..14134e5c6dca8b1f30b16f48884d4d17e42a283d 100755 (executable)
@@ -48,11 +48,11 @@ handle_fwzone() {
 config_foreach handle_fwzone zone
 
 uci batch << EOF
 config_foreach handle_fwzone zone
 
 uci batch << EOF
-set firewall.zone_freifunk="zone"
-set firewall.zone_freifunk.name="freifunk"
-set firewall.zone_freifunk.input="$zone_freifunk_input"
-set firewall.zone_freifunk.forward="$zone_freifunk_forward"
-set firewall.zone_freifunk.output="$zone_freifunk_output"
+       set firewall.zone_freifunk="zone"
+       set firewall.zone_freifunk.name="freifunk"
+       set firewall.zone_freifunk.input="$zone_freifunk_input"
+       set firewall.zone_freifunk.forward="$zone_freifunk_forward"
+       set firewall.zone_freifunk.output="$zone_freifunk_output"
 EOF
 
 uci_commitverbose "Setup firewall zones" firewall
 EOF
 
 uci_commitverbose "Setup firewall zones" firewall
index 1d4c3ba7e196be9b896228c5b794e57c04b90aa0..90e6248c4e35fe8fc1cfae49966f3f3c45421dd7 100755 (executable)
@@ -12,10 +12,11 @@ ipaddr=$(uci get meshwizard.netconfig.$net\_ip4addr)
 [ -z "$interface_netmask" ] && interface netmask="255.255.0.0"
 
 uci batch << EOF
 [ -z "$interface_netmask" ] && interface netmask="255.255.0.0"
 
 uci batch << EOF
-set network.$netrenamed="interface"
-set network.$netrenamed.proto="static"
-set network.$netrenamed.ipaddr="$ipaddr"
+       set network.$netrenamed="interface"
+       set network.$netrenamed.proto="static"
+       set network.$netrenamed.ipaddr="$ipaddr"
 EOF
 EOF
+
 set_defaults "interface_" network.$netrenamed
 uci_commitverbose "Setup interface $netrenamed" network
 
 set_defaults "interface_" network.$netrenamed
 uci_commitverbose "Setup interface $netrenamed" network
 
@@ -61,12 +62,12 @@ if [ "$net_dhcp" == 1 ]; then
                uci set network.${netrenamed}dhcp.interface="$netrenamed"
        fi
 
                uci set network.${netrenamed}dhcp.interface="$netrenamed"
        fi
 
-       uci batch << EOF
-       set network.${netrenamed}dhcp.proto=static
-       set network.${netrenamed}dhcp.ipaddr="$START"
-       set network.${netrenamed}dhcp.netmask="$NETMASK"
-       uci_commitverbose  "Setup interface for ${netrenamed}dhcp" network
-EOF
+       uci batch <<- EOF
+               set network.${netrenamed}dhcp.proto=static
+               set network.${netrenamed}dhcp.ipaddr="$START"
+               set network.${netrenamed}dhcp.netmask="$NETMASK"
+               uci_commitverbose  "Setup interface for ${netrenamed}dhcp" network
+       EOF
 
 fi
 
 
 fi
 
index 39a4849c8228cc29dd5cc988e8dc1b6f3e65a5f3..b4de9ce1944d388caf2a48796567616a866535d8 100755 (executable)
@@ -37,12 +37,12 @@ else
        suffix=".olsr"
 fi
 uci batch << EOF
        suffix=".olsr"
 fi
 uci batch << EOF
-set olsrd.olsrd_nameservice=LoadPlugin
-set olsrd.olsrd_nameservice.library="olsrd_nameservice.so.0.3"
-set olsrd.olsrd_nameservice.latlon_file="/var/run/latlon.js"
-set olsrd.olsrd_nameservice.hosts_file="/var/etc/hosts.olsr"
-set olsrd.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid"
-set olsrd.olsrd_nameservice.suffix="$suffix"
+       set olsrd.olsrd_nameservice=LoadPlugin
+       set olsrd.olsrd_nameservice.library="olsrd_nameservice.so.0.3"
+       set olsrd.olsrd_nameservice.latlon_file="/var/run/latlon.js"
+       set olsrd.olsrd_nameservice.hosts_file="/var/etc/hosts.olsr"
+       set olsrd.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid"
+       set olsrd.olsrd_nameservice.suffix="$suffix"
 EOF
 
 uci_commitverbose "Setup olsr nameservice plugin" olsrd
 EOF
 
 uci_commitverbose "Setup olsr nameservice plugin" olsrd
index afbe1d5dae1e73a6da9866276357051fc1261152..16cd71dc9564b087cb983e656b1baed6609e230c 100755 (executable)
@@ -25,9 +25,11 @@ if [ "$dhcp_range" == 1 ]; then
        config_load luci_splash
        config_foreach handle_splash iface
 
        config_load luci_splash
        config_foreach handle_splash iface
 
-       uci set luci_splash.${netrenamed}dhcp="iface"
-       uci set luci_splash.${netrenamed}dhcp.network="${netrenamed}dhcp"
-       uci set luci_splash.${netrenamed}dhcp.zone="freifunk"
+       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
 
        uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash
        /etc/init.d/luci_splash enable
 
        uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash
        /etc/init.d/luci_splash enable
index e41695f8c302330716d47ffd020b4da51e1e4f68..a1bec345ca57a7acac6da4fd1a15e5c1396cec6b 100755 (executable)
@@ -21,28 +21,28 @@ uci delete meshwizard.wan && uci commit meshwizard
 # Firewall rules to allow incoming ssh and web
 
 if [ "$wan_allowssh" == 1 ]; then
 # Firewall rules to allow incoming ssh and web
 
 if [ "$wan_allowssh" == 1 ]; then
-       uci batch << EOF
-set firewall.wanssh=rule
-set firewall.wanssh.src=wan
-set firewall.wanssh.target=ACCEPT
-set firewall.wanssh.proto=tcp
-set firewall.wanssh.dest_port=22
-EOF
+       uci batch <<- EOF
+               set firewall.wanssh=rule
+               set firewall.wanssh.src=wan
+               set firewall.wanssh.target=ACCEPT
+               set firewall.wanssh.proto=tcp
+               set firewall.wanssh.dest_port=22
+       EOF
        uci_commitverbose "Allow incoming connections to port 22 (ssh) on wan" firewall
 fi
 
 if [ "$wan_allowweb" == 1 ]; then
        uci_commitverbose "Allow incoming connections to port 22 (ssh) on wan" firewall
 fi
 
 if [ "$wan_allowweb" == 1 ]; then
-       uci batch << EOF
-set firewall.wanweb=rule
-set firewall.wanweb.src=wan
-set firewall.wanweb.target=ACCEPT
-set firewall.wanweb.proto=tcp
-set firewall.wanweb.dest_port=80
-set firewall.wanwebhttps=rule
-set firewall.wanwebhttps.src=wan
-set firewall.wanwebhttps.target=ACCEPT
-set firewall.wanwebhttps.proto=tcp
-set firewall.wanwebhttps.dest_port=443
-EOF
+       uci batch <<- EOF
+               set firewall.wanweb=rule
+               set firewall.wanweb.src=wan
+               set firewall.wanweb.target=ACCEPT
+               set firewall.wanweb.proto=tcp
+               set firewall.wanweb.dest_port=80
+               set firewall.wanwebhttps=rule
+               set firewall.wanwebhttps.src=wan
+               set firewall.wanwebhttps.target=ACCEPT
+               set firewall.wanwebhttps.proto=tcp
+               set firewall.wanwebhttps.dest_port=443
+       EOF
        uci_commitverbose "Allow incoming connections to port 80 and 443 (http and https) on wan" firewall
 fi
        uci_commitverbose "Allow incoming connections to port 80 and 443 (http and https) on wan" firewall
 fi
index 52db4d944eec5ac84ae0779bcbb08943bb146d10..55965dc61a2fe1bdc332900949404e3ceff2b84d 100755 (executable)
@@ -35,8 +35,8 @@ if [ -z "$channel" -o "$channel" == "default" ]; then
 fi
 
 uci batch << EOF
 fi
 
 uci batch << EOF
-set wireless.${net}.type="$type"
-set wireless.${net}.channel="$channel"
+       set wireless.${net}.type="$type"
+       set wireless.${net}.channel="$channel"
 EOF
 
 uci_commitverbose "Setup wifi device for $netrenamed" wireless
 EOF
 
 uci_commitverbose "Setup wifi device for $netrenamed" wireless
@@ -69,10 +69,10 @@ if [ "$profile_ssid_scheme" == "addchannel" ]; then
 fi
 
 uci batch << EOF
 fi
 
 uci batch << EOF
-set wireless.$net\_iface.device="${net}"
-set wireless.$net\_iface.network="$netrenamed"
-set wireless.$net\_iface.ssid="$ssid"
-set wireless.$net\_iface.bssid="$bssid"
+       set wireless.$net\_iface.device="${net}"
+       set wireless.$net\_iface.network="$netrenamed"
+       set wireless.$net\_iface.ssid="$ssid"
+       set wireless.$net\_iface.bssid="$bssid"
 EOF
 
 uci_commitverbose "Setup wifi interface for $netrenamed" wireless
 EOF
 
 uci_commitverbose "Setup wifi interface for $netrenamed" wireless
@@ -80,14 +80,14 @@ uci_commitverbose "Setup wifi interface for $netrenamed" wireless
 ## VAP
 ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)"
 if [ "$type" == "atheros" -a "$vap" == 1 ]; then
 ## VAP
 ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)"
 if [ "$type" == "atheros" -a "$vap" == 1 ]; then
-       uci batch << EOF
-set wireless.$net\_iface_dhcp="wifi-iface"
-set wireless.$net\_iface_dhcp.device="$net"
-set wireless.$net\_iface_dhcp.mode="ap"
-set wireless.$net\_iface_dhcp.encryption="none"
-set wireless.$net\_iface_dhcp.network="${netrenamed}dhcp"
-set wireless.$net\_iface_dhcp.ssid="FF-AP-$ip4addr"
-EOF
+       uci batch <<- EOF
+               set wireless.$net\_iface_dhcp="wifi-iface"
+               set wireless.$net\_iface_dhcp.device="$net"
+               set wireless.$net\_iface_dhcp.mode="ap"
+               set wireless.$net\_iface_dhcp.encryption="none"
+               set wireless.$net\_iface_dhcp.network="${netrenamed}dhcp"
+               set wireless.$net\_iface_dhcp.ssid="FF-AP-$ip4addr"
+       EOF
        uci_commitverbose "Setup VAP interface for $netrenamed" wireless
 fi
 
        uci_commitverbose "Setup VAP interface for $netrenamed" wireless
 fi