Allow opt-out of full ramdisk pruning
While aggressively pruning ramdisk contents reduces the size, it can break packages that depend on any of the pruned directories existing. Allow anyone impacted by that case to opt out. Change-Id: I1b5a65a56d151a26ee44446c20c6df31bb695223
This commit is contained in:
parent
8ba630fb22
commit
5c8fc6fd31
@ -3,3 +3,12 @@ ironic-ramdisk-base
|
||||
|
||||
This is a base element for ironic ramdisks. It does not install anything, just
|
||||
takes the prepared images and extract kernel/ramdisk from it.
|
||||
|
||||
Configurable Environment Variables
|
||||
----------------------------------
|
||||
- `DIB_IPA_COMPRESS_COMMAND` defaults to `gzip`, may be set to any valid
|
||||
compression program usable for an initramfs
|
||||
- `DIB_IPA_MINIMAL_PRUNE` defaults to `0` (false). If set to `1`, will skip
|
||||
most ramdisk size optimizations. This may be helpful for use of packages
|
||||
with IPA that require otherwise-pruned directories or files.
|
||||
|
||||
|
@ -24,11 +24,29 @@ echo "#disabled" > ./tmp/fstab.new
|
||||
sudo mv ./tmp/fstab.new ./etc/fstab
|
||||
sudo ln -s ./sbin/init ./
|
||||
|
||||
# Note: The pci.ids, which is used by lshw, locate on Ubuntu
|
||||
# in /usr/share/misc. Therefore we are removing only the
|
||||
# ./usr/share/misc/m* (will remove the magic and magic.mgc files).
|
||||
# on RHEL pci.ids is locate on /usr/share/hwdata/pci.ids.
|
||||
sudo find . -xdev \
|
||||
# Note(JayF): to anyone trying to make this more configurable in the future,
|
||||
# there are significant hurdles around shell quoting if you try to put these
|
||||
# find commands into variables for making them more configurable.
|
||||
if [ "${DIB_IPA_MINIMAL_PRUNE:-0}" -gt 0 ]; then
|
||||
# Operator opted out of full ramdisk pruning; do not proactively remove
|
||||
# directories that may be in use by other elements/packages
|
||||
sudo find . -xdev \
|
||||
-path './sys/*' -prune -o \
|
||||
-path './tmp/*' -prune -o \
|
||||
-path './boot/*' -prune -o \
|
||||
-path './root/.cache' -prune -o \
|
||||
-name '*.pyc' -prune -o \
|
||||
-name '*.pyo' -prune -o \
|
||||
-print | sudo cpio -o -H newc | ${DIB_IPA_COMPRESS_CMD} > ${IMAGE_PATH}.initramfs
|
||||
else
|
||||
# This performs a full prune, leading to the smallest possible ramdisk
|
||||
# size. This may break operator-configured packages or elements that
|
||||
# depend on pruned paths.
|
||||
# Note: The pci.ids, which is used by lshw, are located on Ubuntu
|
||||
# in /usr/share/misc. Therefore we are removing only the
|
||||
# ./usr/share/misc/m* (will remove the magic and magic.mgc files).
|
||||
# on RHEL pci.ids is locate on /usr/share/hwdata/pci.ids.
|
||||
sudo find . -xdev \
|
||||
-path './sys/*' -prune -o \
|
||||
-path './tmp/*' -prune -o \
|
||||
-path './boot/*' -prune -o \
|
||||
@ -49,6 +67,7 @@ sudo find . -xdev \
|
||||
-name '*.pyc' -prune -o \
|
||||
-name '*.pyo' -prune -o \
|
||||
-print | sudo cpio -o -H newc | ${DIB_IPA_COMPRESS_CMD} > ${IMAGE_PATH}.initramfs
|
||||
fi
|
||||
|
||||
select_boot_kernel_initrd $TARGET_ROOT
|
||||
sudo cp $BOOTDIR/$KERNEL ${IMAGE_PATH}.kernel
|
||||
|
Loading…
Reference in New Issue
Block a user