From 670df3326d9989ccf6a5ef5a2431709ca577ad49 Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Tue, 3 Dec 2019 18:58:41 +0100 Subject: [PATCH] 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 --- .../elements/centos7/pre-install.d/01-set-centos-mirror | 2 +- .../elements/epel/pre-install.d/05-rpm-epel-release | 2 +- .../elements/fedora/pre-install.d/01-set-fedora-mirror | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/diskimage_builder/elements/centos7/pre-install.d/01-set-centos-mirror b/diskimage_builder/elements/centos7/pre-install.d/01-set-centos-mirror index 8e2007a9..8dd9b2d9 100755 --- a/diskimage_builder/elements/centos7/pre-install.d/01-set-centos-mirror +++ b/diskimage_builder/elements/centos7/pre-install.d/01-set-centos-mirror @@ -12,4 +12,4 @@ DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-} # Only set the mirror for the Base, Extras and Updates repositories # 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 diff --git a/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release b/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release index a4eef6fc..5ea9a6bb 100755 --- a/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release +++ b/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release @@ -45,5 +45,5 @@ 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;/^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 diff --git a/diskimage_builder/elements/fedora/pre-install.d/01-set-fedora-mirror b/diskimage_builder/elements/fedora/pre-install.d/01-set-fedora-mirror index c008e2e8..4c35d08e 100755 --- a/diskimage_builder/elements/fedora/pre-install.d/01-set-fedora-mirror +++ b/diskimage_builder/elements/fedora/pre-install.d/01-set-fedora-mirror @@ -19,5 +19,5 @@ if [[ ${DIB_RELEASE} -gt 27 ]]; then 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 - 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