ironic-python-agent-builder/dib/ironic-python-agent-ramdisk/post-install.d/99-remove-extra-packages
Julia Kreger a1c3a1668a Strip some excess from the centos dib image
Strips postfix gcc make from Centos based builds in
an attempt to reduce the overall sie of the ramdisk as C development
utilties are not needed on a ramdisk and better to not have present
on a machine as it complicates attacks to take over and launch to
additional hosts.

Postfix is also present in the ramdisk and is not needed as the
ramdisk has no use for a mail transport agent.

Also removes the GeoIP data files which are not needed by the ramdisk.

Change-Id: I7627e8a3d4924a672af37a468870ba92604e2e66
2020-07-21 19:58:51 +00:00

21 lines
461 B
Bash
Executable File

#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
rm -rf /tmp/ironic-python-agent
# TODO(dtantsur): implement the same for debian-based systems
case "$DISTRO_NAME" in
fedora|centos|centos7|rhel|rhel7)
${YUM:-yum} remove -y postfix gcc make
${YUM:-yum} clean all
# Rebuilding the rpm database after removing packages will reduce
# its size
rpm --rebuilddb
;;
esac