From 41fd537bc22fded83127cd7871b1ee3d7fe9656e Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Fri, 23 Apr 2021 11:24:38 +0100 Subject: [PATCH] 999-cpc-fixes: enable more code on grub2 armhf & arm64 armhf & arm64 images use grub. And despite disk-image & disk-image-uefi installing all the grubs, some of the configuration is done in the 999-cpc-fixes. Specifically removal of "quiet splash" is done there, but not active on armhf & arm64. This results in arm images to boot with "quiet splash". Enable running the later portions of 999-cpc-fixes on armhf & arm64. Drop duplicate call to update-grub, as update-grub2 is simply a symlink to update-grub. Add a guard around the call to reconfigure grub-pc, to only do that when it is installed. This makes armhf & arm64 uefi images consistent with amd64 uefi images. LP: #1925780 --- .../hooks.d/chroot/999-cpc-fixes.chroot | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot b/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot index 3e1a9131..3071e01b 100755 --- a/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot +++ b/live-build/ubuntu-cpc/hooks.d/chroot/999-cpc-fixes.chroot @@ -117,7 +117,7 @@ fi case $arch in # ARM, ppc, riscv64 and s390x images are special - armhf|arm64|powerpc|ppc64el|s390x|riscv64) + powerpc|ppc64el|s390x|riscv64) exit 0 ;; esac @@ -208,17 +208,20 @@ GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0" # Set the grub console type GRUB_TERMINAL=console EOF -_xchroot "${rootd}" update-grub2 -# since this is a disk image, we technically don't need to install all the -# grub modules, as the image itself is not bootable. This makes for a small -# disk image -_xchroot "${rootd}" update-grub +# Sometimes grub is not installed yet (i.e. uefi arm images). Overall +# it is odd that we run this out of chroot hooks, instead of binary +# hooks. I wonder if we can move all of this to disk-image hooks. +if [ -x "${rootd}/usr/sbin/update-grub" ]; then + _xchroot "${rootd}" update-grub +fi # reconfigure grub so that upgrades to grub-pc do not force a debconf config # changed prompt (LP: #1009294). This re-runs update-grub -_xchroot "${rootd}" env DEBIAN_FRONTEND=noninteractive \ - dpkg-reconfigure grub-pc +if [ -n "`_xchroot "${rootd}" dpkg-query -W grub-pc 2>/dev/null`" ]; then + _xchroot "${rootd}" env DEBIAN_FRONTEND=noninteractive \ + dpkg-reconfigure grub-pc +fi grub2cfg="${rootd}/boot/grub/grub.cfg" [ ! -f "${grub2cfg}" ] ||