diff --git a/debian/changelog b/debian/changelog index 764fc6fb..697691ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,7 +16,9 @@ livecd-rootfs (2.440) UNRELEASED; urgency=medium [ Brian Murray ] * Fix the OVF's metadata to include Ubuntu specific identifiers and descriptions instead of the generic Linux ones. Thanks to Chris Glass. - (LP: #1656293) + (LP: #1656293) + * Add replace_grub_root_with_label function thereby consolidating multiple + uses of the same calls to sed. Thanks to Dan Watkins. [ Adam Conrad ] * Set device_tree_address for the new kernel in the RPi bootloader config.txt diff --git a/live-build/ubuntu-cpc/functions b/live-build/ubuntu-cpc/functions index 6ec42200..c7ff023b 100644 --- a/live-build/ubuntu-cpc/functions +++ b/live-build/ubuntu-cpc/functions @@ -249,4 +249,11 @@ convert_to_qcow2() { qemu-img info "$destination" } +replace_grub_root_with_label() { + # When update-grub is run, it will detect the disks in the build system. + # Instead, we want grub to use the cloudimg-rootfs labelled disk + CHROOT_ROOT="$1" + sed -i -e "s,root=[^ ]\+,root=LABEL=cloudimg-rootfs," \ + "$CHROOT_ROOT/boot/grub/grub.cfg" +} 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 bcce19d7..04a3c7df 100755 --- a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary @@ -105,7 +105,7 @@ EOF chroot mountpoint dpkg-divert --local --rename /etc/grub.d/30_os-prober chroot mountpoint update-grub - sed -i "s,root=.* ,root=LABEL=cloudimg-rootfs ,g" mountpoint/boot/grub/grub.cfg + replace_grub_root_with_label mountpoint chroot mountpoint dpkg-divert --remove --local --rename /etc/grub.d/30_os-prober chroot mountpoint apt-get -y clean diff --git a/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary b/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary index d8c6cd3a..1f6b35a7 100755 --- a/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary +++ b/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary @@ -52,7 +52,7 @@ EOF chroot mountpoint dpkg-divert --local --rename /etc/grub.d/30_os-prober chroot mountpoint update-grub - sed -i "s,root=.* ,root=LABEL=cloudimg-rootfs ,g" mountpoint/boot/grub/grub.cfg + replace_grub_root_with_label mountpoint chroot mountpoint dpkg-divert --remove --local --rename /etc/grub.d/30_os-prober umount_partition mountpoint