more fixes
[openwrt.git] / package / base-files / files / sbin / wifi
index 151036e..2ca5d22 100755 (executable)
@@ -38,7 +38,7 @@ bridge_interface() {(
 wifi_updown() {
        for device in ${2:-$DEVICES}; do (
                config_get disabled "$device" disabled
-               [ "$disabled" == "1" ] && {
+               [ 1 == "$disabled" ] && {
                        echo "'$device' is disabled"
                        set disable
                }
@@ -71,25 +71,29 @@ start_net() {(
        setup_interface "$1" "$2"
 )}
 
-config_cb() {
-       config_get TYPE "$CONFIG_SECTION" TYPE
-       case "$TYPE" in
-               wifi-device)
-                       append DEVICES "$CONFIG_SECTION"
-               ;;
-               wifi-iface)
-                       config_get device "$CONFIG_SECTION" device
-                       config_get vifs "$device" vifs 
-                       append vifs "$CONFIG_SECTION"
-                       config_set "$device" vifs "$vifs"
-               ;;
-       esac
+scan_wifi() {
+       local cfgfile="$1"
+       config_cb() {
+               config_get TYPE "$CONFIG_SECTION" TYPE
+               case "$TYPE" in
+                       wifi-device)
+                               append DEVICES "$CONFIG_SECTION"
+                       ;;
+                       wifi-iface)
+                               config_get device "$CONFIG_SECTION" device
+                               config_get vifs "$device" vifs 
+                               append vifs "$CONFIG_SECTION"
+                               config_set "$device" vifs "$vifs"
+                       ;;
+               esac
+       }
+       config_load "${cfgfile:-wireless}"
 }
 
 DEVICES=
 DRIVERS=
-config_load wireless
 include /lib/wifi
+scan_wifi
 
 case "$1" in
        down) wifi_updown "disable" "$2";;
This page took 0.025469 seconds and 4 git commands to generate.