From: Michael Prokop Date: Fri, 2 Apr 2010 16:16:14 +0000 (+0200) Subject: Update device detection in grml-pptp-xdsl-students and netcardconfig. X-Git-Tag: v0.3.2~3 X-Git-Url: http://git.grml.org/?p=grml-network.git;a=commitdiff_plain;h=bb0940fb98d00d4234bbb95656699ae503f10707 Update device detection in grml-pptp-xdsl-students and netcardconfig. --- diff --git a/debian/changelog b/debian/changelog index 64d9f8c..deba427 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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. diff --git a/sbin/grml-pptp-xdsl-students b/sbin/grml-pptp-xdsl-students index a57a765..9a26a6b 100755 --- a/sbin/grml-pptp-xdsl-students +++ b/sbin/grml-pptp-xdsl-students @@ -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 diff --git a/sbin/netcardconfig b/sbin/netcardconfig index 9312052..03784a9 100755 --- a/sbin/netcardconfig +++ b/sbin/netcardconfig @@ -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