Force partuuid in /etc/default/grub.d/* instead of in /etc/default/grub

This prevents ucf questions upon installation of changed /etc/default/grub
core-include-dmsetup
Balint Reczey 7 years ago
parent b32298ede1
commit 86ed851b5a

@ -274,7 +274,8 @@ replace_grub_root_with_label() {
CHROOT_ROOT="$1" CHROOT_ROOT="$1"
# If boot by partuuid has been requested, don't override. # 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 return 0
fi fi
sed -i -e "s,root=[^ ]\+,root=LABEL=cloudimg-rootfs," \ sed -i -e "s,root=[^ ]\+,root=LABEL=cloudimg-rootfs," \

@ -118,7 +118,8 @@ if [ "${should_install_grub}" -eq 1 ]; then
if [ "$SUBPROJECT" = minimize ] && [ -n "$partuuid" ]; then if [ "$SUBPROJECT" = minimize ] && [ -n "$partuuid" ]; then
echo "partuuid found for root device; forcing it in Grub" 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 chroot mountpoint update-grub
fi fi
fi fi

@ -66,7 +66,7 @@ install_grub() {
# and 033-disk-image-uefi.binary. We want to fix this to not # and 033-disk-image-uefi.binary. We want to fix this to not
# have initramfs-tools installed at all on these images. # have initramfs-tools installed at all on these images.
echo "partuuid found for root device; omitting initrd" 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 fi
chroot mountpoint apt-get -y update chroot mountpoint apt-get -y update

Loading…
Cancel
Save