Fix regex for mirror URL substitution

The base URL of EPEL repository installed by the epel-release package in
CentOS 8 at least now defaults to https.

The error seen when building an CentOS 8 image was:
"Error: Cannot find a valid baseurl for repo: epel"

This patch fixes it so that it will always match regardless of being
http or https.

Change-Id: I9ec5536ee72047c929a1ef6950ff4e9092842a4c
This commit is contained in:
Carlos Goncalves 2019-12-03 18:58:41 +01:00
parent a231bc6b9f
commit 670df3326d
3 changed files with 3 additions and 3 deletions

View File

@ -12,4 +12,4 @@ DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-}
# Only set the mirror for the Base, Extras and Updates repositories # Only set the mirror for the Base, Extras and Updates repositories
# The others arn't enabled and do not exist on all mirrors # The others arn't enabled and do not exist on all mirrors
sed -e "s|^#baseurl=http://mirror.centos.org/centos|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo sed -e "s|^#baseurl=http[s]*://mirror.centos.org/centos|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo

View File

@ -45,5 +45,5 @@ DIB_EPEL_MIRROR=${DIB_EPEL_MIRROR:-}
[ -n "$DIB_EPEL_MIRROR" ] || exit 0 [ -n "$DIB_EPEL_MIRROR" ] || exit 0
# Set the EPEL mirror to use # Set the EPEL mirror to use
sed -e "s|^#baseurl=http://download.fedoraproject.org/pub/epel|baseurl=$DIB_EPEL_MIRROR|;/^mirrorlist=/d;/^metalink=/d" -i /etc/yum.repos.d/epel.repo sed -e "s|^#baseurl=http[s]*://download.fedoraproject.org/pub/epel|baseurl=$DIB_EPEL_MIRROR|;/^mirrorlist=/d;/^metalink=/d" -i /etc/yum.repos.d/epel.repo

View File

@ -19,5 +19,5 @@ if [[ ${DIB_RELEASE} -gt 27 ]]; then
fi fi
for FILE in /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates-testing.repo; do for FILE in /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates-testing.repo; do
sudo sed -e "s|^#baseurl=http://download.fedoraproject.org/pub/fedora/linux|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^metalink/d" -i $FILE sudo sed -e "s|^#baseurl=http[s]*://download.fedoraproject.org/pub/fedora/linux|baseurl=$DIB_DISTRIBUTION_MIRROR|;/^metalink/d" -i $FILE
done done