Slim down the pre-built DIB IPA images
* Move remove-extra-packages to post-install since finalise.d is running on the final image and the DIB documentation recommends avoiding unnecessary actions there. * Remove a few packages that used to be removed only for Fedora; do not try to remove those that aren't on the cloud image. * Do all uninstallations in pre-install phase, so that it doesn't try to remove dependencies of already installed packages. * Exclude more locale files from the image. * Exclude the content of /var/log. Change-Id: Idb7819b1d783f4f5f390cc7621019d3be2fa576f
This commit is contained in:
parent
cecbc860dd
commit
f45996c192
@ -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
|
||||
|
@ -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
|
@ -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
|
@ -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
|
||||
|
@ -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
|
||||
|
19
dib/ironic-python-agent-ramdisk/post-install.d/99-remove-extra-packages
Executable file
19
dib/ironic-python-agent-ramdisk/post-install.d/99-remove-extra-packages
Executable 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
|
Loading…
Reference in New Issue
Block a user