netcardconfig: sed command resets WPASECRET
[grml-network.git] / sbin / netcardconfig
index ba8d7bf..d3ea772 100755 (executable)
@@ -335,8 +335,7 @@ configiface() {
             fi
           done
 
-          # make sure backslashes inside passphrase are handled correct
-          WPASECRET=$(sed -e 's/\\/\\/g' "$TMP") && rm -r "$TMP"
+          rm -f "$TMP"
 
           case $WPA_DEV in
                hostap)
@@ -498,11 +497,15 @@ fi
 if [ -z "$WLAN" ] ; then
   WLAN_OLD=$(tail -n +3 /proc/net/wireless 2>/dev/null|awk -F: '{print $1}')
   # /proc/net/wireless does not work e.g. with iwl3945 on kernel 2.6.33 anymore
-  WLAN_NEW=$(for i in /sys/class/net/* ; do [ -d $i/wireless ] && basename $i ; done)
-  WLAN=$(echo $WLAN_OLD $WLAN_NEW | sort -u)
+  WLAN_NEW=$(for i in /sys/class/net/* ; do ( [ -d $i/wireless ] || [ -d $i/phy80211 ] ) && basename $i ; done)
+  set -a WLAN_IWCONFIG
+  for DEV in $LAN ; do
+    iwconfig $DEV 2>/dev/null 1>&2 && WLAN_IWCONFIG+=($DEV)
+  done
+  WLAN=$(echo $WLAN_OLD $WLAN_NEW ${WLAN_IWCONFIG[@]} | tr ' ' '\n' | sort -u)
 fi
 
-unset LAN_DEVICES WLAN_DEVICES FIREWIRE_DEVICES NETDEVICES
+unset LAN_DEVICES WLAN_DEVICES FIREWIRE_DEVICES NETDEVICES WLAN_IWCONFIG
 
 while read dev mac; do
 #echo "Making NETDEVICES $NETDEVICESCOUNT $dev"