Systems 'ifconfig' changed.

This commit is contained in:
Christoph 2017-06-09 23:26:14 +02:00
parent 44d65f34c3
commit 45f35f6b47

View File

@ -31,23 +31,23 @@ _PHP_VERSION=7.1.2
## - Determin IP-Adresses
## -
__ipv4="`ifconfig | grep -e \"^\s*inet Adresse\" | grep -v \"127.0.0.1\" | awk '{print$2}' | cut -d\":\" -f2 | sort`"
if ifconfig | grep -i -q -E "inet [address|Adresse]:" ; then
__ipv4="`ifconfig | grep -e \"^\s*inet Adresse\" | grep -v \"127.0.0.1\" | awk '{print$2}' | cut -d\":\" -f2 | sort`"
__ipv6="`ifconfig | grep -e \"^\s*inet6-Adresse\" | awk '{print$2}' | grep -v -e \"^::1/\" | grep -v -e \"^fe80\" | cut -d\"/\" -f1 | sort`"
else
__ipv4="`ifconfig | grep -e \"^\s*inet \" | grep -v \"127.0.0.1\" | awk '{print$2}' | sort`"
__ipv6="`ifconfig | grep -e \"^\s*inet6 \" | awk '{print$2}' | grep -v \"^::1\" | grep -v -e \"^fe80\" | sort`"
fi
for _ip in $__ipv4 ; do
_ipv4="$_ipv4 $_ip"
done
## - Trim leading whitespaces
## -
shopt -s extglob
_ipv4="${_ipv4##*( )}"
shopt -u extglob
__ipv6="`ifconfig | grep -e \"^\s*inet6-Adresse\" | awk '{print$2}' | grep -v -e \"^::1/\" | grep -v -e \"^fe80\" | cut -d\"/\" -f1 | sort`"
for _ip in $__ipv6 ; do
_ipv6="$_ipv6 $_ip"
done
## - Trim leading whitespaces
## -
shopt -s extglob
_ipv4="${_ipv4##*( )}"
_ipv6="${_ipv6##*( )}"
shopt -u extglob