Merge "Add DIB_SKIP_GRUB_PACKAGE_INSTALL for bootloader"

This commit is contained in:
Zuul 2024-09-04 02:11:40 +00:00 committed by Gerrit Code Review
commit 0e72643425
3 changed files with 12 additions and 4 deletions
diskimage_builder/elements/bootloader

@ -34,3 +34,6 @@ Arguments
* ``DIB_NO_TIMER_CHECK`` allows the default kernel argument,
``no_timer_check`` to be removed from the kernel command line
when the value is set to ``False``.
* ``DIB_SKIP_GRUB_PACKAGE_INSTALL`` when set to ``True`` will not install any
grub packages, and will assume all necessary packages are already installed.

@ -9,3 +9,4 @@ else
fi
export DIB_NO_TIMER_CHECK=${DIB_NO_TIMER_CHECK:-"True"}
export DIB_BOOTLOADER_USE_SERIAL_CONSOLE=${DIB_BOOTLOADER_USE_SERIAL_CONSOLE:-"True"}
export DIB_SKIP_GRUB_PACKAGE_INSTALL=${DIB_SKIP_GRUB_PACKAGE_INSTALL:-"False"}

@ -31,14 +31,18 @@ DIB_BLOCK_DEVICE=${DIB_BLOCK_DEVICE:-}
# architecture specific virtual package so we can install the
# rigth thing based on distribution.
if [[ "$ARCH" =~ "ppc" ]]; then
install-packages -m bootloader grub-ppc64
GRUB_PACKAGES="grub-ppc64"
elif [[ "${DIB_BLOCK_DEVICE}" == "mbr" ||
"${DIB_BLOCK_DEVICE}" == "gpt" ]]; then
install-packages -m bootloader grub-pc
GRUB_PACKAGES="grub-pc"
elif [[ "${DIB_BLOCK_DEVICE}" == "efi" ]]; then
install-packages -m bootloader grub-efi grub-efi-$ARCH
GRUB_PACKAGES="grub-efi grub-efi-$ARCH"
else
install-packages -m bootloader grub-pc grub-efi grub-efi-$ARCH
GRUB_PACKAGES="grub-pc grub-efi grub-efi-$ARCH"
fi
if [[ "False" == "${DIB_SKIP_GRUB_PACKAGE_INSTALL:-False}" ]]; then
install-packages -m bootloader $GRUB_PACKAGES
fi
GRUBNAME=$(type -p grub-install) || echo "trying grub2-install"