From 581ffa023b64d129f13ea3c88abed2627c05c0b4 Mon Sep 17 00:00:00 2001 From: Jeffrey Zhang Date: Thu, 9 Jul 2020 16:14:44 +0800 Subject: [PATCH] Support non-x86_64 DIB_DISTRIBUTION_MIRROR variable for CentOS 7 Other architectures are stored under "altarch" for CentOS 7, update the match. Convert the delimiters to "," to avoid a subtle problem with "|" -- POSIX states Within the BRE and the replacement, the BRE delimiter itself can be used as a literal character if it is preceded by a backslash. So "s|\(foo\|bar\)|moo|" doesn't do what you might think; the inner pipe becomes a literal | and this will *not* match "foo" or "bar". Change-Id: Ic1642325e3a59a10453c356d8d839ce649812af8 --- .../centos/pre-install.d/01-set-centos-mirror | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/diskimage_builder/elements/centos/pre-install.d/01-set-centos-mirror b/diskimage_builder/elements/centos/pre-install.d/01-set-centos-mirror index 9abb9613..93cf814c 100755 --- a/diskimage_builder/elements/centos/pre-install.d/01-set-centos-mirror +++ b/diskimage_builder/elements/centos/pre-install.d/01-set-centos-mirror @@ -13,11 +13,11 @@ DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-} # Only set the mirror for the Base, Extras and Updates repositories # The others aren't enabled and do not exist on all mirrors if [[ ${DIB_RELEASE} == '7' ]]; then - sed -e "s|^#baseurl=http[s]*://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\|altarch\)/,baseurl=$DIB_DISTRIBUTION_MIRROR/,;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo elif [[ ${DIB_RELEASE} == '8' ]]; then - sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo - sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-AppStream.repo - sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-centosplus.repo - sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Extras.repo - sed -e "s|^#baseurl=http[s]*://mirror.centos.org/\$contentdir/|baseurl=$DIB_DISTRIBUTION_MIRROR/|;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-PowerTools.repo + sed -e "s,^#baseurl=http[s]*://mirror.centos.org/\$contentdir/,baseurl=$DIB_DISTRIBUTION_MIRROR/,;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Base.repo + sed -e "s,^#baseurl=http[s]*://mirror.centos.org/\$contentdir/,baseurl=$DIB_DISTRIBUTION_MIRROR/,;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-AppStream.repo + sed -e "s,^#baseurl=http[s]*://mirror.centos.org/\$contentdir/,baseurl=$DIB_DISTRIBUTION_MIRROR/,;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-centosplus.repo + sed -e "s,^#baseurl=http[s]*://mirror.centos.org/\$contentdir/,baseurl=$DIB_DISTRIBUTION_MIRROR/,;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-Extras.repo + sed -e "s,^#baseurl=http[s]*://mirror.centos.org/\$contentdir/,baseurl=$DIB_DISTRIBUTION_MIRROR/,;/^mirrorlist=/d" -i /etc/yum.repos.d/CentOS-PowerTools.repo fi