<NME> 05-rpm-epel-release
<BEF> #!/bin/bash

if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail

if [[ (${DISTRO_NAME} =~ "centos" || ${DISTRO_NAME} =~ "rocky") ]]; then
    # Centos has "epel-release" in extras, which is default enabled.
    ${YUM} install -y epel-release
else
    # For RHEL, we have to scrape the download page to find the latest
    # release and install that
    [ -n "$ARCH" ]
    if [ 'amd64' = "$ARCH" ] ; then
        ARCH="x86_64"
    fi

    BASE_URL=${DIB_EPEL_MIRROR:-https://dl.fedoraproject.org/pub/epel}
    case "$DISTRO_NAME" in
        rhel7)
            RELEASE=7
            URL=$BASE_URL/$RELEASE/x86_64/Packages/e/
            ;;
        *)
            echo "$DISTRO_NAME is not supported"
            # Not really a failure; we just don't do anything
            exit 0
            ;;
    esac
    PKG_NAME=$(wget -q $URL -O - |grep -oE "(href=\"epel-release-$RELEASE-[0-9,.].*)" | cut -d'"' -f2)
    rpm -q epel-release || yum install -y $URL/$PKG_NAME
fi

if [ ${DIB_EPEL_DISABLED:-0} -ne 0 ]; then
    if [[ ${YUM} == "dnf" ]]; then
        dnf config-manager --set-disabled epel
    else
        yum-config-manager --disable epel
    fi
fi

    fi
fi

DIB_EPEL_MIRROR=${DIB_EPEL_MIRROR:-}
[ -n "$DIB_EPEL_MIRROR" ] || exit 0

# Set the EPEL mirror to use
sed -e "s|^#baseurl=http[s]*://.*/pub/epel|baseurl=$DIB_EPEL_MIRROR|;/^mirrorlist=/d;/^metalink=/d" -i /etc/yum.repos.d/epel.repo


<MSG> Disable all enabled epel repos in CentOS8

EPEL centos8 have different epel repos like
epel, epel-modular, epel-playground etc, so
we need to disable all not just epel.

Also ensure other epel repositories in CentOS7
like epel-testing are also disabled.

Related-Bug: #1885315
Change-Id: I02b3b83fa2047702d5f069d3ca1c9c0bcc1dab52

<DFF> @@ -35,9 +35,9 @@ fi
 
 if [ ${DIB_EPEL_DISABLED:-0} -ne 0 ]; then
     if [[ ${YUM} == "dnf" ]]; then
-        dnf config-manager --set-disabled epel
+        dnf config-manager --set-disabled "epel*"
     else
-        yum-config-manager --disable epel
+        yum-config-manager --disable "epel*"
     fi
 fi
 

{'addition_count': 2, 'commit_subject': 'Disable all enabled epel repos in CentOS8', 'deletion_count': 2, 'file_extension': '', 'lang': 'd/05-rpm-epel-release', 'license': 'apache-2.0', 'repo_name': 'openstack/diskimage-builder'}