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
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_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
[ -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
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
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
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
# 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
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
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
## 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