diskimage-builder/diskimage_builder/elements/rpm-distro/pre-install.d/01-override-yum-arch
Ian Wienand b57714af75 Use $YUM instead of direct calls in more places
A few places we either assume centos uses "yum" directly, or have
switching based on the distro type.

In both cases, we can use ${YUM} directly to avoid ambiguity

Change-Id: I71095a9bd1862f8956b5982fbbb3e1d213926c14
2019-10-03 00:22:18 +00:00

48 lines
1007 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
if [ "i386" = "$ARCH" ]; then
basearch=i386
arch=i686
elif [[ "amd64 x86_64" =~ "$ARCH" ]]; then
basearch=x86_64
arch=x86_64
elif [[ "$ARCH" = "ppc64" ]]; then
basearch=ppc64
arch=ppc64
elif [[ "$ARCH" = "ppc64le" ]]; then
basearch=ppc64le
arch=ppc64le
elif [[ "arm64 aarch64" =~ "$ARCH" ]]; then
basearch=aarch64
arch=aarch64
else
echo "********************"
echo "Unknown arch '$ARCH'"
echo "********************"
exit 1
fi
if [[ ${YUM} == "dnf" ]]; then
mkdir -p /etc/dnf/vars
echo $basearch > /etc/dnf/vars/basearch
echo $arch > /etc/dnf/vars/arch
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