Bump to Standard Version 3.8.3; add grml-sniff to long descr
[grml-network.git] / sbin / netcardconfig
index 4e453d0..9312052 100755 (executable)
@@ -4,7 +4,6 @@
 # Authors:       Michael Prokop <mika@grml.org>, Marcel Wichern 2006, Klaus Knopper 2002, Niall Walsh + Stefan Lippers-Hollmann 2004-2007
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Mit Mai 30 10:26:39 CEST 2007 [mika]
 ################################################################################
 # Changes have been merged from Kanotix's and Sidux's netcardconfig:
 # http://kanotix.com/files/debian/pool/main/n/netcardconfig-kanotix/
@@ -91,7 +90,11 @@ generate_udev_entry() {
 # running this script (once more)." > /etc/udev/scripts/netcardconfig
   for interface in `ifconfig | awk '/^[a-z]/ &&!/^lo/{ print $1} '` ; do
       echo -n "INTERFACE=$interface /lib/udev/write_net_rules " >> /etc/udev/scripts/netcardconfig && \
-      udevinfo -a -p /sys/class/net/$interface | awk -F'==' '/address/ {print $2}' >> /etc/udev/scripts/netcardconfig
+      if which udevadm >/dev/null 2>&1; then
+        udevadm info -a -p /sys/class/net/$interface | awk -F'==' '/address/ {print $2}' >> /etc/udev/scripts/netcardconfig
+      else
+        udevinfo -a -p /sys/class/net/$interface | awk -F'==' '/address/ {print $2}' >> /etc/udev/scripts/netcardconfig
+      fi
   done
   # send errors to /dev/null as well because the sed line inside the /lib/udev/write_net_rules
   # script outputs a sed warning which might unsettle users
@@ -478,9 +481,14 @@ MESSAGEW26=")?   If you say no, your wep key will be stored in /etc/network/inte
 
 
 NETDEVICESCOUNT=0
-LAN=$(tail -n +3 /proc/net/dev|awk -F: '{print $1}'|sed "s/\s*//"|grep -v -e ^lo -e ^vmnet|sort)
+if [ -r /proc/net/dev ] ; then
+   LAN=$(tail -n +3 /proc/net/dev | awk -F: '{print $1}'| sed "s/\s*//" | grep -v -e ^lo -e ^vmnet | sort)
+else
+   LAN=""
+fi
 [ -n "$WLAN" ] || WLAN=$(tail -n +3 /proc/net/wireless 2>/dev/null|awk -F: '{print $1}'|sort)
 unset LAN_DEVICES WLAN_DEVICES FIREWIRE_DEVICES NETDEVICES
+
 while read dev mac; do
 #echo "Making NETDEVICES $NETDEVICESCOUNT $dev"
   iswlan=$(echo $dev $WLAN|tr ' ' '\n'|sort|uniq -d)