Skip to content

Commit

Permalink
Merge pull request #7296 from gurevichmark/install_rh9
Browse files Browse the repository at this point in the history
Installing xCAT on EL9 show message that EPEL and CRB repos are needed
  • Loading branch information
besawn committed Dec 7, 2022
2 parents d81b6ab + af7264f commit 06bcf24
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion xCAT-server/share/xcat/tools/go-xcat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# go-xcat - Install xCAT automatically.
#
# Version 1.0.51
# Version 1.0.52
#
# Copyright (C) 2016 - 2021 International Business Machines
# Eclipse Public License, Version 1.0 (EPL-1.0)
Expand Down Expand Up @@ -42,6 +42,8 @@
# - Add support for Rocky Linux
# 2022-11-01 Mark Gurevich <gurevich@us.ibm.com>
# - Make sure initscripts installed on RH family of OSes
# 2022-12-06 Mark Gurevich <gurevich@us.ibm.com>
# - Check for EPEL and CRB repository on EL9 family of OSes
#


Expand Down Expand Up @@ -205,6 +207,8 @@ GO_XCAT_UNINSTALL_LIST=("${GO_XCAT_INSTALL_LIST[@]}"

PATH="/usr/sbin:/usr/bin:/sbin:/bin"
export PATH
EL9_EPEL_TEST_RPM="perl-Crypt-CBC"
EL9_CRB_TEST_RPM="perl-IO-Tty"

#
# warn_if_bad Put out warning message(s) if $1 has bad RC.
Expand Down Expand Up @@ -1708,6 +1712,7 @@ function update_repo()
function install_packages_dnf()
{
type dnf >/dev/null 2>&1 || return 255
el9_epel_and_crb_check dnf
local -a yes=()
[[ "$1" = "-y" ]] && yes=("-y") && shift
dnf --nogpgcheck "${yes[@]}" install "$@"
Expand All @@ -1717,6 +1722,7 @@ function install_packages_dnf()
function install_packages_yum()
{
type yum >/dev/null 2>&1 || return 255
el9_epel_and_crb_check yum
local -a yes=()
[[ "$1" = "-y" ]] && yes=("-y") && shift
yum --nogpgcheck "${yes[@]}" install "$@"
Expand All @@ -1732,6 +1738,55 @@ function github_issue_5503_workaround()
return 0
}
# Check for EPEL and CRB repositories when installing on RH family of OSes
function el9_epel_and_crb_check()
{
action="$@" # Passed parameter will only be 'yum' or 'dnf'
if [[ "${GO_XCAT_LINUX_DISTRO}" = "fedora" ]]
then
# For Fedora, version 35 is equivalent to EL9
# But since xCAT currently does not support that version, just
# return and let 'yum install' fail if needed packages are not
# found
return 0
else
[[ "${GO_XCAT_LINUX_VERSION}" =~ ^9(\.[0-9]) ]] || return 0
fi
${action} list available -q ${EL9_EPEL_TEST_RPM}
ret="$?"
case "${ret}" in
"1")
# Can not find EL9_EPEL_TEST_RPM
echo "
Installation on ${GO_XCAT_LINUX_DISTRO} ${GO_XCAT_LINUX_VERSION} requires EPEL repository to be enabled"
echo "Running '${action} install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' will enable EPEL repository"
exit 1
;;
esac
${action} list available -q ${EL9_CRB_TEST_RPM}
ret="$?"
case "${ret}" in
"1")
# Ccan not find EL9_CRB_TEST_RPM
echo "
Installation on ${GO_XCAT_LINUX_DISTRO} ${GO_XCAT_LINUX_VERSION} requires CRB repository to be enabled"
echo "Try adding the following entries to new or existing '.repo' file:"
echo "
[crb]
name=CentOS Stream $releasever - CRB
metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http
gpgcheck=0
repo_gpgcheck=0
metadata_expire=6h
countme=1
enabled=1
"
exit 1
;;
esac
return 0
}
function install_packages_zypper()
{
type zypper >/dev/null 2>&1 || return 255
Expand Down

0 comments on commit 06bcf24

Please sign in to comment.