From 0f3066035d58586e1d548fc12aa43a43330251d9 Mon Sep 17 00:00:00 2001 From: Christopher Glass Date: Fri, 17 Mar 2017 13:44:41 -0500 Subject: [PATCH 1/4] This branch fixes the manifest generation in OVA files (LP:1627931) The .ova file extension was passed twice, resulting in file not found errors in both the general case and the vagrant-specific file creation. --- live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary | 2 +- live-build/ubuntu-cpc/hooks/042-vagrant.binary | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary index b7c21474..3b50a268 100755 --- a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary +++ b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary @@ -67,7 +67,7 @@ ovf_sha256=$(sha256sum ${ovf} | cut -d' ' -f1) manifest="${scratch_d}/${prefix}.mf" cat > "${manifest}" < "${manifest}" < Date: Fri, 17 Mar 2017 13:45:42 -0500 Subject: [PATCH 2/4] Fix the OVF's metadata to include Ubuntu specific identifiers and descriptions instead of the generic Linux ones. (LP: #1656293) --- .../hooks/041-vmdk-ova-image.binary | 24 +++++++++++++++---- .../ubuntu-cpc/hooks/042-vagrant.binary | 23 ++++++++++++++---- .../ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl | 3 ++- .../hooks/ovf/ubuntu-ova-v1-vmdk.tmpl | 3 ++- 4 files changed, 42 insertions(+), 11 deletions(-) diff --git a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary index 3b50a268..60716f3c 100755 --- a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary +++ b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary @@ -9,11 +9,24 @@ # # For this step, we re-use the VMDK's made in 040-vmdk-image.binary + +# Switch on $ARCH to determine which ID and description to use in the produced +# OVF. We have fancy Ubuntu-specific IDs in the OVF specification, we might as +# well use them. case $ARCH in - amd64|i386) ;; - *) echo "OVA images are not supported for $ARCH yet."; - exit 0;; + amd64) + ovf_id=94 + ovf_os_type="ubuntu64Guest" + ovf_desc_bits=64 ;; + i386) + ovf_id=93 + ovf_os_type="ubuntu32Guest" + ovf_desc_bits=32 ;; + *) + echo "OVA images are not supported for $ARCH yet."; + exit 0;; esac + cur_d=${PWD} my_d=$(dirname $(readlink -f ${0})) @@ -57,7 +70,10 @@ sed -i "${ovf}" \ -e "s/@@NUM_CPUS@@/2/g" \ -e "s/@@VERSION@@/${version}/g" \ -e "s/@@DATE@@/${serial_stamp}/g" \ - -e "s/@@MEM_SIZE@@/1024/g" + -e "s/@@MEM_SIZE@@/1024/g" \ + -e "s/@@OVF_ID@@/${ovf_id}/g" \ + -e "s/@@OVF_OS_TYPE@@/${ovf_os_type}/g" \ + -e "s/@@OVF_DESC_BITS@@/${ovf_desc_bits}/g" # Get the checksums vmdk_sha256=$(sha256sum ${vmdk_f} | cut -d' ' -f1) diff --git a/live-build/ubuntu-cpc/hooks/042-vagrant.binary b/live-build/ubuntu-cpc/hooks/042-vagrant.binary index aa524a09..0471248d 100755 --- a/live-build/ubuntu-cpc/hooks/042-vagrant.binary +++ b/live-build/ubuntu-cpc/hooks/042-vagrant.binary @@ -18,11 +18,21 @@ cur_d=${PWD} my_d=$(dirname $(readlink -f ${0})) +# Switch on $ARCH to determine which ID and description to use in the produced +# OVF. We have fancy Ubuntu-specific IDs in the OVF specification, we might as +# well use them. case $ARCH in - amd64|i386) ;; - *) - echo "Vagrant images are not supported for $ARCH" - exit 0 + amd64) + ovf_id=94 + ovf_os_type="ubuntu64Guest" + ovf_desc_bits=64 ;; + i386) + ovf_id=93 + ovf_os_type="ubuntu32Guest" + ovf_desc_bits=32 ;; + *) + echo "Vagrant images are not supported for $ARCH yet." + exit 0;; esac . /build/config/functions @@ -172,7 +182,10 @@ sed -i "${ovf}" \ -e "s/@@NUM_CPUS@@/2/g" \ -e "s/@@VERSION@@/${version}/g" \ -e "s/@@DATE@@/${serial_stamp}/g" \ - -e "s/@@MEM_SIZE@@/1024/g" + -e "s/@@MEM_SIZE@@/1024/g" \ + -e "s/@@OVF_ID@@/${ovf_id}/g" \ + -e "s/@@OVF_OS_TYPE@@/${ovf_os_type}/g" \ + -e "s/@@OVF_DESC_BITS@@/${ovf_desc_bits}/g" ovf_sha256=$(sha256sum ${ovf} | cut -d' ' -f1) diff --git a/live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl b/live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl index f91b75b2..f2975610 100644 --- a/live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl +++ b/live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl @@ -18,8 +18,9 @@ A virtual machine @@NAME@@ - + The kind of installed guest operating system + Ubuntu Linux (@@OVF_DESC_BITS@@-bit) diff --git a/live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-vmdk.tmpl b/live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-vmdk.tmpl index 0eaa85a4..7f0b85e0 100644 --- a/live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-vmdk.tmpl +++ b/live-build/ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-vmdk.tmpl @@ -16,8 +16,9 @@ A virtual machine @@NAME@@ - + The kind of installed guest operating system + Ubuntu Linux (@@OVF_DESC_BITS@@-bit) From dbab0a74645fb962e166568ee76461dcbccecea1 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Fri, 17 Mar 2017 13:46:27 -0500 Subject: [PATCH 3/4] Add replace_grub_root_with_label function When update-grub is run, it will detect the disks in the build system. Currently, we sed the grub configuration in places where this happens; replace_grub_root_with_label moves that seddery in to a single callable location to avoid ending up with multiple versions of it. (It's worth noting that we also do this in 999-cpc-fixes.chroot, but as our functions file isn't available within the chroot we don't use it there.) --- live-build/ubuntu-cpc/functions | 7 +++++++ live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary | 2 +- live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/live-build/ubuntu-cpc/functions b/live-build/ubuntu-cpc/functions index 576c1a2e..6b2d69a0 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 From 4d2e4846d389284d492de12717bf5b09d19f7605 Mon Sep 17 00:00:00 2001 From: Robert C Jennings Date: Fri, 17 Mar 2017 13:47:25 -0500 Subject: [PATCH 4/4] Fix OVA generation and add grub label helper for ubuntu-cpc [ Chris Glass ] * Fix the manifest generation in OVA files so that ovf files don't have double extensions. (LP: #1627931) * Fix the OVF's metadata to include Ubuntu specific identifiers and descriptions instead of the generic Linux ones. (LP: #1656293) [ Daniel Watkins ] * Add replace_grub_root_with_label function thereby consolidating multiple uses of the same calls to sed. --- debian/changelog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3c77bb75..b43eedbc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +livecd-rootfs (2.435.2) yakkety; urgency=medium + + [ Chris Glass ] + * Fix the manifest generation in OVA files so that ovf files don't have + double extensions. (LP: #1627931) + * Fix the OVF's metadata to include Ubuntu specific identifiers and + descriptions instead of the generic Linux ones. (LP: #1656293) + [ Daniel Watkins ] + * Add replace_grub_root_with_label function thereby consolidating multiple + uses of the same calls to sed. + + -- Robert C Jennings Fri, 17 Mar 2017 13:46:47 -0500 + livecd-rootfs (2.435.1) yakkety; urgency=medium [ Robert C Jennings ]