PXE: Use first route IP if multiple routes are found

pull/84/merge
Tomas-M 2019-07-31 07:53:07 +02:00 committed by GitHub
parent 72de891a3d
commit 73d605d9ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ FTPROOT=/var/state/dnsmasq/root
# find out our own IP address. If more interfaces are available, use the first one # find out our own IP address. If more interfaces are available, use the first one
IP="$(hostname -I | cut -d " " -f 1)" IP="$(hostname -I | cut -d " " -f 1)"
GW=$(ip route show | grep default | grep -o "via.*" | cut -d " " -f 2) GW=$(ip route show | grep default | grep -o "via.*" | head -n 1 | cut -d " " -f 2)
# if no IP is assigned to this computer, setup private address randomly # if no IP is assigned to this computer, setup private address randomly
if [ "$IP" = "" ]; then if [ "$IP" = "" ]; then