From 9ff6dc22749136dc231096946eaad199f65fd2ca Mon Sep 17 00:00:00 2001 From: Joe Cooper Date: Mon, 10 Jul 2017 16:35:12 -0500 Subject: [PATCH] Probably fix detect_ip --- slib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/slib.sh b/slib.sh index 91e317a..7d4d249 100644 --- a/slib.sh +++ b/slib.sh @@ -450,7 +450,8 @@ setconfig () { # Detect the primary IP address # works across most Linux and FreeBSD (maybe) detect_ip () { - primaryaddr=$(/sbin/ip -f inet -o -d addr show dev \`/sbin/ip ro ls | grep default | awk '{print $5}'\` | head -1 | awk '{print $4}' | cut -d"/" -f1) + defaultdev=$(ip ro ls|grep default|awk '{print $5}') + primaryaddr=$(ip -f inet addr show dev "$defaultdev"|grep 'inet '|awk '{print $2}'| cut -d"/" -f1) if [ "$primaryaddr" ]; then log_debug "Primary address detected as $primaryaddr" address=$primaryaddr