Bugfix for systems with multiple IPv4 addresses available

This commit is contained in:
Nyr 2013-12-20 18:50:30 +01:00
parent ee9750a210
commit 6d89279940
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ fi
# Try to get our IP from the system and fallback to the Internet.
# I do this to make the script compatible with NATed servers (lowendspirit.com)
# and to avoid getting an IPv6.
IP=$(ifconfig | grep 'inet addr:' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d: -f2 | awk '{ print $1}')
IP=$(ifconfig | grep 'inet addr:' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d: -f2 | awk '{ print $1}' | head -1)
if [ "$IP" = "" ]; then
IP=$(wget -qO- ipv4.icanhazip.com)
fi