From 1227a0ed5d1a89ab480b34135bb69443a1704df6 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Tue, 4 Sep 2018 23:11:59 -0500 Subject: [PATCH] Improve xl2tpd workaround - Exclude Ubuntu from xl2tpd 1.3.12 workaround (Ref: 3f8e79b), because updated xl2tpd packages are now available for Ubuntu 16.04 and 18.04 See: https://bugs.launchpad.net/ubuntu/+source/xl2tpd/+bug/1760796 - Add Linux kernel 4.16 to the list of kernels to work around - Cleanup --- vpnsetup.sh | 28 +++++++++++++++------------- vpnsetup_centos.sh | 16 ++++++++-------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/vpnsetup.sh b/vpnsetup.sh index 45b9f2c..ca46b59 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -173,20 +173,22 @@ apt-get -yq install libnss3-dev libnspr4-dev pkg-config \ libevent-dev ppp xl2tpd || exiterr2 case "$(uname -r)" in - 4.14*|4.15*) - L2TP_VER=1.3.12 - l2tp_file="xl2tpd-$L2TP_VER.tar.gz" - l2tp_url1="https://github.com/xelerance/xl2tpd/archive/v$L2TP_VER.tar.gz" - l2tp_url2="https://mirrors.kernel.org/ubuntu/pool/universe/x/xl2tpd/xl2tpd_$L2TP_VER.orig.tar.gz" - apt-get -yq install libpcap0.8-dev || exiterr2 - if ! { wget -t 3 -T 30 -nv -O "$l2tp_file" "$l2tp_url1" || wget -t 3 -T 30 -nv -O "$l2tp_file" "$l2tp_url2"; }; then - exit 1 + 4.1[456]*) + if ! printf '%s' "$os_type" | head -n 1 | grep -qiF ubuntu; then + L2TP_VER=1.3.12 + l2tp_dir="xl2tpd-$L2TP_VER" + l2tp_file="$l2tp_dir.tar.gz" + l2tp_url="https://github.com/xelerance/xl2tpd/archive/v$L2TP_VER.tar.gz" + apt-get -yq install libpcap0.8-dev || exiterr2 + if ! wget -t 3 -T 30 -nv -O "$l2tp_file" "$l2tp_url"; then + exit 1 + fi + /bin/rm -rf "/opt/src/$l2tp_dir" + tar xzf "$l2tp_file" && /bin/rm -f "$l2tp_file" + cd "$l2tp_dir" && make -s 2>/dev/null && PREFIX=/usr make -s install + cd /opt/src || exit 1 + /bin/rm -rf "/opt/src/$l2tp_dir" fi - /bin/rm -rf "/opt/src/xl2tpd-$L2TP_VER" - tar xzf "$l2tp_file" && /bin/rm -f "$l2tp_file" - cd "xl2tpd-$L2TP_VER" && make -s 2>/dev/null && PREFIX=/usr make -s install - cd /opt/src || exit 1 - /bin/rm -rf "/opt/src/xl2tpd-$L2TP_VER" ;; esac diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index 25385e6..e7b143a 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -163,21 +163,21 @@ else fi case "$(uname -r)" in - 4.14*|4.15*) + 4.1[456]*) if grep -qs "release 6" /etc/redhat-release; then L2TP_VER=1.3.12 - l2tp_file="xl2tpd-$L2TP_VER.tar.gz" - l2tp_url1="https://github.com/xelerance/xl2tpd/archive/v$L2TP_VER.tar.gz" - l2tp_url2="https://mirrors.kernel.org/ubuntu/pool/universe/x/xl2tpd/xl2tpd_$L2TP_VER.orig.tar.gz" + l2tp_dir="xl2tpd-$L2TP_VER" + l2tp_file="$l2tp_dir.tar.gz" + l2tp_url="https://github.com/xelerance/xl2tpd/archive/v$L2TP_VER.tar.gz" yum "$REPO2" "$REPO3" -y install libpcap-devel || exiterr2 - if ! { wget -t 3 -T 30 -nv -O "$l2tp_file" "$l2tp_url1" || wget -t 3 -T 30 -nv -O "$l2tp_file" "$l2tp_url2"; }; then + if ! wget -t 3 -T 30 -nv -O "$l2tp_file" "$l2tp_url"; then exit 1 fi - /bin/rm -rf "/opt/src/xl2tpd-$L2TP_VER" + /bin/rm -rf "/opt/src/$l2tp_dir" tar xzf "$l2tp_file" && /bin/rm -f "$l2tp_file" - cd "xl2tpd-$L2TP_VER" && make -s 2>/dev/null && PREFIX=/usr make -s install + cd "$l2tp_dir" && make -s 2>/dev/null && PREFIX=/usr make -s install cd /opt/src || exit 1 - /bin/rm -rf "/opt/src/xl2tpd-$L2TP_VER" + /bin/rm -rf "/opt/src/$l2tp_dir" fi ;; esac