From 4d148f1a093c65dbad3877456c6481e5060dde97 Mon Sep 17 00:00:00 2001 From: Vincent Legoll Date: Fri, 11 Aug 2017 12:13:27 +0200 Subject: [PATCH] Use "ip address show dev" to fix matching interfaces with dynamic IP This should fix DHCP-managed interfaces from getting thrown a: "no IP found for $IFACE" error message 2: wlp1s0: mtu 1500 qdisc mq state UP group default qlen 1000 link/ether d0:57:7b:8f:21:59 brd ff:ff:ff:ff:ff:ff inet 192.168.1.40/24 brd 192.168.1.255 scope global dynamic wlp1s0 valid_lft 76951sec preferred_lft 76951sec inet6 fe80::8aa8:51b1:4088:d7c0/64 scope link valid_lft forever preferred_lft forever --- qemu-pi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-pi.sh b/qemu-pi.sh index 2308a44..e73f44a 100755 --- a/qemu-pi.sh +++ b/qemu-pi.sh @@ -41,7 +41,7 @@ test -f $IMG && test -f $KERNEL || { echo "$IMG or $KERNEL not found"; exit; } # some more checks [[ "$NO_NETWORK" != "1" ]] && { - IP=$( ip address | grep "global $IFACE" | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 ) + IP=$( ip address show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 ) [[ "$IP" == "" ]] && { echo "no IP found for $IFACE"; NO_NETWORK=1; } type brctl &>/dev/null || { echo "brctl is not installed"; NO_NETWORK=1; } modprobe tun &>/dev/null