Add DIB_SKIP_GRUB_PACKAGE_INSTALL for bootloader

Some base images will be known to have the required grub packages
installed already so package installation can be skipped.

This is specifically for the case where the base image was built by dib,
and installing any packages is undesirable because repos are not set up.

Change-Id: I0beab9e93838845a0ee533c7e6c7a4980cadd9b3
This commit is contained in:
Steve Baker 2024-08-30 13:57:12 +12:00
parent 110dde388c
commit 52e2965c21
3 changed files with 12 additions and 4 deletions

View File

@ -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.

View File

@ -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"}

View File

@ -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"