Update OS detection
This commit is contained in:
parent
f18c3c0207
commit
2e17ef68ce
@ -36,10 +36,9 @@ check_run_as_root() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_os_type() {
|
check_os_type() {
|
||||||
|
os_type=centos
|
||||||
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
|
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
|
||||||
rh_file="/etc/redhat-release"
|
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
|
if grep -qs "Red Hat" "$rh_file"; then
|
||||||
os_type=rhel
|
os_type=rhel
|
||||||
fi
|
fi
|
||||||
@ -47,10 +46,9 @@ check_os_type() {
|
|||||||
os_ver=7
|
os_ver=7
|
||||||
elif grep -qs "release 8" "$rh_file"; then
|
elif grep -qs "release 8" "$rh_file"; then
|
||||||
os_ver=8
|
os_ver=8
|
||||||
if grep -qi stream "$rh_file"; then
|
grep -qi stream "$rh_file" && os_ver=8s
|
||||||
os_ver=8s
|
grep -qi rocky "$rh_file" && os_type=rocky
|
||||||
fi
|
grep -qi alma "$rh_file" && os_type=alma
|
||||||
fi
|
|
||||||
elif grep -qs "Amazon Linux release 2" /etc/system-release; then
|
elif grep -qs "Amazon Linux release 2" /etc/system-release; then
|
||||||
os_type=amzn
|
os_type=amzn
|
||||||
os_ver=2
|
os_ver=2
|
||||||
@ -85,7 +83,7 @@ check_os_type() {
|
|||||||
|
|
||||||
get_update_url() {
|
get_update_url() {
|
||||||
update_url=vpnupgrade
|
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
|
update_url=vpnupgrade-centos
|
||||||
elif [ "$os_type" = "amzn" ]; then
|
elif [ "$os_type" = "amzn" ]; then
|
||||||
update_url=vpnupgrade-amzn
|
update_url=vpnupgrade-amzn
|
||||||
|
@ -36,9 +36,9 @@ if grep -qs "release 7" "$rh_file"; then
|
|||||||
os_ver=7
|
os_ver=7
|
||||||
elif grep -qs "release 8" "$rh_file"; then
|
elif grep -qs "release 8" "$rh_file"; then
|
||||||
os_ver=8
|
os_ver=8
|
||||||
if grep -qi stream "$rh_file"; then
|
grep -qi stream "$rh_file" && os_ver=8s
|
||||||
os_ver=8s
|
grep -qi rocky "$rh_file" && os_type=rocky
|
||||||
fi
|
grep -qi alma "$rh_file" && os_type=alma
|
||||||
else
|
else
|
||||||
echo "Error: This script only supports CentOS/RHEL 7 and 8." >&2
|
echo "Error: This script only supports CentOS/RHEL 7 and 8." >&2
|
||||||
echo "For Ubuntu/Debian, use https://git.io/vpnupgrade" >&2
|
echo "For Ubuntu/Debian, use https://git.io/vpnupgrade" >&2
|
||||||
|
@ -59,9 +59,9 @@ if grep -qs "release 7" "$rh_file"; then
|
|||||||
os_ver=7
|
os_ver=7
|
||||||
elif grep -qs "release 8" "$rh_file"; then
|
elif grep -qs "release 8" "$rh_file"; then
|
||||||
os_ver=8
|
os_ver=8
|
||||||
if grep -qi stream "$rh_file"; then
|
grep -qi stream "$rh_file" && os_ver=8s
|
||||||
os_ver=8s
|
grep -qi rocky "$rh_file" && os_type=rocky
|
||||||
fi
|
grep -qi alma "$rh_file" && os_type=alma
|
||||||
else
|
else
|
||||||
echo "Error: This script only supports CentOS/RHEL 7 and 8." >&2
|
echo "Error: This script only supports CentOS/RHEL 7 and 8." >&2
|
||||||
echo "For Ubuntu/Debian, use https://git.io/vpnsetup" >&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"
|
epel_url="https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm"
|
||||||
(
|
(
|
||||||
set -x
|
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
|
) || exiterr2
|
||||||
|
|
||||||
bigecho "Installing packages required for the VPN..."
|
bigecho "Installing packages required for the VPN..."
|
||||||
|
Loading…
Reference in New Issue
Block a user