diff --git a/live-build/buildd/hooks/02-disk-image-uefi.binary b/live-build/buildd/hooks/02-disk-image-uefi.binary index 280db0ab..3217a956 100755 --- a/live-build/buildd/hooks/02-disk-image-uefi.binary +++ b/live-build/buildd/hooks/02-disk-image-uefi.binary @@ -98,29 +98,6 @@ install_grub() { # snap listings) chroot mountpoint dpkg-query -W > binary/boot/filesystem.packages - chroot mountpoint grub-install "${loop_device}" \ - --boot-directory=/boot \ - --efi-directory=/boot/efi \ - --target=${efi_target} \ - --removable \ - --uefi-secure-boot \ - --no-nvram - - if [ -f mountpoint/boot/efi/EFI/BOOT/grub.cfg ]; then - sed -i "s| root| root hd0,gpt1|" mountpoint/boot/efi/EFI/BOOT/grub.cfg - sed -i "1i${IMAGE_STR}" mountpoint/boot/efi/EFI/BOOT/grub.cfg - # For some reason the grub disk is looking for /boot/grub/grub.cfg on - # part 15.... - chroot mountpoint mkdir -p /boot/efi/boot/grub - chroot mountpoint cp /boot/efi/EFI/BOOT/grub.cfg /boot/efi/boot/grub - fi - - if [ "$ARCH" = "amd64" ]; then - # Install the BIOS/GPT bits. Since GPT boots from the ESP partition, - # it means that we just run this simple command and we're done - chroot mountpoint grub-install --target=i386-pc "${loop_device}" - fi - cat > mountpoint/etc/default/grub.d/50-builddimg-settings.cfg << EOF GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT=0.1 @@ -129,8 +106,22 @@ GRUB_TIMEOUT=0.1 GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0" GRUB_RECORDFAIL_TIMEOUT=0 GRUB_TERMINAL=console +GRUB_DISTRIBUTOR=Ubuntu EOF + chroot mountpoint grub-install "${loop_device}" \ + --boot-directory=/boot \ + --efi-directory=/boot/efi \ + --target=${efi_target} \ + --uefi-secure-boot \ + --no-nvram + + if [ "$ARCH" = "amd64" ]; then + # Install the BIOS/GPT bits. Since GPT boots from the ESP partition, + # it means that we just run this simple command and we're done + chroot mountpoint grub-install --target=i386-pc "${loop_device}" + fi + divert_grub mountpoint chroot mountpoint update-grub replace_grub_root_with_label mountpoint