From 6b82210f9dcc50d51524aefe49ef9e398eaa2129 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Mon, 21 Sep 2015 17:11:50 +0100 Subject: [PATCH] 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 --- elements/epel/README.rst | 8 ++++++++ elements/epel/pre-install.d/05-rpm-epel-release | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/elements/epel/README.rst b/elements/epel/README.rst index 8caaab3c..50464d48 100644 --- a/elements/epel/README.rst +++ b/elements/epel/README.rst @@ -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`` diff --git a/elements/epel/pre-install.d/05-rpm-epel-release b/elements/epel/pre-install.d/05-rpm-epel-release index d82fef8c..33b66ac0 100755 --- a/elements/epel/pre-install.d/05-rpm-epel-release +++ b/elements/epel/pre-install.d/05-rpm-epel-release @@ -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