Merge "Fix up EPEL element"

This commit is contained in:
Jenkins 2016-05-13 01:04:23 +00:00 committed by Gerrit Code Review
commit 5657852b22

View File

@ -6,19 +6,24 @@ fi
set -eu set -eu
set -o pipefail 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" ] [ -n "$ARCH" ]
if [ 'amd64' = "$ARCH" ] ; then if [ 'amd64' = "$ARCH" ] ; then
ARCH="x86_64" ARCH="x86_64"
fi fi
BASE_URL=${DIB_EPEL_MIRROR:-https://dl.fedoraproject.org/pub/epel} BASE_URL=${DIB_EPEL_MIRROR:-https://dl.fedoraproject.org/pub/epel}
case "$DISTRO_NAME" in case "$DISTRO_NAME" in
rhel7|centos7) rhel7)
RELEASE=7 RELEASE=7
URL=$BASE_URL/$RELEASE/x86_64/e/ URL=$BASE_URL/$RELEASE/x86_64/e/
;; ;;
rhel|centos) rhel)
RELEASE=6 RELEASE=6
URL=$BASE_URL/$RELEASE/$ARCH/ URL=$BASE_URL/$RELEASE/$ARCH/
;; ;;
@ -29,7 +34,7 @@ case "$DISTRO_NAME" in
esac esac
PKG_NAME=$(wget -q $URL -O - |grep -oE "(href=\"epel-release-$RELEASE-[0-9,.].*)" | cut -d'"' -f2) 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 rpm -q epel-release || yum install -y $URL/$PKG_NAME
fi
DIB_EPEL_MIRROR=${DIB_EPEL_MIRROR:-} DIB_EPEL_MIRROR=${DIB_EPEL_MIRROR:-}
[ -n "$DIB_EPEL_MIRROR" ] || exit 0 [ -n "$DIB_EPEL_MIRROR" ] || exit 0