From 11d384e2fa1f550d424f686600d643b3969a40b3 Mon Sep 17 00:00:00 2001 From: Andrey Shestakov Date: Thu, 5 Jan 2017 14:39:25 +0200 Subject: [PATCH] Add DIB_IPA_COMPRESS_CMD option This option allows to specifiy command for compress built initramfs image for ironic-agent element. This command can be specified with arguments and should read raw data from stdin and write compressed data to stdout. Default if "gzip". Change-Id: I0fdd2ab91d7bf7aaaa6cdd5278e3902d44c5b883 --- elements/ironic-agent/README.rst | 4 ++++ elements/ironic-agent/cleanup.d/99-ramdisk-create | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/elements/ironic-agent/README.rst b/elements/ironic-agent/README.rst index a6382a02..112caa3e 100644 --- a/elements/ironic-agent/README.rst +++ b/elements/ironic-agent/README.rst @@ -18,6 +18,10 @@ Beyond installing the ironic-python-agent, this element does the following: * Install the certificate if any, which is set to the environment variable ``DIB_IPA_CERT`` for validating the authenticity by ironic-python-agent. The certificate can be self-signed certificate or CA certificate. +* Compresses initramfs with command specified in environment variable + ``DIB_IPA_COMPRESS_CMD``, which is 'gzip' by default. This command should listen + for raw data from stdin and write compressed data to stdout. Command can be + with arguments. This element outputs three files: diff --git a/elements/ironic-agent/cleanup.d/99-ramdisk-create b/elements/ironic-agent/cleanup.d/99-ramdisk-create index 5e04a18e..3db28bc7 100755 --- a/elements/ironic-agent/cleanup.d/99-ramdisk-create +++ b/elements/ironic-agent/cleanup.d/99-ramdisk-create @@ -18,6 +18,8 @@ source $_LIB/img-functions IMAGE_PATH=$(readlink -f $IMAGE_NAME) cd $TARGET_ROOT +DIB_IPA_COMPRESS_CMD="${DIB_IPA_COMPRESS_CMD:-gzip}" + echo "#disabled" > ./tmp/fstab.new sudo mv ./tmp/fstab.new ./etc/fstab sudo ln -s ./sbin/init ./ @@ -42,7 +44,7 @@ sudo find . -xdev \ -path './var/cache/*' -prune -o \ -name '*.pyc' -prune -o \ -name '*.pyo' -prune -o \ - -print | sudo cpio -o -H newc | gzip > ${IMAGE_PATH}.initramfs + -print | sudo cpio -o -H newc | ${DIB_IPA_COMPRESS_CMD} > ${IMAGE_PATH}.initramfs select_boot_kernel_initrd $TARGET_ROOT sudo cp $BOOTDIR/$KERNEL ${IMAGE_PATH}.kernel