Fixing some empty ssid case in wpasupp. - conn - A script repository to manage connections in Linux.
Log
Files
Refs
LICENSE
---
commit 6b4bb81a6429da381cfc5c7d50904968804b4a0f
parent d3e53d1e8d8bcd31d9bde1bcffe171f7505495b9
Author: Christoph Lohmann <20h@r-36.net>
Date:   Tue,  5 Apr 2011 14:59:47 +0200

Fixing some empty ssid case in wpasupp.

Diffstat:
  examples/wifi/wlan0-action.sh       |      57 ++++++++++++++++---------------

1 file changed, 30 insertions(+), 27 deletions(-)
---
diff --git a/examples/wifi/wlan0-action.sh b/examples/wifi/wlan0-action.sh
@@ -14,34 +14,37 @@ getscript() {
         awk -F'\t' "/$1\$/ {print \$1}" networks.tbl
 }
 
-case "$action" in
-        CONNECTED)
-                aps=`getstates "wifi" $interface $ssid`
-                if [ "$aps" != "" ];
-                then
-                        for i in "$aps":
-                        do
-                                issid=`echo $i | awk '{print $2}'`
-                                $0 $interface DISCONNECTED $issid
-                        done
-                fi
-
-                addstate "wifi" $interface $ssid
-                ;;
-        DISCONNECTED)
-                delstate "wifi" $interface $ssid
-                ;;
-        *)
-                exit 1;
-                ;;
-esac
-
-script=`getscript $ssid`
-if [ "$script" != "" ];
+if [ "$ssid" != "" ];
 tthen
-        cd networks
-        ./$script $interface $action
-        exit $?
+        case "$action" in
+                CONNECTED)
+                        aps=`getstates "wifi" $interface $ssid`
+                        if [ "$aps" != "" ];
+                        then
+                                for i in "$aps":
+                                do
+                                        issid=`echo $i | awk '{print $2}'`
+                                        $0 $interface DISCONNECTED $issid
+                                done
+                        fi
+
+                        addstate "wifi" $interface $ssid
+                        ;;
+                DISCONNECTED)
+                        delstate "wifi" $interface $ssid
+                        ;;
+                *)
+                        exit 1;
+                        ;;
+        esac
+
+        script=`getscript $ssid`
+        if [ "$script" != "" ];
+        then
+                cd networks
+                ./$script $interface $action
+                exit $?
+        fi
 fi
 
 case "$action" in