diskimage-builder/elements/ironic-agent/finalise.d/99-remove-extra-packages
Ian Wienand cb0e0e903d Use dnf to cleanup old kernels
As described in the comment, there is a dnf equivalent of this command
that doesn't require us installing yum-utils (which drags in yum on
dnf-only systems such as f23)

This is a small consequence to this -- due to us not installing
yum-utils some installs will now be completely yum free.  This causes
a breakage in ironic-agent 99-remove-extra-packages where we remove
the yum package.  There is a long-standing bug/feature where missing
packages in a group of packages do not cause yum/dnf to exit with
failure, but uninstalling a single package will.  Because we have made
the systems yum-free, the uninstall of yum can fail in this corner
case.

It has always been like this, so I'm in favour of the "ain't broke"
approach.  To work-around this, I have just put yum into the existing
list of packages to be cleaned up.  I have added a note to the yum
installer taking note of this behaviour for future reference.

Change-Id: I8bbdc07ccdb89a105b4fc70d5a215077c42fcd03
2016-02-08 14:20:56 +11:00

32 lines
796 B
Bash
Executable File

#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# TODO(lucasagomes): optimize the ramdisk for other OSs
if [ $DISTRO_NAME = 'fedora' ] ; then
_remove_yum=''
if [ $DIB_RELEASE -ge 22 ]; then
# if we are on F22, we can remove yum if there, because it has
# been superseeded by dnf
_remove_yum='yum'
fi
install-packages -e kernel-debug-devel gcc fedora-logos \
python3 rsync sudo pykickstart \
grubby make genisoimage tcpdump \
man-db policycoreutils kbd-misc \
plymouth cronie ${_remove_yum}
${YUM:-yum} clean all
# Rebuilding the rpm database after removing packages will reduce
# its size
rpm --rebuilddb
fi