From 1a884c142795020ebb22b17ce81511f48050ad34 Mon Sep 17 00:00:00 2001 From: Philip Roche Date: Tue, 26 Sep 2023 17:28:25 +0100 Subject: [PATCH] fix: Ensure that grub/shim package installs do not install recommends for minimized ubuntu-cpc image builds (LP: #2037075) minimized cloud image policy, introduced in version 23.10.16, is to not install recommends for any package installs during build. This is to keep the image as small as possible. This also extends to the grub related packages. This solves the problems detailed in LP: #2037075 and aligns other arches more with amd64 install of grub/shim packages for both minimized and non minimized ubuntu-cpc cloud image builds. --- debian/changelog | 7 +++++++ .../hooks.d/base/disk-image-uefi.binary | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9c5c0fff..8c1de1c3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +livecd-rootfs (23.10.47) UNRELEASED; urgency=medium + + * fix: Ensure that grub/shim package installs do not install recommends for + minimized ubuntu-cpc image builds (LP: #2037075) + + -- Phil Roche Fri, 22 Sep 2023 11:59:10 +0100 + livecd-rootfs (23.10.46) UNRELEASED; urgency=medium [ Simon Poirier ] diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary index 3685e464..6d73d004 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary @@ -106,25 +106,33 @@ install_grub() { chroot mountpoint apt-get -y update + package_install_recommends_option="" + # minimized cloud image policy, introduced in version 23.10.16, is to not install recommends for any package + # installs during build. This is to keep the image as small as possible. This also extends to + # the grub related packages. + if [ "${SUBPROJECT:-}" = minimized ]; then + package_install_recommends_option="--no-install-recommends" + fi + # UEFI GRUB modules are meant to be used equally by Secure Boot and # non-Secure Boot systems. If you need an extra module not already # provided or run into "Secure Boot policy forbids loading X" problems, # please file a bug against grub2 to include the affected module. case $ARCH in arm64) - chroot mountpoint apt-get -qqy install --no-install-recommends shim-signed grub-efi-arm64-signed + chroot mountpoint apt-get -qqy install ${package_install_recommends_option} shim-signed grub-efi-arm64-signed efi_target=arm64-efi ;; armhf) - chroot mountpoint apt-get -qqy install --no-install-recommends grub-efi-arm grub-efi-arm-bin + chroot mountpoint apt-get -qqy install ${package_install_recommends_option} grub-efi-arm grub-efi-arm-bin efi_target=arm-efi ;; amd64) - chroot mountpoint apt-get install -qqy grub-pc shim-signed + chroot mountpoint apt-get install -qqy ${package_install_recommends_option} grub-pc shim-signed efi_target=x86_64-efi ;; riscv64) - chroot mountpoint apt-get install -qqy u-boot-menu grub-efi-riscv64 + chroot mountpoint apt-get install -qqy ${package_install_recommends_option} u-boot-menu grub-efi-riscv64 efi_target=riscv64-efi chroot mountpoint u-boot-update