diskimage-builder/elements/yum/post-install.d/99-reset-yum-conf
Ian Wienand 283c9705c0 Reset yum/dnf cache to correct location
Make sure we reset the yum/dnf cache to /var/cache/${YUM}, not just
/var/cache/yum

This was resulting in the F22 fedora-minimal image being larger than
the base-image.  Because F22 fedora-minimal does some installs with
dnf when bootstrapping the chroot before we set "cachedir=" to the
bind-mounted external cache, we have "/var/cache/dnf" created and and
populated with the package meta-data, etc.

When we globally point dnf to /var/cache/yum here, we effectively
orphan the /var/cache/dnf created in those first steps.  dnf doesn't
care, but we end up with two copies of all the package metadata, etc
in "/var/cache/dnf" & "/var/cache/yum".

This also cleans up the sed a bit, by just replacing the lines.

Change-Id: Icc98fe30c34cb941aed4b987647ab67ac34af15a
2015-10-14 06:36:06 +11:00

19 lines
357 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
if [[ $DISTRO_NAME == "fedora" && $DIB_RELEASE -ge 22 ]]; then
cfg=/etc/dnf/dnf.conf
cachedir=/var/cache/dnf
else
cfg=/etc/yum.conf
cachedir=/var/cache/yum
fi
sed -i "/^keepcache/c\keepcache=0" $cfg
sed -i "/^cachedir/c\cachedir=${cachedir}" $cfg