From c5d01a6635608d2aa8efb40a38308fb76ee29c17 Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Wed, 27 Sep 2017 18:54:09 -0400 Subject: [PATCH] Force partuuid in /etc/default/grub.d/* instead of in /etc/default/grub This prevents ucf questions upon installation of changed /etc/default/grub --- live-build/functions | 3 ++- live-build/ubuntu-cpc/hooks/032-disk-image.binary | 3 ++- live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/live-build/functions b/live-build/functions index 3e0fe329..7fe52f30 100644 --- a/live-build/functions +++ b/live-build/functions @@ -276,7 +276,8 @@ replace_grub_root_with_label() { CHROOT_ROOT="$1" # If boot by partuuid has been requested, don't override. - if grep -q ^GRUB_FORCE_PARTUUID= $CHROOT_ROOT/etc/default/grub; then + if [ -f $CHROOT_ROOT/etc/default/grub.d/40-partuuid ] && \ + grep -q ^GRUB_FORCE_PARTUUID= $CHROOT_ROOT/etc/default/grub.d/40-partuuid; then return 0 fi sed -i -e "s,root=[^ ]\+,root=LABEL=${fs_label}," \ diff --git a/live-build/ubuntu-cpc/hooks/032-disk-image.binary b/live-build/ubuntu-cpc/hooks/032-disk-image.binary index be45c51b..0af56470 100755 --- a/live-build/ubuntu-cpc/hooks/032-disk-image.binary +++ b/live-build/ubuntu-cpc/hooks/032-disk-image.binary @@ -123,7 +123,8 @@ if [ "${should_install_grub}" -eq 1 ]; then if [ "$SUBPROJECT" = minimize ] && [ -n "$partuuid" ]; then echo "partuuid found for root device; forcing it in Grub" - echo "GRUB_FORCE_PARTUUID=$partuuid" >> mountpoint/etc/default/grub + mkdir -p mountpoint/etc/default/grub.d + echo "GRUB_FORCE_PARTUUID=$partuuid" >> mountpoint/etc/default/grub.d/40-force-partuuid chroot mountpoint update-grub fi fi diff --git a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary index fa805bf6..5827a6fe 100755 --- a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary @@ -67,7 +67,7 @@ install_grub() { # and 033-disk-image-uefi.binary. We want to fix this to not # have initramfs-tools installed at all on these images. echo "partuuid found for root device; omitting initrd" - echo "GRUB_FORCE_PARTUUID=$partuuid" >> mountpoint/etc/default/grub + echo "GRUB_FORCE_PARTUUID=$partuuid" >> mountpoint/etc/default/grub.d/40-force-partuuid fi chroot mountpoint apt-get -y update