diff --git a/openvpn-install.sh b/openvpn-install.sh index 0b52d7c..849528f 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -26,6 +26,7 @@ fi 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}') if [ "$IP" = "" ]; then IP=$(wget -qO- ipv4.icanhazip.com) + EXTERNALIP=$IP fi @@ -179,7 +180,7 @@ else mkdir ~/ovpn-$CLIENT # Try to detect a NATed connection and ask about it to potential LowEndSpirit # users - EXTERNALIP=$(wget -qO- ipv4.icanhazip.com) + if [ -z "$EXTERNALIP" ]; then EXTERNALIP=$(wget -qO- ipv4.icanhazip.com); fi if [ "$IP" != "$EXTERNALIP" ]; then echo "" echo "Looks like your server is behind a NAT!" @@ -209,4 +210,4 @@ else echo "" echo "Your client config is available at ~/ovpn-$CLIENT.tar.gz" echo "If you want to add more clients, you simply need to run this script another time!" -fi \ No newline at end of file +fi