X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=contrib%2Fpackage%2Fmeshwizard%2Ffiles%2Fusr%2Fbin%2Fmeshwizard%2Fwizard.sh;h=450473868e7a8ca4d18025701f61465f11729d19;hb=6a7eaeb4860bcdfac0ecf4349afc396212c1d467;hp=f159268d3e5e91646688606123069576e9a0ec79;hpb=016a39fd8aa188e268e9051148f3baaeb0584ded;p=project%2Fluci.git diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh index f159268d3..450473868 100755 --- a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh +++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh @@ -9,15 +9,16 @@ # You may not use this file except in compliance with the License. # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -. /lib/functions.sh - echo " -/* Meshwizard 0.0.8 */ +/* Meshwizard 0.3.1 */ " # config export dir="/usr/bin/meshwizard" + +. /lib/functions.sh . $dir/functions.sh +. $dir/helpers/read_defaults.sh [ -f /proc/net/ipv6_route ] && export has_ipv6=1 # Check which packages we have installed @@ -28,30 +29,28 @@ opkg list_installed |grep luci-app-splash > /dev/null && export has_luci_splash= # Check whether we want to cleanup/restore uci config before setting new options cleanup=$(uci -q get meshwizard.general.cleanup) -[ "$cleanup" == 1 ] && $dir/helpers/restore_default_config.sh +[ "$cleanup" == 1 ] && restore_factory_defaults # Rename wifi interfaces $dir/helpers/rename-wifi.sh +export lan_is_olsr="$(uci -q get meshwizard.netconfig.lan_config)" + # Get community -community=$(uci -q get meshwizard.community.name || uci -q get freifunk.community.name) +community="$(uci -q get meshwizard.community.name || uci -q get freifunk.community.name)" [ -z "$community" ] && echo "Error: Community is not set in /etc/config/freifunk, aborting now." && exit 1 export community="$community" -echo $community + +# we need a list of widgets later on. It will be populated in read_defaults.sh +widgets="" # Get a list of networks we need to setup networks=$(uci show meshwizard.netconfig | grep -v "netconfig=" | sed -e 's/meshwizard.netconfig\.\(.*\)\_.*/\1/' |sort|uniq) export networks [ -z "$networks" ] && echo "Error: No networks to setup could be found in /etc/config/meshwizard, aborting now." && exit 1 -# Read default values (first from /etc/config/freifunk, then from /etc/config/profile_$community -# then /etc/config/meshwizard -# last will overwrite first - -$dir/helpers/read_defaults.sh $community > /tmp/meshwizard.tmp -while read line; do - export "${line//\"/}" -done < /tmp/meshwizard.tmp +# Read defaults and node config +read_defaults $community # Do config $dir/helpers/initial_config.sh @@ -59,19 +58,30 @@ $dir/helpers/setup_dnsmasq.sh $dir/helpers/setup_system.sh $dir/helpers/setup_olsrd.sh $dir/helpers/setup_firewall.sh +$dir/helpers/setup_ssh.sh +$dir/helpers/setup_uhttpd.sh +$dir/helpers/setup_widgets.sh if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask" ]; then $dir/helpers/setup_wan_static.sh fi +if [ "$wan_proto" == "dhcp" ]; then + $dir/helpers/setup_wan_dhcp.sh +fi + +if [ -n "$wan_down" -a -n "$wan_up" ]; then + $dir/helpers/setup_qos.sh +fi + if [ "$lan_proto" == "static" ] && [ -n "$lan_ip4addr" ] && [ -n "$lan_netmask" ]; then $dir/helpers/setup_lan_static.sh fi -if [ "$profile_ipv6" == 1 ] && [ "$has_ipv6" = 1 ]; then +if [ "$ipv6_enabled" == 1 ] && [ "$has_ipv6" = 1 ]; then $dir/helpers/setup_lan_ipv6.sh # Setup auto-ipv6 - if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then + if [ -n "$(echo "$ipv6_config" |grep auto-ipv6)" ]; then $dir/helpers/setup_auto-ipv6.sh fi fi @@ -88,13 +98,31 @@ for net in $networks; do # radioX devices need to be renamed netrenamed="${net/radio/wireless}" export netrenamed - $dir/helpers/setup_network.sh $net + if [ ! "$net" == "wan" ] && [ ! "$net" == "lan" ]; then $dir/helpers/setup_wifi.sh $net + # check if this net supports vap + /sbin/wifi # wifi needs to be up for the check + export supports_vap="0" + type="$(uci -q get wireless.$net.type)" + [ -n "$type" ] && $dir/helpers/supports_vap.sh $net $type && export supports_vap=1 + if [ "$supports_vap" = 1 ]; then + $dir/helpers/setup_wifi_vap.sh $net + fi fi + + $dir/helpers/setup_network.sh $net + $dir/helpers/setup_olsrd_interface.sh $net net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp) + export ${net}_dhcp=$net_dhcp + + if [ "$net" = "lan" ] && [ "$lan_is_olsr" = "1" ]; then + uci -q set dhcp.lan.ignore="1" + uci_commitverbose "Disable DHCP on LAN because it is an olsr interface." dhcp + fi + if [ "$net_dhcp" == 1 ]; then $dir/helpers/setup_dhcp.sh $net fi @@ -102,11 +130,16 @@ for net in $networks; do $dir/helpers/setup_splash.sh $net $dir/helpers/setup_firewall_interface.sh $net - if [ "$profile_ipv6" == 1 ] && [ "$has_ipv6" = 1 ]; then - $dir/helpers/setup_radvd_interface.sh $net + if [ -n "$(echo "$ipv6_config" |grep auto-ipv6)" ]; then + $dir/helpers/setup_auto-ipv6-interface.sh $net fi done +##### postinstall script + +[ -f /etc/rc.local.meshkitpostinstall ] && /etc/rc.local.meshkitpostinstall + + ##### Reboot the router (because simply restarting services gave errors) echo "+ The wizard has finished and the router will reboot now."