Update device detection in grml-pptp-xdsl-students and netcardconfig.
authorMichael Prokop <mika@grml.org>
Fri, 2 Apr 2010 16:16:14 +0000 (18:16 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 2 Apr 2010 16:16:14 +0000 (18:16 +0200)
debian/changelog
sbin/grml-pptp-xdsl-students
sbin/netcardconfig

index 64d9f8c..deba427 100644 (file)
@@ -1,3 +1,11 @@
+grml-network (0.3.2) unstable; urgency=low
+
+  * Update device detection in grml-pptp-xdsl-students and
+    netcardconfig (iwl3945 doesn't have an entry in
+    /proc/net/wireless with kernel 2.6.33 for example).
+
+ -- Michael Prokop <mika@grml.org>  Fri, 02 Apr 2010 18:14:37 +0200
+
 grml-network (0.3.1) unstable; urgency=low
 
   * New script grml-sniff for configuring a network sniffing setup.
index a57a765..9a26a6b 100755 (executable)
@@ -125,10 +125,10 @@ if [ -z "$VPNUSERNAME" ] || [ -z "$VPNPASSWORD" ] ; then
   exit $1
   }
 
-  NETDEVICES="$(cat /proc/net/dev | awk -F: '/[0-9]:/{print $1}')"
+  NETDEVICES="$(grep -ve 'lo:' -ve 'Inter-|' -ve 'face |bytes' /proc/net/dev | awk -F: '{print $1}')"
 
   wireless(){
-   case "$(cat /proc/net/wireless 2>/dev/null)" in *$1*) return 0;; esac
+   [ -d "/sys/class/net/${1}/wireless" ] && return 0
    # Card exists but is not configured yet
    [ -n "$(iwconfig $1 2>/dev/null | head -1)" ] && return 0
    return 1
index 9312052..03784a9 100755 (executable)
@@ -486,7 +486,14 @@ if [ -r /proc/net/dev ] ; then
 else
    LAN=""
 fi
-[ -n "$WLAN" ] || WLAN=$(tail -n +3 /proc/net/wireless 2>/dev/null|awk -F: '{print $1}'|sort)
+
+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)
+fi
+
 unset LAN_DEVICES WLAN_DEVICES FIREWIRE_DEVICES NETDEVICES
 
 while read dev mac; do