From 0a78c167f346ca02fb3340cb318657c683e56cee Mon Sep 17 00:00:00 2001 From: "charles.a" Date: Mon, 27 Sep 2021 19:16:36 -0300 Subject: [PATCH] Add support for RedHat 8.x --- openvpn-install.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/openvpn-install.sh b/openvpn-install.sh index b39e795..89af1a9 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,13 @@ 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" + 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."