From f1a8538c8e6acc75eec3683077dea6f03217c852 Mon Sep 17 00:00:00 2001 From: Christopher Glass Date: Mon, 16 Jan 2017 09:26:25 +0000 Subject: [PATCH 1/4] This branch fixes the OVF's metadata to include Ubuntu-specific identifiers and descriptions instead of the generic linux ones (lp:1656293). This applies to both the general image and the vagrant-specific one. --- .../hooks/041-vmdk-ova-image.binary | 20 ++++++++++++++++++- .../ubuntu-cpc/hooks/042-vagrant.binary | 19 +++++++++++++++++- .../ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl | 3 ++- .../hooks/ovf/ubuntu-ova-v1-vmdk.tmpl | 3 ++- 4 files changed, 41 insertions(+), 4 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..e2421cb6 100755 --- a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary +++ b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary @@ -14,6 +14,21 @@ case $ARCH in *) echo "OVA images are not supported for $ARCH yet."; exit 0;; esac + +# 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) + ovf_id=94 + ovf_os_type="ubuntu64Guest" + ovf_desc_bits=64 ;; + i386) + ovf_id=93 + ovf_os_type="ubuntu32Guest" + ovf_desc_bits=32 ;; +esac + cur_d=${PWD} my_d=$(dirname $(readlink -f ${0})) @@ -57,7 +72,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 ca08e44e..4a309d18 100755 --- a/live-build/ubuntu-cpc/hooks/042-vagrant.binary +++ b/live-build/ubuntu-cpc/hooks/042-vagrant.binary @@ -25,6 +25,20 @@ case $ARCH in exit 0 esac +# 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) + ovf_id=94 + ovf_os_type="ubuntu64Guest" + ovf_desc_bits=64 ;; + i386) + ovf_id=93 + ovf_os_type="ubuntu32Guest" + ovf_desc_bits=32 ;; +esac + . /build/config/functions # Virtualbox is needed for making a small VMDK @@ -172,7 +186,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..53fd41fe 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 5a07ff4602b31194b980cbce6a67ad07aad8a47d Mon Sep 17 00:00:00 2001 From: Christopher Glass Date: Tue, 17 Jan 2017 08:10:26 +0000 Subject: [PATCH 2/4] Roll both switches on $ARCH into one, as suggested at review. --- .../hooks/041-vmdk-ova-image.binary | 20 +++++++++---------- 1 file changed, 9 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 e2421cb6..3884f321 100755 --- a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary +++ b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary @@ -9,24 +9,22 @@ # # For this step, we re-use the VMDK's made in 040-vmdk-image.binary -case $ARCH in - amd64|i386) ;; - *) echo "OVA images are not supported for $ARCH yet."; - exit 0;; -esac # 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) - ovf_id=94 - ovf_os_type="ubuntu64Guest" - ovf_desc_bits=64 ;; + ovf_id=94 + ovf_os_type="ubuntu64Guest" + ovf_desc_bits=64 ;; i386) - ovf_id=93 - ovf_os_type="ubuntu32Guest" - ovf_desc_bits=32 ;; + 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} From b6e7b22680de670a82bb5f52046ec96372a6c312 Mon Sep 17 00:00:00 2001 From: Christopher Glass Date: Thu, 16 Feb 2017 01:42:25 +0100 Subject: [PATCH 3/4] Rool both switches into one for all affected files (the vagrant file was still doing two switches on $ARCH). --- live-build/ubuntu-cpc/hooks/042-vagrant.binary | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/live-build/ubuntu-cpc/hooks/042-vagrant.binary b/live-build/ubuntu-cpc/hooks/042-vagrant.binary index 4a309d18..b0593531 100755 --- a/live-build/ubuntu-cpc/hooks/042-vagrant.binary +++ b/live-build/ubuntu-cpc/hooks/042-vagrant.binary @@ -18,13 +18,6 @@ cur_d=${PWD} my_d=$(dirname $(readlink -f ${0})) -case $ARCH in - amd64|i386) ;; - *) - echo "Vagrant images are not supported for $ARCH" - exit 0 -esac - # 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. @@ -37,6 +30,9 @@ case $ARCH in ovf_id=93 ovf_os_type="ubuntu32Guest" ovf_desc_bits=32 ;; + *) + echo "Vagrant images are not supported for $ARCH" + exit 0;; esac . /build/config/functions From 5da94c05e5798bb44ea4f413b499e46046e82f68 Mon Sep 17 00:00:00 2001 From: Christopher Glass Date: Thu, 16 Feb 2017 03:11:06 +0100 Subject: [PATCH 4/4] Fixed template omission (found wile running a build withthis branch). --- .../ubuntu-cpc/hooks/ovf/ubuntu-ova-v1-cloudcfg-vmdk.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 53fd41fe..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,7 +18,7 @@ A virtual machine @@NAME@@ - + The kind of installed guest operating system Ubuntu Linux (@@OVF_DESC_BITS@@-bit)