Work around yum/dnf differences

Some minor workarounds for Fedora >= 22 where dnf is the default
package manager. The changes are documented on the Fedora release
notes https://fedoraproject.org/wiki/Changes/ReplaceYumWithDNF

Change-Id: I7d7d6f5d294980dcb217d6190a1efd9e0bbea9a6
This commit is contained in:
Ian Wienand 2015-05-27 14:53:04 +10:00
parent f112b6f690
commit b183e024ba
3 changed files with 27 additions and 6 deletions

View File

@ -25,5 +25,11 @@ else
exit 1
fi
echo $basearch > /etc/yum/vars/basearch
echo $arch > /etc/yum/vars/arch
if [ $DIB_RELEASE -ge 22 ]; then
mkdir -p /etc/dnf/vars
echo $basearch > /etc/dnf/vars/basearch
echo $arch > /etc/dnf/vars/basearch
else
echo $basearch > /etc/yum/vars/basearch
echo $arch > /etc/yum/vars/arch
fi

View File

@ -6,5 +6,11 @@ fi
set -eu
set -o pipefail
sed -i 's/keepcache=1/keepcache=0/' /etc/yum.conf
sed -i 's/cachedir=\/tmp\/yum/cachedir=\/var\/cache\/yum/' /etc/yum.conf
if [ $DIB_RELEASE -ge 22 ]; then
cfg=/etc/dnf/dnf.conf
else
cfg=/etc/yum.conf
fi
sed -i 's/keepcache=1/keepcache=0/' $cfg
sed -i 's/cachedir=\/tmp\/yum/cachedir=\/var\/cache\/yum/' $cfg

View File

@ -6,5 +6,14 @@ fi
set -eu
set -o pipefail
sed -i 's/keepcache=0/keepcache=1/' /etc/yum.conf
sed -i 's/cachedir=\/var\/cache\/yum/cachedir=\/tmp\/yum/' /etc/yum.conf
if [ $DIB_RELEASE -ge 22 ]; then
# dnf is slightly different; doesn't have these by default
cfg=/etc/dnf/dnf.conf
echo "keepcache=1" >> $cfg
echo "cachedir=/tmp/yum" >> $cfg
else
cfg=/etc/yum.conf
sed -i 's/keepcache=0/keepcache=1/' $cfg
sed -i 's/cachedir=\/var\/cache\/yum/cachedir=\/tmp\/yum/' $cfg
fi