From 631a6701f18bfb5f2551b37421c67b0a8f7a1a21 Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Fri, 14 Apr 2023 14:20:32 -0700 Subject: [PATCH] Tweak crb script, check os-release for RHEL (#2186721) --- crb | 24 ++++++++++++------------ epel-release.spec | 5 ++++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/crb b/crb index 376b308..07941a2 100755 --- a/crb +++ b/crb @@ -42,19 +42,19 @@ enable_disable_repo(){ crb_repo=$(dnf repolist --all | grep -i -e crb -e powertools -e codeready | grep -v -i -e debug -e source -e eus -e virt | awk '{print $1}') # Determine if we are on RHEL or not, then do the correct steps - if echo "${crb_repo}" | grep -q "codeready" ; then - # Only RHEL has a repo with codeready in it, use subcription-manager - subscription-manager repos ${command} ${crb_repo} + source /etc/os-release + if [[ "${NAME}" =~ "Red Hat" ]] ; then + subscription-manager repos ${command} ${crb_repo} else - # Determine if dnf-command(config-manager) is installed - if ! rpm -q --whatprovides 'dnf-command(config-manager)' > /dev/null 2>&1 ; then - echo "Error: Please run: dnf install 'dnf-command(config-manager)'" >&2 - echo " before trying to enable/disable the CRB repo." >&2 - echo "Aborting"'!' >&2 - exit 1 - fi - # Everything else uses dnf config-manager - dnf config-manager ${command} ${crb_repo} + # Determine if dnf-command(config-manager) is installed + if ! rpm -q --whatprovides 'dnf-command(config-manager)' > /dev/null 2>&1 ; then + echo "Error: Please run: dnf install 'dnf-command(config-manager)'" >&2 + echo " before trying to enable/disable the CRB repo." >&2 + echo "Aborting"'!' >&2 + exit 1 + fi + # Everything else uses dnf config-manager + dnf config-manager ${command} ${crb_repo} fi } diff --git a/epel-release.spec b/epel-release.spec index 27510dd..c97fb84 100644 --- a/epel-release.spec +++ b/epel-release.spec @@ -5,7 +5,7 @@ Name: epel-release Version: 9 -Release: 4%{dist} +Release: 5%{dist} Summary: Extra Packages for Enterprise Linux repository configuration License: GPLv2 @@ -125,6 +125,9 @@ fi %changelog +* Fri Apr 14 2023 Troy Dawson - 9-5 +- Tweak crb script, check os-release for RHEL (#2186721) + * Tue Aug 09 2022 Troy Dawson - 9-4 - Tweak crb script, Recommends dnf-command(config-manager) (#2115602)