autodetect default interface

This commit is contained in:
nacho 2018-09-19 18:13:15 -06:00
parent 2566eef8ca
commit da2c0b2200
1 changed files with 1 additions and 1 deletions

View File

@ -28,7 +28,6 @@ IMG=$1
KERNEL=kernel-qemu-4.4.34-jessie
NO_NETWORK=1 # set to 1 to skip network configuration
IFACE=enp3s0 # interface that we currently use for internet
BRIDGE=br0 # name for the bridge we will create to share network with the raspbian img
MAC='52:54:be:36:42:a9' # comment this line for random MAC (maybe annoying if on DHCP)
BINARY_PATH=/usr/bin # path prefix for binaries
@ -38,6 +37,7 @@ NO_GRAPHIC=0 # set to 1 to start in no graphic mode
type qemu-system-arm &>/dev/null || { echo "QEMU ARM not found" ; exit 1; }
test -f $IMG && test -f $KERNEL || { echo "$IMG or $KERNEL not found"; exit 1; }
IFACE="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
[[ "$IFACE" == "" ]] || [[ "$BRIDGE" == "" ]] && NO_NETWORK=1
# some more checks