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
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