2014-09-18 01:32:49 +00:00
|
|
|
#!/bin/bash
|
2014-09-04 04:56:29 +00:00
|
|
|
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2014-09-18 01:32:49 +00:00
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
2022-04-07 07:00:44 +00:00
|
|
|
if [[ (${DISTRO_NAME} =~ "centos" || ${DISTRO_NAME} =~ "rocky") ]]; then
|
2016-04-15 02:07:37 +00:00
|
|
|
# Centos has "epel-release" in extras, which is default enabled.
|
2019-09-25 04:05:18 +00:00
|
|
|
${YUM} install -y epel-release
|
2016-04-15 02:07:37 +00:00
|
|
|
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
|
2015-02-10 12:50:35 +00:00
|
|
|
|
2016-04-15 02:07:37 +00:00
|
|
|
BASE_URL=${DIB_EPEL_MIRROR:-https://dl.fedoraproject.org/pub/epel}
|
|
|
|
case "$DISTRO_NAME" in
|
|
|
|
rhel7)
|
|
|
|
RELEASE=7
|
2017-11-30 20:25:30 +00:00
|
|
|
URL=$BASE_URL/$RELEASE/x86_64/Packages/e/
|
2016-04-15 02:07:37 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$DISTRO_NAME is not supported"
|
2018-04-16 03:16:35 +00:00
|
|
|
# Not really a failure; we just don't do anything
|
|
|
|
exit 0
|
2016-04-15 02:07:37 +00:00
|
|
|
;;
|
|
|
|
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
|
2014-10-02 10:14:25 +00:00
|
|
|
fi
|
2015-02-10 12:50:35 +00:00
|
|
|
|
2017-03-02 00:11:55 +00:00
|
|
|
if [ ${DIB_EPEL_DISABLED:-0} -ne 0 ]; then
|
2023-11-22 01:56:09 +00:00
|
|
|
if [[ ${YUM} =~ "dnf" ]]; then
|
2020-10-05 08:27:51 +00:00
|
|
|
rpm -q dnf-plugins-core || dnf install -y dnf-plugins-core
|
2023-11-22 01:56:09 +00:00
|
|
|
${YUM} config-manager --set-disabled "epel*"
|
2019-09-25 04:05:18 +00:00
|
|
|
else
|
2020-10-05 08:27:51 +00:00
|
|
|
# Cannot rely on package-installs, it is executed later
|
|
|
|
rpm -q yum-utils || yum install -y yum-utils
|
2020-06-29 12:48:07 +00:00
|
|
|
yum-config-manager --disable "epel*"
|
2019-09-25 04:05:18 +00:00
|
|
|
fi
|
2017-03-02 00:11:55 +00:00
|
|
|
fi
|
|
|
|
|
2015-09-21 16:11:50 +00:00
|
|
|
DIB_EPEL_MIRROR=${DIB_EPEL_MIRROR:-}
|
|
|
|
[ -n "$DIB_EPEL_MIRROR" ] || exit 0
|
|
|
|
|
|
|
|
# Set the EPEL mirror to use
|
2021-10-14 00:28:34 +00:00
|
|
|
sed -e "s|^#baseurl=http[s]*://.*/pub/epel|baseurl=$DIB_EPEL_MIRROR|;/^mirrorlist=/d;/^metalink=/d" -i /etc/yum.repos.d/epel.repo
|
2018-10-23 08:55:10 +00:00
|
|
|
|