Fix auto address detection
Fixed auto address detection (There can be a better logic though)
This commit is contained in:
1 parent
b8e66a7078
commit
832d59cab2
1 file changed
+6
-1
+6
-1
@@ -12,7 +12,12 @@ case $(uname) in
|
||||
'Linux')
|
||||
echo "Linux"
|
||||
arIpAddress() {
|
||||
ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1
|
||||
local extip
|
||||
extip=$(ip -o -4 addr list | grep -Ev '\s(docker|lo)' | awk '{print $4}' | cut -d/ -f1 | grep -Ev '(^127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.1[6-9]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.2[0-9]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.3[0-1]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^192\.168\.[0-9]{1,3}\.[0-9]{1,3}$)')
|
||||
if [ "x${extip}" = "x" ]; then
|
||||
extip=$(ip -o -4 addr list | grep -Ev '\s(docker|lo)' | awk '{print $4}' | cut -d/ -f1 )
|
||||
fi
|
||||
echo $extip
|
||||
}
|
||||
;;
|
||||
'FreeBSD')
|
||||
|
||||
Reference in new issue
Block a user