From cb28b57e09f4640b7ebbfaa7c2959cd3e5146208 Mon Sep 17 00:00:00 2001 From: Nyr Date: Thu, 19 Apr 2018 21:25:18 +0200 Subject: [PATCH] Remove wget dependency in CentOS curl is always included with CentOS and wget is always included with Debian/Ubuntu. So it was useless to install wget in CentOS like we were doing for those cases when it wasn't already installed. Now curl will be used instead. --- openvpn-install.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index 7faedd6..8d048d6 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -219,19 +219,20 @@ else else # Else, the distro is CentOS yum install epel-release -y - yum install openvpn iptables openssl wget ca-certificates -y + yum install openvpn iptables openssl ca-certificates -y fi # An old version of easy-rsa was available by default in some openvpn packages if [[ -d /etc/openvpn/easy-rsa/ ]]; then rm -rf /etc/openvpn/easy-rsa/ fi # Get easy-rsa - wget -O ~/EasyRSA-3.0.4.tgz "https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.4/EasyRSA-3.0.4.tgz" - tar xzf ~/EasyRSA-3.0.4.tgz -C ~/ + EASYRSAURL='https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.4/EasyRSA-3.0.4.tgz' + wget -O ~/easyrsa.tgz "$EASYRSAURL" 2>/dev/null || curl -Lo ~/easyrsa.tgz "$EASYRSAURL" + tar xzf ~/easyrsa.tgz -C ~/ mv ~/EasyRSA-3.0.4/ /etc/openvpn/ mv /etc/openvpn/EasyRSA-3.0.4/ /etc/openvpn/easy-rsa/ chown -R root:root /etc/openvpn/easy-rsa/ - rm -rf ~/EasyRSA-3.0.4.tgz + rm -rf ~/easyrsa.tgz cd /etc/openvpn/easy-rsa/ # Create the PKI, set up the CA, the DH params and the server + client certificates ./easyrsa init-pki @@ -375,7 +376,7 @@ exit 0' > $RCLOCAL fi fi # Try to detect a NATed connection and ask about it to potential LowEndSpirit users - EXTERNALIP=$(wget -4qO- "http://whatismyip.akamai.com/") + EXTERNALIP=$(wget -4qO- "http://whatismyip.akamai.com/" 2>/dev/null || curl -4s "http://whatismyip.akamai.com/") if [[ "$IP" != "$EXTERNALIP" ]]; then echo "" echo "Looks like your server could be behind a NAT!"