From 6d89279940037b550ad6dfd6a476e0152bb8ed03 Mon Sep 17 00:00:00 2001 From: Nyr Date: Fri, 20 Dec 2013 18:50:30 +0100 Subject: [PATCH] Bugfix for systems with multiple IPv4 addresses available --- openvpn-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index b696b76..1afee19 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -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