From bea8597b029019fd208f7c1bb810787aca48df65 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Fri, 3 May 2024 22:18:08 -0500 Subject: [PATCH] Add new option - Add an option for specifying a Libreswan version to install, using variable VPN_SWAN_VER. Currently supported values are 4.15 and 5.0. This could be useful for users who want to install the older Libreswan version 4. --- vpnsetup.sh | 2 +- vpnsetup_alpine.sh | 12 ++++++++++++ vpnsetup_amzn.sh | 12 ++++++++++++ vpnsetup_centos.sh | 12 ++++++++++++ vpnsetup_ubuntu.sh | 12 ++++++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/vpnsetup.sh b/vpnsetup.sh index f3ab5f5..814b092 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -280,7 +280,7 @@ run_setup() { VPN_DNS_NAME="$VPN_DNS_NAME" VPN_CLIENT_NAME="$VPN_CLIENT_NAME" \ VPN_PROTECT_CONFIG="$VPN_PROTECT_CONFIG" \ VPN_CLIENT_VALIDITY="$VPN_CLIENT_VALIDITY" \ - VPN_SKIP_IKEV2="$VPN_SKIP_IKEV2" \ + VPN_SKIP_IKEV2="$VPN_SKIP_IKEV2" VPN_SWAN_VER="$VPN_SWAN_VER" \ /bin/bash "$tmpdir/vpn.sh" || status=1 else status=1 diff --git a/vpnsetup_alpine.sh b/vpnsetup_alpine.sh index 9c52393..2185fbc 100755 --- a/vpnsetup_alpine.sh +++ b/vpnsetup_alpine.sh @@ -248,6 +248,18 @@ get_swan_ver() { if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9]{1,2})(\.([0-9]|[1-9][0-9]{1,2})){1,2}$'; then SWAN_VER="$swan_ver_latest" fi + if [ -n "$VPN_SWAN_VER" ]; then + if ! printf '%s\n%s' "4.15" "$VPN_SWAN_VER" | sort -C -V \ + || ! printf '%s\n%s' "$VPN_SWAN_VER" "$SWAN_VER" | sort -C -V; then +cat 1>&2 <&2 <&2 <&2 <