c247cb41bb
When "epel" element is used during a build process with "rhel7" distribution, the build failed because the "epel-release-7*" package cannot be installed. The reason is because the URL is not correct, it should be: URL=$BASE_URL/$RELEASE/x86_64/Packages/e/ Change-Id: I90c26892361f7611645b85f2eddc949b2f0d76fc Closes-Bug: #1735547
43 lines
1.2 KiB
Bash
Executable file
43 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
set -x
|
|
fi
|
|
set -eu
|
|
set -o pipefail
|
|
|
|
if [[ ${DISTRO_NAME} =~ "centos" ]]; then
|
|
# Centos has "epel-release" in extras, which is default enabled.
|
|
yum install -y epel-release
|
|
else
|
|
# For RHEL, we have to scrape the download page to find the latest
|
|
# release and install that
|
|
[ -n "$ARCH" ]
|
|
if [ 'amd64' = "$ARCH" ] ; then
|
|
ARCH="x86_64"
|
|
fi
|
|
|
|
BASE_URL=${DIB_EPEL_MIRROR:-https://dl.fedoraproject.org/pub/epel}
|
|
case "$DISTRO_NAME" in
|
|
rhel7)
|
|
RELEASE=7
|
|
URL=$BASE_URL/$RELEASE/x86_64/Packages/e/
|
|
;;
|
|
*)
|
|
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
|
|
fi
|
|
|
|
if [ ${DIB_EPEL_DISABLED:-0} -ne 0 ]; then
|
|
yum-config-manager --disable epel
|
|
fi
|
|
|
|
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
|