X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=sbin%2Fnetcardconfig;h=37fd76135461f596faeb3404c31e7ac60c13010a;hb=77958efbab0938991b019108e77ccc08751f4c81;hp=ad76a5fcb007ece7cd352addba7fb20a9024e885;hpb=dba69be9cd8518ad2ccd972e64cafa07672a16b0;p=grml-network.git diff --git a/sbin/netcardconfig b/sbin/netcardconfig index ad76a5f..37fd761 100755 --- a/sbin/netcardconfig +++ b/sbin/netcardconfig @@ -4,7 +4,6 @@ # Authors: Michael Prokop , 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/ @@ -16,7 +15,7 @@ LANGUAGE=C LANG=C export PATH LANGUAGE LANG . /etc/grml/script-functions -check4root +check4root || exit 1 TMP=$(mktemp) @@ -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 @@ -153,6 +156,8 @@ configiface() { DEVICE=${NETDEVICES[$DV]} device2props DV=$DEVICENAME + ifdown $DV + sleep 3 # wireless config WLDEVICE="$(LANG=C LC_MESSAGEWS=C iwconfig $DV 2>/dev/null | awk '/802\.11|READY|ESSID/{print $1}')" WLDEVICECOUNT="$(LANG=C LC_MESSAGEWS=C iwconfig $DV 2>/dev/null | wc -l)" @@ -322,7 +327,13 @@ configiface() { } } ' /etc/network/interfaces) - $DIALOG --inputbox "$MESSAGEW23 $ESSID" 15 50 "$WPASECRET" 2>"$TMP" || bailout 1 + while [ -z "$WPASECRET" ] ; do + $DIALOG --inputbox "$MESSAGEW23 $ESSID" 15 50 "$WPASECRET" 2>"$TMP" || bailout 1 + read WPASECRET <"$TMP" + if [ -z "$WPASECRET" ] ; then + $DIALOG --msgbox "Sorry, empty password not allowed, please retry." 0 0 || bailout 1 + fi + done # make sure backslashes inside passphrase are handled correct WPASECRET=$(sed -e 's/\\/\\/g' "$TMP") && rm -r "$TMP" @@ -483,7 +494,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 @@ -562,8 +580,6 @@ while (true); do IFACEDONE="" while [ -n "$DV" -a -z "$IFACEDONE" ]; do configiface - ifdown $DV - sleep 3 if ! ifup $DV; then $DIALOG --yesno "$MESSAGE14" 15 50 || IFACEDONE="DONE" else