From 3edb26fb0e04e30935b917bcf875a69a0e5a121b Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Tue, 8 Dec 2020 13:51:20 +0100 Subject: [PATCH] pkgdep/rhel: Check if given repos can be enabled In recent Centos8 updates name of the "PowerTools" repo was changed to "powertools". Since config-manager will fail if we provide a faulty name of the repo, we need to make sure we tell it to enable what's actually present on the system. Signed-off-by: Michal Berger Change-Id: Iff0c6103d1375fc42f5c967cd713e3e5089f4723 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5478 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk Reviewed-by: Tomasz Zawadzki Reviewed-by: Karol Latecki --- scripts/pkgdep/rhel.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/pkgdep/rhel.sh b/scripts/pkgdep/rhel.sh index 9d5bd331a..df746c6e8 100755 --- a/scripts/pkgdep/rhel.sh +++ b/scripts/pkgdep/rhel.sh @@ -25,6 +25,8 @@ disclaimer() { esac } +is_repo() { yum repolist --all | grep -q "^$1"; } + disclaimer # First, add extra EPEL, ELRepo, Ceph repos to have a chance of covering most of the packages @@ -47,7 +49,10 @@ if [[ $ID == centos || $ID == rhel ]]; then repos+=("https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm") [[ $ID == centos ]] && repos+=("centos-release-ceph-nautilus.noarch") # Add PowerTools needed for install CUnit-devel in Centos8 - [[ $ID == centos ]] && enable+=("PowerTools") + if [[ $ID == centos ]]; then + is_repo "PowerTools" && enable+=("PowerTools") + is_repo "powertools" && enable+=("powertools") + fi fi if ((${#repos[@]} > 0)); then yum install -y "${repos[@]}" yum-utils