Add option to set EPEL mirror

In some environments it may be desirable to set the EPEL
mirror to use. Add this ability.

Change-Id: Iefa22bde7a64b40e6d36ba39efa9102de9393e06
This commit is contained in:
Derek Higgins 2015-09-21 17:11:50 +01:00
parent 7db3196e68
commit 6b82210f9d
2 changed files with 15 additions and 0 deletions

View File

@ -3,3 +3,11 @@ epel
====
This element installs the Extra Packages for Enterprise Linux (EPEL)
repository GPG key as well as configuration for yum.
DIB_EPEL_MIRROR:
:Required: No
:Default: None
:Description: To use a EPEL Yum mirror, set this variable to the mirror URL
before running bin/disk-image-create. This URL should point to
the directory containing the ``5/6/7`` directories.
:Example: ``DIB\_EPEL\_MIRROR=http://dl.fedoraproject.org/pub/epel``

View File

@ -29,3 +29,10 @@ case "$DISTRO_NAME" in
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
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