Improve OS detection
This commit is contained in:
parent
28b02f28db
commit
d90c6121b6
@ -37,15 +37,19 @@ check_run_as_root() {
|
||||
|
||||
check_os_type() {
|
||||
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
|
||||
if grep -qs -e "release 7" -e "release 8" /etc/redhat-release; then
|
||||
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" /etc/redhat-release; then
|
||||
if grep -qs "Red Hat" "$rh_file"; then
|
||||
os_type=rhel
|
||||
fi
|
||||
if grep -qs "release 7" /etc/redhat-release; then
|
||||
if grep -qs "release 7" "$rh_file"; then
|
||||
os_ver=7
|
||||
elif grep -qs "release 8" /etc/redhat-release; then
|
||||
elif grep -qs "release 8" "$rh_file"; then
|
||||
os_ver=8
|
||||
if grep -qi stream "$rh_file"; then
|
||||
os_ver=8s
|
||||
fi
|
||||
fi
|
||||
elif grep -qs "Amazon Linux release 2" /etc/system-release; then
|
||||
os_type=amzn
|
||||
|
@ -28,14 +28,17 @@ vpnupgrade() {
|
||||
|
||||
os_type=centos
|
||||
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
|
||||
if grep -qs "Red Hat" /etc/redhat-release; then
|
||||
rh_file="/etc/redhat-release"
|
||||
if grep -qs "Red Hat" "$rh_file"; then
|
||||
os_type=rhel
|
||||
fi
|
||||
|
||||
if grep -qs "release 7" /etc/redhat-release; then
|
||||
if grep -qs "release 7" "$rh_file"; then
|
||||
os_ver=7
|
||||
elif grep -qs "release 8" /etc/redhat-release; then
|
||||
elif grep -qs "release 8" "$rh_file"; then
|
||||
os_ver=8
|
||||
if grep -qi stream "$rh_file"; then
|
||||
os_ver=8s
|
||||
fi
|
||||
else
|
||||
echo "Error: This script only supports CentOS/RHEL 7 and 8." >&2
|
||||
echo "For Ubuntu/Debian, use https://git.io/vpnupgrade" >&2
|
||||
|
@ -51,14 +51,17 @@ vpnsetup() {
|
||||
|
||||
os_type=centos
|
||||
os_arch=$(uname -m | tr -dc 'A-Za-z0-9_-')
|
||||
if grep -qs "Red Hat" /etc/redhat-release; then
|
||||
rh_file="/etc/redhat-release"
|
||||
if grep -qs "Red Hat" "$rh_file"; then
|
||||
os_type=rhel
|
||||
fi
|
||||
|
||||
if grep -qs "release 7" /etc/redhat-release; then
|
||||
if grep -qs "release 7" "$rh_file"; then
|
||||
os_ver=7
|
||||
elif grep -qs "release 8" /etc/redhat-release; then
|
||||
elif grep -qs "release 8" "$rh_file"; then
|
||||
os_ver=8
|
||||
if grep -qi stream "$rh_file"; then
|
||||
os_ver=8s
|
||||
fi
|
||||
else
|
||||
echo "Error: This script only supports CentOS/RHEL 7 and 8." >&2
|
||||
echo "For Ubuntu/Debian, use https://git.io/vpnsetup" >&2
|
||||
|
Loading…
x
Reference in New Issue
Block a user