diskimage-builder/elements/yum/pre-install.d/01-yum-keepcache
Ian Wienand b183e024ba 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
2015-06-24 09:20:45 +10:00

20 lines
427 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
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