From 9a625dba296d488f89c2213627931b8685efd354 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Sun, 28 Jul 2024 17:52:03 -0500 Subject: [PATCH] Update OS support - Remove CentOS 7 and CentOS 8 Stream, which have reached EOL. - Add Alpine Linux 3.20 and remove 3.18. --- extras/ikev2setup.sh | 13 +++++++------ extras/vpnupgrade.sh | 11 ++++++----- extras/vpnupgrade_alpine.sh | 4 ++-- extras/vpnupgrade_centos.sh | 7 ++++--- vpnsetup.sh | 11 ++++++----- vpnsetup_alpine.sh | 4 ++-- vpnsetup_centos.sh | 7 ++++--- 7 files changed, 31 insertions(+), 26 deletions(-) diff --git a/extras/ikev2setup.sh b/extras/ikev2setup.sh index 8ba7d5d..9ae8a38 100755 --- a/extras/ikev2setup.sh +++ b/extras/ikev2setup.sh @@ -60,15 +60,16 @@ check_os() { elif grep -q "release 8" "$rh_file"; then os_ver=8 grep -qi stream "$rh_file" && os_ver=8s - if [ "$os_type$os_ver" = "centos8" ]; then - exiterr "CentOS Linux 8 is EOL and not supported." - fi elif grep -q "release 9" "$rh_file"; then os_ver=9 grep -qi stream "$rh_file" && os_ver=9s else exiterr "This script only supports CentOS/RHEL 7-9." fi + if [ "$os_type" = "centos" ] \ + && { [ "$os_ver" = 7 ] || [ "$os_ver" = 8 ] || [ "$os_ver" = 8s ]; }; then + exiterr "CentOS Linux $os_ver is EOL and not supported." + fi elif grep -qs "Amazon Linux release 2 " /etc/system-release; then os_type=amzn os_ver=2 @@ -99,8 +100,8 @@ EOF esac if [ "$os_type" = "alpine" ]; then os_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID" | cut -d '.' -f 1,2) - if [ "$os_ver" != "3.18" ] && [ "$os_ver" != "3.19" ]; then - exiterr "This script only supports Alpine Linux 3.18/3.19." + if [ "$os_ver" != "3.19" ] && [ "$os_ver" != "3.20" ]; then + exiterr "This script only supports Alpine Linux 3.19/3.20." fi else os_ver=$(sed 's/\..*//' /etc/debian_version | tr -dc 'A-Za-z0-9') @@ -168,7 +169,7 @@ confirm_or_abort() { show_header() { cat <<'EOF' -IKEv2 Script Copyright (c) 2020-2024 Lin Song 14 Apr 2024 +IKEv2 Script Copyright (c) 2020-2024 Lin Song 28 Jul 2024 EOF } diff --git a/extras/vpnupgrade.sh b/extras/vpnupgrade.sh index f3e614f..179dfa0 100755 --- a/extras/vpnupgrade.sh +++ b/extras/vpnupgrade.sh @@ -51,15 +51,16 @@ check_os() { elif grep -q "release 8" "$rh_file"; then os_ver=8 grep -qi stream "$rh_file" && os_ver=8s - if [ "$os_type$os_ver" = "centos8" ]; then - exiterr "CentOS Linux 8 is EOL and not supported." - fi elif grep -q "release 9" "$rh_file"; then os_ver=9 grep -qi stream "$rh_file" && os_ver=9s else exiterr "This script only supports CentOS/RHEL 7-9." fi + if [ "$os_type" = "centos" ] \ + && { [ "$os_ver" = 7 ] || [ "$os_ver" = 8 ] || [ "$os_ver" = 8s ]; }; then + exiterr "CentOS Linux $os_ver is EOL and not supported." + fi elif grep -qs "Amazon Linux release 2 " /etc/system-release; then os_type=amzn os_ver=2 @@ -90,8 +91,8 @@ EOF esac if [ "$os_type" = "alpine" ]; then os_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID" | cut -d '.' -f 1,2) - if [ "$os_ver" != "3.18" ] && [ "$os_ver" != "3.19" ]; then - exiterr "This script only supports Alpine Linux 3.18/3.19." + if [ "$os_ver" != "3.19" ] && [ "$os_ver" != "3.20" ]; then + exiterr "This script only supports Alpine Linux 3.19/3.20." fi else os_ver=$(sed 's/\..*//' /etc/debian_version | tr -dc 'A-Za-z0-9') diff --git a/extras/vpnupgrade_alpine.sh b/extras/vpnupgrade_alpine.sh index 2588a69..ded221a 100755 --- a/extras/vpnupgrade_alpine.sh +++ b/extras/vpnupgrade_alpine.sh @@ -51,8 +51,8 @@ check_os() { ;; esac os_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID" | cut -d '.' -f 1,2) - if [ "$os_ver" != "3.18" ] && [ "$os_ver" != "3.19" ]; then - exiterr "This script only supports Alpine Linux 3.18/3.19." + if [ "$os_ver" != "3.19" ] && [ "$os_ver" != "3.20" ]; then + exiterr "This script only supports Alpine Linux 3.19/3.20." fi } diff --git a/extras/vpnupgrade_centos.sh b/extras/vpnupgrade_centos.sh index 2377f40..e724d65 100755 --- a/extras/vpnupgrade_centos.sh +++ b/extras/vpnupgrade_centos.sh @@ -54,15 +54,16 @@ check_os() { elif grep -q "release 8" "$rh_file"; then os_ver=8 grep -qi stream "$rh_file" && os_ver=8s - if [ "$os_type$os_ver" = "centos8" ]; then - exiterr "CentOS Linux 8 is EOL and not supported." - fi elif grep -q "release 9" "$rh_file"; then os_ver=9 grep -qi stream "$rh_file" && os_ver=9s else exiterr "This script only supports CentOS/RHEL 7-9." fi + if [ "$os_type" = "centos" ] \ + && { [ "$os_ver" = 7 ] || [ "$os_ver" = 8 ] || [ "$os_ver" = 8s ]; }; then + exiterr "CentOS Linux $os_ver is EOL and not supported." + fi else cat 1>&2 <<'EOF' Error: This script only supports one of the following OS: diff --git a/vpnsetup.sh b/vpnsetup.sh index 814b092..7dba9ca 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -81,15 +81,16 @@ check_os() { elif grep -q "release 8" "$rh_file"; then os_ver=8 grep -qi stream "$rh_file" && os_ver=8s - if [ "$os_type$os_ver" = "centos8" ]; then - exiterr "CentOS Linux 8 is EOL and not supported." - fi elif grep -q "release 9" "$rh_file"; then os_ver=9 grep -qi stream "$rh_file" && os_ver=9s else exiterr "This script only supports CentOS/RHEL 7-9." fi + if [ "$os_type" = "centos" ] \ + && { [ "$os_ver" = 7 ] || [ "$os_ver" = 8 ] || [ "$os_ver" = 8s ]; }; then + exiterr "CentOS Linux $os_ver is EOL and not supported." + fi elif grep -qs "Amazon Linux release 2 " /etc/system-release; then os_type=amzn os_ver=2 @@ -122,8 +123,8 @@ EOF esac if [ "$os_type" = "alpine" ]; then os_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID" | cut -d '.' -f 1,2) - if [ "$os_ver" != "3.18" ] && [ "$os_ver" != "3.19" ]; then - exiterr "This script only supports Alpine Linux 3.18/3.19." + if [ "$os_ver" != "3.19" ] && [ "$os_ver" != "3.20" ]; then + exiterr "This script only supports Alpine Linux 3.19/3.20." fi else os_ver=$(sed 's/\..*//' /etc/debian_version | tr -dc 'A-Za-z0-9') diff --git a/vpnsetup_alpine.sh b/vpnsetup_alpine.sh index 2185fbc..c7a8d4d 100755 --- a/vpnsetup_alpine.sh +++ b/vpnsetup_alpine.sh @@ -70,8 +70,8 @@ check_os() { ;; esac os_ver=$(. /etc/os-release && printf '%s' "$VERSION_ID" | cut -d '.' -f 1,2) - if [ "$os_ver" != "3.18" ] && [ "$os_ver" != "3.19" ]; then - exiterr "This script only supports Alpine Linux 3.18/3.19." + if [ "$os_ver" != "3.19" ] && [ "$os_ver" != "3.20" ]; then + exiterr "This script only supports Alpine Linux 3.19/3.20." fi } diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index 87a81c7..810dae7 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -86,15 +86,16 @@ check_os() { elif grep -q "release 8" "$rh_file"; then os_ver=8 grep -qi stream "$rh_file" && os_ver=8s - if [ "$os_type$os_ver" = "centos8" ]; then - exiterr "CentOS Linux 8 is EOL and not supported." - fi elif grep -q "release 9" "$rh_file"; then os_ver=9 grep -qi stream "$rh_file" && os_ver=9s else exiterr "This script only supports CentOS/RHEL 7-9." fi + if [ "$os_type" = "centos" ] \ + && { [ "$os_ver" = 7 ] || [ "$os_ver" = 8 ] || [ "$os_ver" = 8s ]; }; then + exiterr "CentOS Linux $os_ver is EOL and not supported." + fi else cat 1>&2 <<'EOF' Error: This script only supports one of the following OS: