Roan Huang

Fix ifconfig parsing in onos-setup-karaf

ifconfig output in CentOS7 is different from Ubuntu.
This one should work with OS X, Ubuntu and CentOS.

Change-Id: I2ec43db5af6f90b87b4def1a7654e4c8ad0bd253
...@@ -17,9 +17,7 @@ export STAGE=$(dirname $KARAF_ROOT) ...@@ -17,9 +17,7 @@ export STAGE=$(dirname $KARAF_ROOT)
17 # Validates the specified IP regular expression against existing adapters. 17 # Validates the specified IP regular expression against existing adapters.
18 # Excludes local-loopback. 18 # Excludes local-loopback.
19 function validateIp { 19 function validateIp {
20 - [ $(uname) = "Darwin" ] && \ 20 + ifconfig | awk '{ print $2}' | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | grep -v "127\.0\.0\.1" | grep $1
21 - ifconfig | grep 'inet ' | cut -d\ -f2 | grep -v "127\.0\.0\.1" | grep $1 || \
22 - ifconfig | grep 'inet addr:' | cut -d: -f2 | cut -d\ -f1 | grep -v "127\.0\.0\.1" | grep $1
23 } 21 }
24 22
25 # Clean the previous Karaf directory if requested and if it exists. 23 # Clean the previous Karaf directory if requested and if it exists.
......