Allow to skip kernel cleanup

For some use cases, it can be useful to keep all the kernels
and not just keep the latest one. Add a parameter that allows
it, and continue cleaning up kernels by default.

Change-Id: Ia6e6c1fa18e3724c1eb89226151d81e9e748b793
This commit is contained in:
Yolanda Robla Mota 2016-08-11 13:29:29 +02:00
parent cf2030c2f6
commit c1bac651cb
3 changed files with 13 additions and 0 deletions

View File

@ -22,3 +22,10 @@ DIB_LOCAL_IMAGE
by diskimage-builder. It should be a full disk image, not just a filesystem
image.
:Example: ``DIB_LOCAL_IMAGE=rhel-guest-image-7.1-20150224.0.x86_64.qcow2``
DIB_DISABLE_KERNEL_CLEANUP
:Required: No
:Default: 0
:Description: Specify if kernel needs to be cleaned up or not. When set to
true, the bits that cleanup old kernels will not be executed.
:Example: DIB_DISABLE_KERNEL_CLEANUP=1

View File

@ -0,0 +1 @@
export DIB_DISABLE_KERNEL_CLEANUP=${DIB_DISABLE_KERNEL_CLEANUP:-0}

View File

@ -6,6 +6,11 @@ fi
set -eu
set -o pipefail
if [ $DIB_DISABLE_KERNEL_CLEANUP -ne 0 ]; then
echo "Skipping kernel cleanup as configured"
exit 0
fi
YUM=${YUM:-yum}
if [[ ${YUM} == "dnf" ]]; then