8e822768f9
Add DIB_EPEL_DISABLED flag that allows installation of the EPEL repo, but to have it disabled by default. This will help when you have unavoidable EPEL dependencies, but want to make sure you only pull specific things in with "--enablerepo" calls when installing those packages. Change-Id: Iedf6167a7cd69418255ebbee095aea04c50d73fd
48 lines
1.3 KiB
Bash
Executable File
48 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
set -x
|
|
fi
|
|
set -eu
|
|
set -o pipefail
|
|
|
|
if [[ ${DISTRO_NAME} =~ "centos" ]]; 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/e/
|
|
;;
|
|
rhel)
|
|
RELEASE=6
|
|
URL=$BASE_URL/$RELEASE/$ARCH/
|
|
;;
|
|
*)
|
|
echo "$DISTRO_NAME is not supported"
|
|
exit 1
|
|
;;
|
|
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
|
|
yum-config-manager --disable epel
|
|
fi
|
|
|
|
DIB_EPEL_MIRROR=${DIB_EPEL_MIRROR:-}
|
|
[ -n "$DIB_EPEL_MIRROR" ] || exit 0
|
|
|
|
# Set the EPEL mirror to use
|
|
sed -e "s|^#baseurl=http://download.fedoraproject.org/pub/epel|baseurl=$DIB_EPEL_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/epel.repo
|