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
This commit is contained in:
Tristan Cacqueray 2018-05-14 03:30:52 +00:00
parent d2b03eefe8
commit 25964c5c5b
1 changed files with 10 additions and 1 deletions

View File

@ -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