From: Sameer Agrawal Date: Mon, 12 Mar 2018 18:57:12 +0000 (+0000) Subject: Fix ifconfig parsing X-Git-Tag: debian/1%20180328~18 X-Git-Url: http://git.grml.org/?p=live-boot-grml.git;a=commitdiff_plain;h=0d766871a04b491ea9ff5e5d3eb0ae16cb288441 Fix ifconfig parsing ifconfig from net-tools does not output "inet.*addr:" pattern anymore. Match IP addresses instead. But ifconfig from busybox does, so try and match either patterns. $ /sbin/ifconfig wlp2s0 | grep 'inet.*addr:' $ /sbin/ifconfig eth0 | grep -E 'inet.*addr:|inet [0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*' inet 192.168.1.91 netmask 255.255.255.0 broadcast 192.168.1.255 $ busybox ifconfig eth0 | grep -E 'inet.*addr:|inet [0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*' inet addr:192.168.1.91 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fd00::1:60ad:2691:4cc6:f32/64 Scope:Global inet6 addr: fe80::96de:80ff:feae:b976/64 Scope:Link inet6 addr: fd00::1:96de:80ff:feae:b976/64 Scope:Global inet6 addr: 2a00:23c5:be85:1400:96de:80ff:feae:b976/64 Scope:Global inet6 addr: 2a00:23c5:be85:1400:60ad:2691:4cc6:f32/64 Scope:Global Closes: #892772 --- diff --git a/components/9990-networking.sh b/components/9990-networking.sh index 9613364..dd1d0f0 100755 --- a/components/9990-networking.sh +++ b/components/9990-networking.sh @@ -107,7 +107,7 @@ do_netsetup () # if configuration of device worked we should have an assigned # IP address, if so let's use the device as $DEVICE for later usage. # simple and primitive approach which seems to work fine - if ifconfig $dev | grep -q 'inet.*addr:' + if ifconfig $dev | grep -q -E 'inet.*addr:|inet [0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*' then export DEVICE="$dev" break