installer: add grub packages for d-i and Calamares

d-i and Calamares select the needed grub packages based on how the
computer is started (BIOS vs UEFI). Because the packages for each
variant conflict, they must be provided as .deb files.
This commit is contained in:
Roland Clobus 2023-01-14 20:13:32 +01:00 committed by Luca Boccassi
parent 947f6aafe8
commit 61ae406dd7
1 changed files with 11 additions and 7 deletions

View File

@ -365,7 +365,9 @@ then
case "${LB_ARCHITECTURE}" in
amd64)
DI_REQ_PACKAGES="grub-pc"
DI_REQ_PACKAGES="grub-pc" # BIOS
DI_REQ_PACKAGES="${DI_REQ_PACKAGES} grub-efi-amd64 efibootmgr grub-efi-amd64-signed shim-signed" # UEFI (required for d-i, includes suggested packages)
DI_REQ_PACKAGES="${DI_REQ_PACKAGES} efibootmgr grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-signed grub2-common mokutil shim-helpers-amd64-signed shim-signed shim-signed-common shim-unsigned cryptsetup keyutils" # UEFI (required by Calamares)
DI_PACKAGES="linux-image-amd64"
;;
@ -442,6 +444,14 @@ then
# Set apt command prefix
_LB_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o Dir::State::status=/dev/null -o APT::Install-Recommends=false -o Debug::NoLocking=true --download-only"
# Download .debs of the required packages
Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES}
# The required packages or firmware packages might conflict, so download each individually
for _PACKAGE in ${DI_FIRMWARE_PACKAGES} ${DI_REQ_PACKAGES}
do
Chroot chroot ${_LB_APT_COMMAND} install ${_PACKAGE}
done
if [ "${LB_DEBIAN_INSTALLER}" = "live" ]
then
# We don't want to duplicate .debs of packages in binary/pool that are already
@ -451,9 +461,6 @@ then
# d-i does not support (for example) re-installing grub from target/ - the grub
# .debs must actually exist.
# Download .debs of the required packages
Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES} ${DI_REQ_PACKAGES}
# Drop the packages already installed that d-i doesn't explicitly need
_REMAINING_PACKAGES="$(echo ${DI_FIRMWARE_PACKAGES} ${DI_REQ_PACKAGES} | sed -e 's# #|#g')"
_REMAINING_PACKAGES="$(Chroot_package_list chroot | grep -E -v "^(${_REMAINING_PACKAGES})\$")"
@ -463,9 +470,6 @@ then
do
rm -f chroot/binary.deb/archives/${_PACKAGE}_*.deb
done
else
# Download .debs of the required packages
Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES} ${DI_REQ_PACKAGES}
fi
mv chroot/binary.deb ./