From ce8077f0482154ee8cff9203078ff51eb80dfdbe Mon Sep 17 00:00:00 2001 From: Nyr Date: Tue, 14 May 2013 22:05:53 +0200 Subject: [PATCH] Bugfix: better IPv4 autodetection on some IPv6 enabled servers --- openvpn-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 1065d17..63c9358 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -24,11 +24,11 @@ fi # I do this to make the script compatible with NATed servers (lowendspirit.com) # and to avoid getting an IPv6. # Sorry for doing this, I didn't want to :( -echo "$(grep address /etc/network/interfaces | grep -v 127.0.0.1 | awk '{print $2}')" | grep -q '.' +echo "$(grep address /etc/network/interfaces | grep -v 127.0.0.1 | awk '{print $2}' | grep -q '.' | head -1)" if [ ! $? = 0 ]; then IP=$(wget -qO- ipv4.icanhazip.com) else - IP=$(grep address /etc/network/interfaces | grep -v 127.0.0.1 | awk '{print $2}') + IP=$(grep address /etc/network/interfaces | grep -v 127.0.0.1 | awk '{print $2}' | grep '.' | head -1) fi # We will use this later