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 51fb235..0a5c96b 100755 (executable)
@@ -18,8 +18,8 @@ config_load dhcp
 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
index 26a896b..2b32f24 100755 (executable)
@@ -13,8 +13,10 @@ handle_dhcp() {
 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
index f5c4416..14134e5 100755 (executable)
@@ -48,11 +48,11 @@ handle_fwzone() {
 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
index 1d4c3ba..90e6248 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
-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
+
 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 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
 
index 39a4849..b4de9ce 100755 (executable)
@@ -37,12 +37,12 @@ else
        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
index afbe1d5..16cd71d 100755 (executable)
@@ -25,9 +25,11 @@ if [ "$dhcp_range" == 1 ]; then
        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
index e41695f..a1bec34 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
-       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 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
index 52db4d9..55965dc 100755 (executable)
@@ -35,8 +35,8 @@ if [ -z "$channel" -o "$channel" == "default" ]; then
 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
@@ -69,10 +69,10 @@ if [ "$profile_ssid_scheme" == "addchannel" ]; then
 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
@@ -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
-       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