netcardconfig: switch from `ifconfig` to `ip link` for interface parsing [Closes...
authorMichael Prokop <mika@grml.org>
Tue, 23 Aug 2016 12:18:23 +0000 (14:18 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 23 Aug 2016 12:18:23 +0000 (14:18 +0200)
Quoting from the bug report:

| ifconfig as of Debian stretch uses a different output format.
| This breaks enumeration of devices in netcardconfig line 576.

ifconfig isn't the state-of-the-art tool anyway, so switching
to ip(8) is an excellent idea. :)

Thanks: Jakob Haufe <sur5r@sur5r.net> for the bugreport and patch

sbin/netcardconfig

index 7124b53..52a1c6a 100755 (executable)
@@ -573,7 +573,7 @@ while read dev mac; do
   fi
 #echo "Made to ${NETDEVICES[$NETDEVICESCOUNT]}"
   ((NETDEVICESCOUNT++))
-done < <(ifconfig -a|grep Ethernet|grep -v ^vmnet|awk '! /^\s/{print $1" "$5}')
+done < <(ip link show | awk ' !/^\s/{sub(/:/,"",$2);IFACE=$2} /link.ether/{if (IFACE !~/^vmnet/) print IFACE" "$2}')
 for dev in $LAN; do
   if [ "$(ethtool -i $dev 2>/dev/null|awk '/^bus-info:/{print $2}')" == "ieee1394" ]; then
     isauto="0"