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
This commit is contained in:
Ian Wienand 2015-10-09 15:43:19 +11:00
parent c40aa76d83
commit 283c9705c0

View File

@ -8,9 +8,11 @@ set -o pipefail
if [[ $DISTRO_NAME == "fedora" && $DIB_RELEASE -ge 22 ]]; then if [[ $DISTRO_NAME == "fedora" && $DIB_RELEASE -ge 22 ]]; then
cfg=/etc/dnf/dnf.conf cfg=/etc/dnf/dnf.conf
cachedir=/var/cache/dnf
else else
cfg=/etc/yum.conf cfg=/etc/yum.conf
cachedir=/var/cache/yum
fi fi
sed -i 's/keepcache=1/keepcache=0/' $cfg sed -i "/^keepcache/c\keepcache=0" $cfg
sed -i 's/cachedir=\/tmp\/yum/cachedir=\/var\/cache\/yum/' $cfg sed -i "/^cachedir/c\cachedir=${cachedir}" $cfg