Changeset 7501
- Timestamp:
- 09/21/11 18:43:38 (20 months ago)
- Location:
- luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard
- Files:
-
- 11 modified
-
functions.sh (modified) (2 diffs)
-
helpers/setup_dhcp.sh (modified) (1 diff)
-
helpers/setup_dnsmasq.sh (modified) (1 diff)
-
helpers/setup_firewall.sh (modified) (6 diffs)
-
helpers/setup_freifunk.sh (modified) (2 diffs)
-
helpers/setup_network.sh (modified) (4 diffs)
-
helpers/setup_olsrd.sh (modified) (7 diffs)
-
helpers/setup_splash.sh (modified) (1 diff)
-
helpers/setup_system.sh (modified) (1 diff)
-
helpers/setup_wifi.sh (modified) (4 diffs)
-
wizard.sh (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/functions.sh
r7208 r7501 13 13 } 14 14 15 # Takes 2 arguments 16 # $1 = text to be displayed in the output for this section 17 # $2 = section (optional) 18 uci_commitverbose() { 19 echo "+ $1" 20 uci changes $2 | while read line; do 21 echo " $line" 22 done 23 uci commit $2 24 } 25 15 26 set_defaults() { 16 27 for def in $(env |grep "^$1"); do 17 28 option=${def/$1/} 18 29 uci set $2.$option 19 echo " ${option/=/: }"20 30 done 21 31 } … … 29 39 section_rename() { 30 40 uci -q rename $1.$2=$3 && msg_rename $1.$2 $1.$3 || msg_rename_error $1.2 $1.$3 31 }32 33 msg_start() {34 echo " Starting configuration of $1"35 41 } 36 42 -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dhcp.sh
r7208 r7501 24 24 uci batch << EOF 25 25 set dhcp.${netrenamed}dhcp="dhcp" 26 set dhcp.${netrenamed}dhcp.leasetime="$ {dhcp_leasetime}"27 set dhcp.${netrenamed}dhcp.force=" 1"26 set dhcp.${netrenamed}dhcp.leasetime="$dhcp_leasetime" 27 set dhcp.${netrenamed}dhcp.force="$dhcp_force" 28 28 set dhcp.${netrenamed}dhcp.interface="${netrenamed}dhcp" 29 29 EOF 30 30 31 echo " leasetime: ${dhcp_leasetime} 32 interface: ${netrenamed}dhcp" 31 uci_commitverbose "Setup DHCP for $netrenamed" dhcp 33 32 -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_dnsmasq.sh
r7208 r7501 14 14 config_foreach handle_dhcp dnsmasq 15 15 16 echo " + Setup dnsmasq"17 18 16 uci set dhcp.dnsmasq.local="/$profile_suffix/" 19 17 uci set dhcp.dnsmasq.domain="$profile_suffix" 20 21 echo " local: /$profile_suffix/22 domain: $profile_suffix"23 18 24 19 config_get addnhosts dnsmasq addnhosts 25 20 if [ -z "${addnhosts/\var\/etc\/hosts.olsr/}" ]; then 26 21 uci add_list dhcp.dnsmasq.addnhosts="/var/etc/hosts.olsr" 27 echo " addnhosts: /var/etc/hosts.olsr"28 22 fi 29 23 30 uci commit 31 24 uci_commitverbose "Setup dnsmasq" dhcp -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
r7252 r7501 20 20 fi 21 21 } 22 config_foreach handle_zonewan zone && echo " + Enable local_restrict for zone wan"22 config_foreach handle_zonewan zone && uci_commitverbose "Enable local_restrict for zone wan" firewall 23 23 24 24 # Delete old firewall zone for freifunk … … 70 70 # setup freifunk firewall zone 71 71 72 echo " + Setup firewall zone."73 74 72 # add $netrenamed and if needed ${netrenamed}dhcp to the networks for this zone 75 73 config_get network zone_freifunk network … … 94 92 EOF 95 93 96 echo " network: $network 97 input: $zone_freifunk_input 98 forward: $zone_freifunk_forward 99 output: $zone_freifunk_output" 94 uci_commitverbose "Setup freifunk firewall zone" firewall 100 95 101 96 # Usually we need to setup masquerading for lan, except lan is an olsr interface or has an olsr hna 102 103 echo " + Setup masquerading rules"104 97 105 98 handle_interface() { … … 122 115 currms=$(uci -q get firewall.zone_freifunk.masq_src) 123 116 if [ ! "$no_masq_lan" == "1" ]; then 124 uci set firewall.zone_freifunk.masq="1" && echo " Enabled masquerading." || echo -e "\033[1mWarning:\033[0m: Could not enable masquerading."117 uci set firewall.zone_freifunk.masq="1" 125 118 [ -z "$(echo $currms |grep lan)" ] && uci add_list firewall.zone_freifunk.masq_src="lan" 126 119 fi … … 138 131 done 139 132 133 uci_commitverbose "Setup masquerading rules" firewall 134 140 135 # Rules, Forwardings, advanced config and includes 141 136 # Clear firewall configuration 142 143 echo " + Setup rules, forwardings, advanced config and includes."144 137 145 138 for config in freifunk profile_$community; do … … 159 152 done 160 153 161 uci commit154 uci_commitverbose "Setup rules, forwardings, advanced config and includes." firewall -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_freifunk.sh
r7381 r7501 2 2 # Sets values in /etc/config/freifunk 3 3 4 . /etc/functions.sh5 4 . $dir/functions.sh 6 5 … … 12 11 fi 13 12 13 uci_commitverbose "/etc/init.d/freifunk config" freifunk 14 14 -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_network.sh
r7208 r7501 15 15 ipaddr=$(uci get meshwizard.netconfig.$net\_ip4addr) 16 16 [ -z "$ipaddr" ] && msg_missing_value meshwizard $net\_ip4addr 17 18 17 [ -z "$interface_netmask" ] && interface netmask="255.255.0.0" 19 18 … … 26 25 EOF 27 26 28 echo " IP address: $ipaddr" 29 echo " Netmask : $interface_netmask" 27 uci_commitverbose "Setup interface $netrenamed" network 30 28 31 29 # setup dhcp alias/interface … … 69 67 70 68 if [ "$vap" == 1 ]; then 71 echo " + Setup interface ${netrenamed}dhcp."72 69 uci set network.${netrenamed}dhcp=interface 73 70 else 74 echo " + Setup alias interface ${netrenamed}dhcp."75 71 uci set network.${netrenamed}dhcp=alias 76 72 uci set network.${netrenamed}dhcp.interface="$netrenamed" … … 83 79 EOF 84 80 85 echo " interface: $net86 ipaddr: $START87 netmask: $NETMASK"88 89 81 fi 90 82 91 uci commit83 uci_commitverbose "Setup interface for ${netrenamed}dhcp" network -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_olsrd.sh
r7208 r7501 6 6 7 7 . /etc/functions.sh 8 9 8 . $dir/functions.sh 10 9 … … 25 24 # Setup new InterfaceDefaults 26 25 27 echo " + Setup InterfaceDefaults"28 26 uci set olsrd.InterfaceDefaults=InterfaceDefaults 29 27 set_defaults "olsr_interfacedefaults_" olsrd.InterfaceDefaults 28 uci_commitverbose "Setup olsr interface defaults" olsrd 30 29 31 30 # Delete old interface for $netrenamed … … 45 44 # Setup new interface for $netrenamed 46 45 47 echo " + Setup Interface" 46 uci set olsrd.$netrenamed=Interface 47 set_defaults "olsr_interface_" olsrd.$net 48 uci set olsrd.$netrenamed.interface="$netrenamed" 48 49 49 uci set olsrd.$netrenamed=Interface 50 51 set_defaults "olsr_interface_" olsrd.$net 52 53 uci set olsrd.$netrenamed.interface="$netrenamed" 54 echo " interface: $netrenamed" 50 uci_commitverbose "Setup olsr interface for $netrenamed." olsrd 55 51 56 52 # If dhcp-network is inside the mesh_network then add HNA for it … … 64 60 65 61 if [ "$dhcpinmesh" == 1 ]; then 66 echo " + Setting up HNA"67 62 uci set olsrd.${netrenamed}clients="Hna4" 68 63 eval $(sh $dir/helpers/ipcalc-cidr.sh $dhcprange) 69 64 uci set olsrd.${netrenamed}clients.netaddr="$NETWORK" 70 65 uci set olsrd.${netrenamed}clients.netmask="$NETMASK" 71 echo " netaddr: $NETWORK" 72 echo " natmask: $NETMASK" 66 uci_commitverbose "Setup HNA for network $dhcprange" olsrd 73 67 fi 74 68 … … 76 70 # Delete nameservice, dyngw and httpinfo plugins 77 71 78 echo " + Configure Plugins"79 72 handle_plugin() { 80 73 config_get library "$1" library … … 106 99 EOF 107 100 108 echo " Nameservice Plugin configured." 101 uci_commitverbose "Setup olsr nameservice plugin" olsrd 109 102 110 103 # Setup dyngw_plain … … 118 111 119 112 if [ "$sharenet" == 1 ]; then 120 echo " + Setup dyngw_plain"121 113 uci set olsrd.dyngw_plain=LoadPlugin 122 114 uci set olsrd.dyngw_plain.ignore=0 123 115 uci set olsrd.dyngw_plain.library="olsrd_dyn_gw_plain.so.0.4" 116 uci_commitverbose "Setup olsrd_dyngw_plain plugin" 124 117 fi 125 118 126 uci commit -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_splash.sh
r7252 r7501 28 28 EOF 29 29 30 echo " network: ${netrenamed}dhcp" 31 32 uci commit 30 uci_commitverbose "Setup dhcpsplash for ${netrenamed}dhcp" luci_splash 33 31 34 32 /etc/init.d/luci_splash enable -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_system.sh
r7264 r7501 2 2 # Sets values from /etc/config/freifunk and/or the community profile in /etc/config/system 3 3 4 . $dir/functions.sh 5 4 6 if [ -n "$(env | grep '^system_')" ]; then 5 echo "++++ Setup system"6 7 env | grep "^system_" | sed "s/system_/uci set system.system./g" | while read line; do 7 8 eval $line 8 echo " $line"9 9 done 10 10 fi 11 11 12 uci commitsystem12 uci_commitverbose "System config" system -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh
r7208 r7501 8 8 9 9 ##### wifi-device ##### 10 11 echo " + Setup wifi-device"12 10 13 11 # Get the type before we delete the wifi-device … … 46 44 EOF 47 45 48 echo " Type: $type" 49 echo " Channel: $channel" 46 uci_commitverbose "Setup wifi device for $netrenamed" wireless 50 47 51 48 ##### wifi iface 52 53 echo " + Setup wifi-iface"54 49 55 50 # Delete old wifi-iface for $net … … 76 71 # overwrite defaults 77 72 bssid="$($dir/helpers/gen_bssid.sh $channel $community)" 73 ssid="$profile_ssid" 74 if [ "$profile_ssid_scheme" == "addchannel" ]; then 75 ssid="$ssid - ch$channel" 76 fi 77 78 78 uci batch << EOF 79 79 set wireless.$net\_iface.device="${net}" 80 80 set wireless.$net\_iface.network="$netrenamed" 81 set wireless.$net\_iface.ssid="$ profile_ssid - ch$channel"81 set wireless.$net\_iface.ssid="$ssid" 82 82 set wireless.$net\_iface.bssid="$bssid" 83 83 EOF 84 84 85 echo " device: $net 86 network: $netrenamed 87 ssid: $profile_ssid - ch$channel 88 bssid: $bssid" 85 uci_commitverbose "Setup wifi interface for $netrenamed" wireless 89 86 90 87 ## VAP … … 99 96 set wireless.$net\_iface_dhcp.ssid="FF-AP-$ip4addr" 100 97 EOF 101 echo " + Setting up VAP interface for $net 102 device: $net 103 network: ${netrenamed}dhcp 104 ssid: AP-$profile_ssid-$ip4addr" 98 uci_commitverbose "Setup VAP interface for $netrenamed" wireless 105 99 fi 106 100 107 uci commit -
luci/trunk/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
r7381 r7501 4 4 5 5 . /etc/functions.sh 6 7 echo " 8 Meshwizard 0.0.3 9 " 6 10 7 11 # config … … 11 15 12 16 # Rename wifi interfaces 13 echo "+ +++Renaming wifi-devices in /etc/config/meshwizard"17 echo "+ Renaming wifi-devices in /etc/config/meshwizard" 14 18 $dir/helpers/rename-wifi.sh 15 19 16 20 # Firstboot/initial config 17 echo "+ +++Initial config"21 echo "+ Initial config" 18 22 $dir/helpers/initial_config.sh 19 23 … … 33 37 [ -z "$networks" ] && echo "Error: No networks to setup could be found in /etc/config/meshwizard, aborting now." && exit 1 34 38 35 echo "+++ wizard 0.0.2 +++ 36 Community=$community 37 Network(s)=$networks" 39 echo " Community=$community 40 Network(s)=$networks" 38 41 39 42 # Read default values (first from /etc/config/freifunk, then from /etc/config/profile_$community, … … 46 49 done < /tmp/meshwizard.tmp 47 50 48 # dnsmasq 49 echo "++++ dnsmasq config" 50 $dir/helpers/setup_dnsmasq.sh 51 52 # system 53 echo "++++ system config" 54 $dir/helpers/setup_system.sh 55 56 # freifunk 57 echo "++++ /etc/config/freifunk config" 58 $dir/helpers/setup_freifunk.sh 51 $dir/helpers/setup_dnsmasq.sh 52 $dir/helpers/setup_system.sh 53 $dir/helpers/setup_freifunk.sh 59 54 60 55 # Configure found networks … … 64 59 export netrenamed 65 60 66 echo "++++ Configure interface $net"67 68 config="network"69 echo "$(msg_start $config)"70 61 $dir/helpers/setup_network.sh $net 71 72 config="wireless"73 echo "$(msg_start $config)"74 62 $dir/helpers/setup_wifi.sh $net 75 76 config="OLSRd"77 echo "$(msg_start $config)"78 63 $dir/helpers/setup_olsrd.sh $net 79 64 80 65 net_dhcp=$(uci -q get meshwizard.netconfig.${net}_dhcp) 81 66 if [ "$net_dhcp" == 1 ]; then 82 config="DHCP"83 echo "$(msg_start $config)"84 67 $dir/helpers/setup_dhcp.sh $net 85 68 fi 86 69 87 config="luci_splash"88 echo "$(msg_start $config)"89 70 $dir/helpers/setup_splash.sh $net 90 91 config="firewall"92 echo "$(msg_start $config)"93 71 $dir/helpers/setup_firewall.sh $net 94 95 echo " Configuration of $net finished."96 72 done 97 73
