From f0e6f2e6d9cfd4c9cca1a3bc1d9a9eb340b3de84 Mon Sep 17 00:00:00 2001 From: Tiago Alves Date: Thu, 8 Feb 2024 13:01:46 +0000 Subject: [PATCH] Adds Oracle Linux support Adds Oracle Linux support in which version 9 requires different logic to enable CodeReady Builder repository which provides openblas-devel required to install R. Changes validated in both Oracle Linux 8 and 9 versions. --- install.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 3fe8440..cb6eec7 100755 --- a/install.sh +++ b/install.sh @@ -89,6 +89,10 @@ detect_os () { then distro="Rocky" fi + if [[ $(cat /etc/os-release | grep -e "^CPE_NAME\=*" | cut -f 2 -d '=') =~ cpe:/o:oracle:linux: ]] + then + distro="Oracle" + fi if [[ $(cat /etc/os-release | grep -e "^ID\=*" | cut -f 2 -d '=') == "debian" ]]; then distro="Debian" fi @@ -99,7 +103,7 @@ detect_os () { # Returns the OS version detect_os_version () { os=$1 - if [[ "${os}" =~ ^(RedHat|Alma|Rocky|Fedora)$ ]]; then + if [[ "${os}" =~ ^(RedHat|Alma|Rocky|Fedora|Oracle)$ ]]; then # Get the major version. /etc/redhat-release is used if /etc/os-release isn't available, # e.g., on CentOS/RHEL 6. if [[ -f /etc/os-release ]]; then @@ -124,7 +128,7 @@ detect_os_version () { detect_installer_type () { os=$1 case $os in - "RedHat" | "Fedora" | "CentOS" | "LEAP12" | "LEAP15" | "SLES12" | "SLES15" | "Amazon" | "Alma" | "Rocky") + "RedHat" | "Fedora" | "CentOS" | "LEAP12" | "LEAP15" | "SLES12" | "SLES15" | "Amazon" | "Alma" | "Rocky" | "Oracle") echo "rpm" ;; "Ubuntu" | "Debian") @@ -165,7 +169,7 @@ download_name () { ;; esac case $os in - "RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky") + "RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky" | "Oracle") echo "R-${version}-1-1.${rpm_arch}.rpm" ;; "Ubuntu" | "Debian") @@ -193,7 +197,7 @@ download_url () { "Fedora") echo "${CDN_URL}/fedora-${ver}/pkgs/${name}" ;; - "RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky") + "RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky" | "Oracle") if [ "${ver}" -ge 9 ]; then echo "${CDN_URL}/rhel-${ver}/pkgs/${name}" else @@ -314,7 +318,7 @@ install_rpm () { yes="-y" fi case $os in - "RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky") + "RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky" | "Oracle") if ! has_sudo "yum"; then echo "Must have sudo privileges to run yum" exit 1 @@ -345,7 +349,7 @@ install_pre () { case $os in "Fedora") ;; - "RedHat" | "CentOS" | "Alma" | "Rocky") + "RedHat" | "CentOS" | "Alma" | "Rocky" | "Oracle") install_epel "${os}" "${ver}" ;; "Amazon") @@ -389,6 +393,8 @@ install_epel () { if [[ "${os}" == "RedHat" ]]; then ${SUDO} subscription-manager repos --enable "codeready-builder-for-rhel-9-$(arch)-rpms" ${SUDO} dnf install ${yes} https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + elif [[ "${os}" == "Oracle" ]]; then + ${SUDO} dnf config-manager --set-enabled ol9_codeready_builder else ${SUDO} dnf install ${yes} dnf-plugins-core ${SUDO} dnf config-manager --set-enabled crb