1
0
mirror of synced 2024-11-22 04:56:03 +03:00

Update OS detection

This commit is contained in:
hwdsl2 2021-07-27 00:59:15 -05:00
parent f18c3c0207
commit 2e17ef68ce
3 changed files with 19 additions and 21 deletions

View File

@ -36,21 +36,19 @@ check_run_as_root() {
}
check_os_type() {
os_type=centos
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
rh_file="/etc/redhat-release"
if grep -qs -e "release 7" -e "release 8" "$rh_file"; then
os_type=centos
if grep -qs "Red Hat" "$rh_file"; then
os_type=rhel
fi
if grep -qs "release 7" "$rh_file"; then
os_ver=7
elif grep -qs "release 8" "$rh_file"; then
os_ver=8
if grep -qi stream "$rh_file"; then
os_ver=8s
fi
fi
if grep -qs "Red Hat" "$rh_file"; then
os_type=rhel
fi
if grep -qs "release 7" "$rh_file"; then
os_ver=7
elif grep -qs "release 8" "$rh_file"; then
os_ver=8
grep -qi stream "$rh_file" && os_ver=8s
grep -qi rocky "$rh_file" && os_type=rocky
grep -qi alma "$rh_file" && os_type=alma
elif grep -qs "Amazon Linux release 2" /etc/system-release; then
os_type=amzn
os_ver=2
@ -85,7 +83,7 @@ check_os_type() {
get_update_url() {
update_url=vpnupgrade
if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ]; then
if [ "$os_type" = "centos" ] || [ "$os_type" = "rhel" ] || [ "$os_type" = "rocky" ] || [ "$os_type" = "alma" ]; then
update_url=vpnupgrade-centos
elif [ "$os_type" = "amzn" ]; then
update_url=vpnupgrade-amzn

View File

@ -36,9 +36,9 @@ if grep -qs "release 7" "$rh_file"; then
os_ver=7
elif grep -qs "release 8" "$rh_file"; then
os_ver=8
if grep -qi stream "$rh_file"; then
os_ver=8s
fi
grep -qi stream "$rh_file" && os_ver=8s
grep -qi rocky "$rh_file" && os_type=rocky
grep -qi alma "$rh_file" && os_type=alma
else
echo "Error: This script only supports CentOS/RHEL 7 and 8." >&2
echo "For Ubuntu/Debian, use https://git.io/vpnupgrade" >&2

View File

@ -59,9 +59,9 @@ if grep -qs "release 7" "$rh_file"; then
os_ver=7
elif grep -qs "release 8" "$rh_file"; then
os_ver=8
if grep -qi stream "$rh_file"; then
os_ver=8s
fi
grep -qi stream "$rh_file" && os_ver=8s
grep -qi rocky "$rh_file" && os_type=rocky
grep -qi alma "$rh_file" && os_type=alma
else
echo "Error: This script only supports CentOS/RHEL 7 and 8." >&2
echo "For Ubuntu/Debian, use https://git.io/vpnsetup" >&2
@ -150,7 +150,7 @@ bigecho "Adding the EPEL repository..."
epel_url="https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm"
(
set -x
yum -y -q install epel-release >/dev/null || yum -y -q install "$epel_url" >/dev/null
yum -y -q install epel-release >/dev/null 2>&1 || yum -y -q install "$epel_url" >/dev/null
) || exiterr2
bigecho "Installing packages required for the VPN..."