From 588cfb012ca7a4cfce42a5d902f77c17abf242b9 Mon Sep 17 00:00:00 2001 From: "charles.a" Date: Mon, 27 Sep 2021 19:27:43 -0300 Subject: [PATCH] Add redhat8 support --- openvpn-install.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index b39e795..20f593b 100644 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -30,9 +30,13 @@ elif [[ -e /etc/debian_version ]]; then os="debian" os_version=$(grep -oE '[0-9]+' /etc/debian_version | head -1) group_name="nogroup" -elif [[ -e /etc/almalinux-release || -e /etc/rocky-release || -e /etc/centos-release ]]; then +elif [[ -e /etc/almalinux-release || -e /etc/rocky-release || -e /etc/centos-release || -e /etc/redhat-release ]]; then os="centos" - os_version=$(grep -shoE '[0-9]+' /etc/almalinux-release /etc/rocky-release /etc/centos-release | head -1) + os_version=$(grep -shoE '[0-9]+' /etc/almalinux-release /etc/rocky-release /etc/centos-release /etc/redhat-release | head -1) + group_name="nobody" +elif [[ -e /etc/redhat-release ]]; then + os="redhat" + os_version=$(grep -shoE '[0-9]+' /etc/redhat-release | head -1) group_name="nobody" elif [[ -e /etc/fedora-release ]]; then os="fedora" @@ -62,6 +66,12 @@ This version of CentOS is too old and unsupported." exit fi +if [[ "$os" == "RedHat" && "$os_version" -lt 7 ]]; then + echo "RedHat 7 or higher is required to use this installer. +This version of RedHat is too old and unsupported." + exit +fi + # Detect environments where $PATH does not include the sbin directories if ! grep -q sbin <<< "$PATH"; then echo '$PATH does not include sbin. Try using "su -" instead of "su".' @@ -73,6 +83,16 @@ if [[ "$EUID" -ne 0 ]]; then exit fi + +if [[ "`sudo rpm -ql epel-release`" == "package epel-release is not installed" ]]; then + echo "EPEL is not installed, please install EPEL" + echo "For RedHat 8.x: https://linuxconfig.org/redhat-8-epel-install-guide" + echo "For RedHat 7.x: https://www.unixmen.com/install-epel-repository-centos-rhel-7/" + echo "or search by your self :D" + exit +fi + + if [[ ! -e /dev/net/tun ]] || ! ( exec 7<>/dev/net/tun ) 2>/dev/null; then echo "The system does not have the TUN device available. TUN needs to be enabled before running this installer."