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
|
|
|
|
|
2015-02-10 12:50:35 +00:00
|
|
|
[ -n "$ARCH" ]
|
|
|
|
|
|
|
|
if [ 'amd64' = "$ARCH" ] ; then
|
|
|
|
ARCH="x86_64"
|
2014-10-02 10:14:25 +00:00
|
|
|
fi
|
2015-02-10 12:50:35 +00:00
|
|
|
|
2015-12-28 17:44:13 +00:00
|
|
|
BASE_URL=${DIB_EPEL_MIRROR:-https://dl.fedoraproject.org/pub/epel}
|
2015-02-10 12:50:35 +00:00
|
|
|
case "$DISTRO_NAME" in
|
|
|
|
rhel7|centos7)
|
|
|
|
RELEASE=7
|
|
|
|
URL=$BASE_URL/$RELEASE/x86_64/e/
|
|
|
|
;;
|
2015-05-06 13:08:25 +00:00
|
|
|
rhel|centos)
|
2015-02-10 12:50:35 +00:00
|
|
|
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
|
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
|
|
|
|
sed -e "s|^#baseurl=http://download.fedoraproject.org/pub/epel|baseurl=$DIB_EPEL_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/epel.repo
|