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.
This commit is contained in:
Tiago Alves 2024-02-08 13:01:46 +00:00
commit f0e6f2e6d9

View file

@ -89,6 +89,10 @@ detect_os () {
then then
distro="Rocky" distro="Rocky"
fi 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 if [[ $(cat /etc/os-release | grep -e "^ID\=*" | cut -f 2 -d '=') == "debian" ]]; then
distro="Debian" distro="Debian"
fi fi
@ -99,7 +103,7 @@ detect_os () {
# Returns the OS version # Returns the OS version
detect_os_version () { detect_os_version () {
os=$1 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, # Get the major version. /etc/redhat-release is used if /etc/os-release isn't available,
# e.g., on CentOS/RHEL 6. # e.g., on CentOS/RHEL 6.
if [[ -f /etc/os-release ]]; then if [[ -f /etc/os-release ]]; then
@ -124,7 +128,7 @@ detect_os_version () {
detect_installer_type () { detect_installer_type () {
os=$1 os=$1
case $os in 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" echo "rpm"
;; ;;
"Ubuntu" | "Debian") "Ubuntu" | "Debian")
@ -165,7 +169,7 @@ download_name () {
;; ;;
esac esac
case $os in case $os in
"RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky") "RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky" | "Oracle")
echo "R-${version}-1-1.${rpm_arch}.rpm" echo "R-${version}-1-1.${rpm_arch}.rpm"
;; ;;
"Ubuntu" | "Debian") "Ubuntu" | "Debian")
@ -193,7 +197,7 @@ download_url () {
"Fedora") "Fedora")
echo "${CDN_URL}/fedora-${ver}/pkgs/${name}" echo "${CDN_URL}/fedora-${ver}/pkgs/${name}"
;; ;;
"RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky") "RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky" | "Oracle")
if [ "${ver}" -ge 9 ]; then if [ "${ver}" -ge 9 ]; then
echo "${CDN_URL}/rhel-${ver}/pkgs/${name}" echo "${CDN_URL}/rhel-${ver}/pkgs/${name}"
else else
@ -314,7 +318,7 @@ install_rpm () {
yes="-y" yes="-y"
fi fi
case $os in case $os in
"RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky") "RedHat" | "Fedora" | "CentOS" | "Amazon" | "Alma" | "Rocky" | "Oracle")
if ! has_sudo "yum"; then if ! has_sudo "yum"; then
echo "Must have sudo privileges to run yum" echo "Must have sudo privileges to run yum"
exit 1 exit 1
@ -345,7 +349,7 @@ install_pre () {
case $os in case $os in
"Fedora") "Fedora")
;; ;;
"RedHat" | "CentOS" | "Alma" | "Rocky") "RedHat" | "CentOS" | "Alma" | "Rocky" | "Oracle")
install_epel "${os}" "${ver}" install_epel "${os}" "${ver}"
;; ;;
"Amazon") "Amazon")
@ -389,6 +393,8 @@ install_epel () {
if [[ "${os}" == "RedHat" ]]; then if [[ "${os}" == "RedHat" ]]; then
${SUDO} subscription-manager repos --enable "codeready-builder-for-rhel-9-$(arch)-rpms" ${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 ${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 else
${SUDO} dnf install ${yes} dnf-plugins-core ${SUDO} dnf install ${yes} dnf-plugins-core
${SUDO} dnf config-manager --set-enabled crb ${SUDO} dnf config-manager --set-enabled crb