2 # sets up a wifi interface for meshing
3 # Arguments: $1 = network interface
9 ##### wifi-device #####
11 # Get the type before we delete the wifi-device
13 config_get type $net type
15 # Rename wifi-device for $net
18 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
19 section_rename wireless $1 $net
22 config_foreach handle_wifidevice wifi-device
24 # create new wifi-device for $net
25 uci set wireless.${net}=wifi-device
27 # get and set wifi-device defaults
28 set_defaults "wifi_device_" wireless.${net}
30 channel="$(uci -q get meshwizard.netconfig.$net\_channel)"
32 if [ -z "$channel" -o "$channel" == "default" ]; then
33 channel=$wifi_device_channel
37 set wireless.${net}.type="$type"
38 set wireless.${net}.channel="$channel"
41 uci_commitverbose "Setup wifi device for $netrenamed" wireless
45 # Rename wifi-iface for $net
47 config_get device "$1" device
48 if [ "$device" == "$net" ]; then
49 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
50 section_rename wireless $1 ${net}_iface
54 config_foreach handle_interface wifi-iface
56 # create new wifi-device for $net
57 uci set wireless.$net\_iface=wifi-iface
59 # create new wifi-iface for $net from defaults
60 set_defaults "wifi_iface_" wireless.$net\_iface
63 bssid="$($dir/helpers/gen_bssid.sh $channel $community)"
66 if [ "$profile_ssid_scheme" == "addchannel" ]; then
67 ssid="$ssid - ch$channel"
68 elif [ "$profile_ssid_scheme" == "addchannelbefore" ]; then
69 ssid="ch$channel.$ssid"
73 set wireless.$net\_iface.device="${net}"
74 set wireless.$net\_iface.network="$netrenamed"
75 set wireless.$net\_iface.ssid="$ssid"
76 set wireless.$net\_iface.bssid="$bssid"
79 uci_commitverbose "Setup wifi interface for $netrenamed" wireless