From 4bc9def5d6bd987c1ac8d59bc48cc521c311c4b8 Mon Sep 17 00:00:00 2001 From: Christopher Glass Date: Fri, 17 Mar 2017 13:32:55 -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 c48ca75b..8b5ecefd 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:34:22 -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 8b5ecefd..cc8ed5d3 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 ececc9789d6d5265a233764afc46a80ca57d80e0 Mon Sep 17 00:00:00 2001 From: Daniel Watkins Date: Fri, 17 Mar 2017 13:35:37 -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 8599ea8d..714c1a35 100755 --- a/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks/033-disk-image-uefi.binary @@ -108,7 +108,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 d085ba38..d4539594 100755 --- a/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary +++ b/live-build/ubuntu-cpc/hooks/034-disk-image-ppc64el.binary @@ -51,7 +51,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 dacc1ea41ecdd26ba98dc316545e0fd3523f786b Mon Sep 17 00:00:00 2001 From: Robert C Jennings Date: Fri, 17 Mar 2017 13:39:21 -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 398fe8e2..4d91a2e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +livecd-rootfs (2.408.9) xenial; 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:15:49 -0500 + livecd-rootfs (2.408.8) xenial; urgency=medium * Set device_tree_address for the new kernel in the RPi bootloader config.txt