diskimage-builder/elements/epel/pre-install.d/05-rpm-epel-release
Pino Toscano 9fcb919dc7 epel: support centos element
Allow the epel element to enable EPEL also on CentOS 6.x.

Change-Id: I0e0ea0d2ea764d8ce4398635ae9124602b933791
2015-05-06 15:49:59 +02:00

32 lines
646 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
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|centos)
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