diskimage-builder/elements/epel/pre-install.d/05-rpm-epel-release
Jerry Zhao 4e9525ddaa 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
2015-02-20 18:26:22 -08:00

28 lines
583 B
Bash
Executable File

#!/bin/bash
set -eu
set -o pipefail
[ -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