Merge "Slim down the pre-built DIB IPA images"

This commit is contained in:
Zuul 2019-10-16 13:08:20 +00:00 committed by Gerrit Code Review
commit c016bfbc48
6 changed files with 69 additions and 35 deletions

View File

@ -33,15 +33,18 @@ sudo find . -xdev \
-path './tmp/*' -prune -o \
-path './boot/*' -prune -o \
-path './root/.cache' -prune -o \
-path "*site-packages/babel/locale-data/*" -prune -o \
-path './usr/include/*' -prune -o \
-path './usr/lib/locale/*' -prune -o \
-path './usr/share/doc/*' -prune -o \
-path './usr/share/man/*' -prune -o \
-path './usr/share/info/*' -prune -o \
-path './usr/share/licenses/*' -prune -o \
-path './usr/share/locale/*' -prune -o \
-path './usr/share/misc/m*' -prune -o \
-path './usr/src/kernels/*' -prune -o \
-path './var/cache/*' -prune -o \
-path './var/log/*' -prune -o \
-name '*.pyc' -prune -o \
-name '*.pyo' -prune -o \
-print | sudo cpio -o -H newc | ${DIB_IPA_COMPRESS_CMD} > ${IMAGE_PATH}.initramfs

View File

@ -0,0 +1,6 @@
# TODO(dtantsur): verify if opensuse can be added here
if [[ $DISTRO_NAME =~ (fedora|centos|centos7|rhel|rhel7) ]]; then
export IPA_DISTRO_FAMILY=rh
else
export IPA_DISTRO_FAMILY=other
fi

View File

@ -1,31 +0,0 @@
#!/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 \
rsync pykickstart \
genisoimage tcpdump \
man-db kbd-misc \
plymouth cronie ${_remove_yum}
${YUM:-yum} clean all
# Rebuilding the rpm database after removing packages will reduce
# its size
rpm --rebuilddb
fi

View File

@ -18,3 +18,44 @@ kmod:
psmisc:
dosfstools:
mdadm:
# Unnecessary packages to remove. We run all removals in pre-install phase, to
# avoid breaking installs that happen in install phase.
cloud-init:
phase: pre-install.d
uninstall: true
git:
phase: pre-install.d
uninstall: true
kbd:
phase: pre-install.d
uninstall: true
man-db:
phase: pre-install.d
uninstall: true
rsync:
phase: pre-install.d
uninstall: true
# Distro-specific uninstalls
cronie:
phase: pre-install.d
uninstall: true
when: IPA_DISTRO_FAMILY = rh
kernel-debug-devel:
phase: pre-install.d
uninstall: true
when: IPA_DISTRO_FAMILY = rh
plymouth:
phase: pre-install.d
uninstall: true
when: IPA_DISTRO_FAMILY = rh
teamd:
phase: pre-install.d
uninstall: true
when: IPA_DISTRO_FAMILY = rh
yum:
phase: pre-install.d
uninstall: true
when: DISTRO_NAME = fedora

View File

@ -8,10 +8,6 @@ set -o pipefail
DIB_IPA_ENABLE_RESCUE=${DIB_IPA_ENABLE_RESCUE:-true}
install-packages -e cloud-init
rm -rf /tmp/ironic-python-agent
if $DIB_IPA_ENABLE_RESCUE; then
# Make sure rescue works
mkdir -p /etc/ipa-rescue-config

View File

@ -0,0 +1,19 @@
#!/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} clean all
# Rebuilding the rpm database after removing packages will reduce
# its size
rpm --rebuilddb
;;
esac