Skip to content

Commit

Permalink
Probably fix detect_ip
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed Jul 10, 2017
1 parent 85488c3 commit 9ff6dc2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion slib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9ff6dc2

Please sign in to comment.