From 1dbf8975001caa10203f1894ce8c0c1c1ea741db Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Tue, 9 Aug 2022 19:34:32 -0500 Subject: [PATCH] Cleanup - Fix OS checking: Don't show errors for /etc/redhat-release. - Fixes #1211. --- extras/ikev2changeaddr.sh | 4 ++-- extras/ikev2setup.sh | 6 +++--- extras/quickstart.sh | 4 ++-- extras/vpnuninstall.sh | 4 ++-- extras/vpnupgrade.sh | 4 ++-- extras/vpnupgrade_centos.sh | 4 ++-- vpnsetup.sh | 4 ++-- vpnsetup_centos.sh | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/extras/ikev2changeaddr.sh b/extras/ikev2changeaddr.sh index 9cd36f6..f90d428 100755 --- a/extras/ikev2changeaddr.sh +++ b/extras/ikev2changeaddr.sh @@ -44,8 +44,8 @@ check_os() { [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file" || grep -qs "release 8" "$rh_file" \ || grep -qs "release 9" "$rh_file"; then - grep -qi rocky "$rh_file" && os_type=rocky - grep -qi alma "$rh_file" && os_type=alma + grep -qs -i rocky "$rh_file" && os_type=rocky + grep -qs -i alma "$rh_file" && os_type=alma elif grep -qs "Amazon Linux release 2" /etc/system-release; then os_type=amzn else diff --git a/extras/ikev2setup.sh b/extras/ikev2setup.sh index 05f3c6c..ee17ba1 100755 --- a/extras/ikev2setup.sh +++ b/extras/ikev2setup.sh @@ -53,8 +53,8 @@ check_os() { os_type=rhel fi [ -f /etc/oracle-release ] && os_type=ol - grep -qi rocky "$rh_file" && os_type=rocky - grep -qi alma "$rh_file" && os_type=alma + grep -qs -i rocky "$rh_file" && os_type=rocky + grep -qs -i alma "$rh_file" && os_type=alma if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then @@ -154,7 +154,7 @@ confirm_or_abort() { show_header() { cat <<'EOF' -IKEv2 Script Copyright (c) 2020-2022 Lin Song 31 Jul 2022 +IKEv2 Script Copyright (c) 2020-2022 Lin Song 9 Aug 2022 EOF } diff --git a/extras/quickstart.sh b/extras/quickstart.sh index 90b1a60..4957f85 100755 --- a/extras/quickstart.sh +++ b/extras/quickstart.sh @@ -75,8 +75,8 @@ check_os() { os_type=rhel fi [ -f /etc/oracle-release ] && os_type=ol - grep -qi rocky "$rh_file" && os_type=rocky - grep -qi alma "$rh_file" && os_type=alma + grep -qs -i rocky "$rh_file" && os_type=rocky + grep -qs -i alma "$rh_file" && os_type=alma if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then diff --git a/extras/vpnuninstall.sh b/extras/vpnuninstall.sh index 2af1cc2..e09bc20 100755 --- a/extras/vpnuninstall.sh +++ b/extras/vpnuninstall.sh @@ -42,8 +42,8 @@ check_os() { [ -f /etc/oracle-release ] && os_type=ol if grep -qs "release 7" "$rh_file" || grep -qs "release 8" "$rh_file" \ || grep -qs "release 9" "$rh_file"; then - grep -qi rocky "$rh_file" && os_type=rocky - grep -qi alma "$rh_file" && os_type=alma + grep -qs -i rocky "$rh_file" && os_type=rocky + grep -qs -i alma "$rh_file" && os_type=alma elif grep -qs "Amazon Linux release 2" /etc/system-release; then os_type=amzn else diff --git a/extras/vpnupgrade.sh b/extras/vpnupgrade.sh index 9d646f1..4ffca6d 100755 --- a/extras/vpnupgrade.sh +++ b/extras/vpnupgrade.sh @@ -43,8 +43,8 @@ check_os() { os_type=rhel fi [ -f /etc/oracle-release ] && os_type=ol - grep -qi rocky "$rh_file" && os_type=rocky - grep -qi alma "$rh_file" && os_type=alma + grep -qs -i rocky "$rh_file" && os_type=rocky + grep -qs -i alma "$rh_file" && os_type=alma if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then diff --git a/extras/vpnupgrade_centos.sh b/extras/vpnupgrade_centos.sh index dc0c1c6..2b95a59 100755 --- a/extras/vpnupgrade_centos.sh +++ b/extras/vpnupgrade_centos.sh @@ -46,8 +46,8 @@ check_os() { os_type=rhel fi [ -f /etc/oracle-release ] && os_type=ol - grep -qi rocky "$rh_file" && os_type=rocky - grep -qi alma "$rh_file" && os_type=alma + grep -qs -i rocky "$rh_file" && os_type=rocky + grep -qs -i alma "$rh_file" && os_type=alma if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then diff --git a/vpnsetup.sh b/vpnsetup.sh index 90b1a60..4957f85 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -75,8 +75,8 @@ check_os() { os_type=rhel fi [ -f /etc/oracle-release ] && os_type=ol - grep -qi rocky "$rh_file" && os_type=rocky - grep -qi alma "$rh_file" && os_type=alma + grep -qs -i rocky "$rh_file" && os_type=rocky + grep -qs -i alma "$rh_file" && os_type=alma if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then diff --git a/vpnsetup_centos.sh b/vpnsetup_centos.sh index cbd083a..51c777e 100755 --- a/vpnsetup_centos.sh +++ b/vpnsetup_centos.sh @@ -80,8 +80,8 @@ check_os() { os_type=rhel fi [ -f /etc/oracle-release ] && os_type=ol - grep -qi rocky "$rh_file" && os_type=rocky - grep -qi alma "$rh_file" && os_type=alma + grep -qs -i rocky "$rh_file" && os_type=rocky + grep -qs -i alma "$rh_file" && os_type=alma if grep -qs "release 7" "$rh_file"; then os_ver=7 elif grep -qs "release 8" "$rh_file"; then