autodetect default interface
This commit is contained in:
parent
2566eef8ca
commit
da2c0b2200
|
|
@ -28,7 +28,6 @@ IMG=$1
|
||||||
KERNEL=kernel-qemu-4.4.34-jessie
|
KERNEL=kernel-qemu-4.4.34-jessie
|
||||||
|
|
||||||
NO_NETWORK=1 # set to 1 to skip network configuration
|
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
|
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)
|
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
|
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; }
|
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; }
|
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
|
[[ "$IFACE" == "" ]] || [[ "$BRIDGE" == "" ]] && NO_NETWORK=1
|
||||||
|
|
||||||
# some more checks
|
# some more checks
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue