From 4e9525ddaa852249fb38d88368e5cfd3c02175f0 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 10 Feb 2015 04:50:35 -0800 Subject: [PATCH] update epel version number in epel element epel-release 7.2 has been superseded by 7.5, so update accordingly. this time, detect the available epel-release package from the repo instead of hardcoding version number which will break build each time the version number gets bumped up. Change-Id: I29c73355a85112840b57f93b39a9eeda421875e6 --- .../epel/pre-install.d/05-rpm-epel-release | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/elements/epel/pre-install.d/05-rpm-epel-release b/elements/epel/pre-install.d/05-rpm-epel-release index 0c218a80..7bf30884 100755 --- a/elements/epel/pre-install.d/05-rpm-epel-release +++ b/elements/epel/pre-install.d/05-rpm-epel-release @@ -2,8 +2,26 @@ set -eu set -o pipefail -if [[ "rhel7 centos7" =~ "$DISTRO_NAME" ]]; then - rpm -q epel-release || yum install -y http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm -elif [[ "rhel" =~ "$DISTRO_NAME" ]]; then - rpm -q epel-release || yum install -y http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm +[ -n "$ARCH" ] + +if [ 'amd64' = "$ARCH" ] ; then + ARCH="x86_64" fi + +BASE_URL=http://download.fedoraproject.org/pub/epel +case "$DISTRO_NAME" in + rhel7|centos7) + 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