From 25964c5c5b514d7e667f106c181c37bda785aca9 Mon Sep 17 00:00:00 2001 From: Tristan Cacqueray Date: Mon, 14 May 2018 03:30:52 +0000 Subject: [PATCH] rpm-distro: set the contentdir yum var Since CentOS-7.5, a new yum variable is needed for SIG repositories. This change replicates the %post task of the centos-release package to setup the contentdir yum var. This should fix issues when repository url uses $contentdir and yum fail with: http://mirror.centos.org/%24contentdir ... [Errno 14] HTTP Error 404 - Not Found For more details see: https://lists.centos.org/pipermail/centos-devel/2018-March/016542.html This change also drops support for fedora without dnf. Change-Id: I1819a48b94670577b0c5e29b24cebfb20ea07d28 --- .../rpm-distro/pre-install.d/01-override-yum-arch | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch b/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch index 505d3f2b..3b20ff63 100755 --- a/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch +++ b/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch @@ -28,7 +28,7 @@ else exit 1 fi -if [[ $DISTRO_NAME == "fedora" && $DIB_RELEASE -ge 22 ]]; then +if [[ $DISTRO_NAME == "fedora" ]]; then mkdir -p /etc/dnf/vars echo $basearch > /etc/dnf/vars/basearch echo $arch > /etc/dnf/vars/arch @@ -36,3 +36,12 @@ else echo $basearch > /etc/yum/vars/basearch echo $arch > /etc/yum/vars/arch fi + +if [[ ${DISTRO_NAME} =~ "centos" ]]; then + if [[ ${arch} == "x86_64" ]]; then + contentdir=centos + else + contentdir=altarch + fi + echo $contentdir > /etc/yum/vars/contentdir +fi