From b0c8b628b26aca86c7c934dfb2174377c6087b44 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Mon, 26 Oct 2020 11:48:24 -0700 Subject: [PATCH] ubuntu-cpc: only install shim-signed, run autoremove The CPC build hooks for amd64 incorrectly attempt to install shim-signed in addition to grub-efi-amd64 and grub-pc. These latter two packages conflict with each other. Instead shim-signed should install whatever packages are required. Additionally, this will ensure that autoremove is run after installing anything in the CPC build hooks. This is done to avoid shipping images that include packages that are autoremovable. This will clean-up as packages are installed and detect any breakage at build time. --- live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary | 1 + live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary | 4 +++- live-build/ubuntu-cpc/hooks.d/base/disk-image.binary | 1 + live-build/ubuntu-cpc/hooks.d/base/wsl.binary | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary index 77f24e7e..dc87a361 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-ppc64el.binary @@ -33,6 +33,7 @@ install_grub() { chroot mountpoint apt-get -qqy update chroot mountpoint apt-get -qqy install grub-ieee1275 chroot mountpoint apt-get -qqy remove --purge grub-legacy-ec2 + chroot mountpoint apt-get autoremove --purge --assume-yes # set the kernel commandline to use hvc0 mkdir -p mountpoint/etc/default/grub.d 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 910f67a9..674d795a 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 @@ -89,11 +89,13 @@ install_grub() { efi_target=arm-efi ;; amd64) - chroot mountpoint apt-get install -qqy grub-efi-amd64-signed shim-signed + chroot mountpoint apt-get install -qqy shim-signed efi_target=x86_64-efi ;; esac + chroot mountpoint apt-get autoremove --purge --assume-yes + chroot mountpoint grub-install "${loop_device}" \ --boot-directory=/boot \ --efi-directory=/boot/efi \ diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary index 8998df68..96bf83a5 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary @@ -136,6 +136,7 @@ fi if [ "$ARCH" = "s390x" ]; then # Do ZIPL install bits chroot mountpoint apt-get -qqy install s390-tools sysconfig-hardware + chroot mountpoint apt-get autoremove --purge --assume-yes # Write out cloudy zipl.conf for future kernel updates cat << EOF > mountpoint/etc/zipl.conf diff --git a/live-build/ubuntu-cpc/hooks.d/base/wsl.binary b/live-build/ubuntu-cpc/hooks.d/base/wsl.binary index 05f51e30..8ce28140 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/wsl.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/wsl.binary @@ -35,6 +35,7 @@ cp -a rootfs.dir $rootfs_dir setup_mountpoint $rootfs_dir env DEBIAN_FRONTEND=noninteractive chroot $rootfs_dir apt-get -y -qq install ubuntu-wsl +env DEBIAN_FRONTEND=noninteractive chroot $rootfs_dir apt-get autoremove --purge --assume-yes create_manifest $rootfs_dir livecd.ubuntu-cpc.wsl.rootfs.manifest teardown_mountpoint $rootfs_dir