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
This commit is contained in:
Ian Wienand 2019-09-25 04:05:18 +00:00
parent ddb2811255
commit b57714af75
4 changed files with 10 additions and 6 deletions

View File

@ -8,7 +8,7 @@ set -o pipefail
if [[ ${DISTRO_NAME} =~ "centos" ]]; then
# Centos has "epel-release" in extras, which is default enabled.
yum install -y epel-release
${YUM} install -y epel-release
else
# For RHEL, we have to scrape the download page to find the latest
# release and install that
@ -34,7 +34,11 @@ else
fi
if [ ${DIB_EPEL_DISABLED:-0} -ne 0 ]; then
yum-config-manager --disable epel
if [[ ${YUM} == "dnf" ]]; then
dnf config-manager --set-disabled epel
else
yum-config-manager --disable epel
fi
fi
DIB_EPEL_MIRROR=${DIB_EPEL_MIRROR:-}

View File

@ -28,7 +28,7 @@ else
exit 1
fi
if [[ $DISTRO_NAME == "fedora" ]]; then
if [[ ${YUM} == "dnf" ]]; then
mkdir -p /etc/dnf/vars
echo $basearch > /etc/dnf/vars/basearch
echo $arch > /etc/dnf/vars/arch
@ -43,5 +43,5 @@ if [[ ${DISTRO_NAME} =~ "centos" ]]; then
else
contentdir=altarch
fi
echo $contentdir > /etc/yum/vars/contentdir
echo $contentdir > /etc/${YUM}/vars/contentdir
fi

View File

@ -6,7 +6,7 @@ fi
set -eu
set -o pipefail
if [[ $DISTRO_NAME == "fedora" && $DIB_RELEASE -ge 22 ]]; then
if [[ ${YUM} == "dnf" ]]; then
cfg=/etc/dnf/dnf.conf
cachedir=/var/cache/dnf
else

View File

@ -6,7 +6,7 @@ fi
set -eu
set -o pipefail
if [[ $DISTRO_NAME == "fedora" && $DIB_RELEASE -ge 22 ]]; then
if [[ ${YUM} == "dnf" ]]; then
# dnf is slightly different; doesn't have these by default
cfg=/etc/dnf/dnf.conf
echo "keepcache=1" >> $cfg