From 1855130ecc9a6cf192a843ca3f733d4eca614d45 Mon Sep 17 00:00:00 2001 From: Ben Howard Date: Fri, 13 Nov 2015 08:09:26 -0700 Subject: [PATCH] Pre-merge commit --- debian/changelog | 31 ------------------- live-build/ubuntu-cpc/functions | 28 ++++++++--------- .../ubuntu-cpc/hooks/040-vmdk-image.binary | 4 +-- .../hooks/041-vmdk-ova-image.binary | 2 +- .../ubuntu-cpc/hooks/042-vagrant.binary | 14 ++++----- 5 files changed, 22 insertions(+), 57 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3963ff92..fed3b79d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,34 +1,3 @@ -livecd-rootfs (2.354.0~utlemming33) xenial; urgency=medium - - * Test build - - -- Ben Howard Thu, 12 Nov 2015 17:56:31 -0700 - -livecd-rootfs (2.354.0~utlemming32) xenial; urgency=medium - - * Test build - - -- Ben Howard Thu, 12 Nov 2015 17:52:26 -0700 - -livecd-rootfs (2.354.0~utlemming31) xenial; urgency=medium - - * Test build - - -- Ben Howard Thu, 12 Nov 2015 17:22:18 -0700 - -livecd-rootfs (2.354.0~utlemming30) xenial; urgency=medium - - * Test build - - -- Ben Howard Thu, 12 Nov 2015 17:21:42 -0700 - -livecd-rootfs (2.354) xenial; urgency=medium - - * ubuntu-cpc: extended hooks to build additional cloud image targets - including VMDKs, OVA, and Vagrant images. - - -- Ben Howard Thu, 12 Nov 2015 15:00:36 -0700 - livecd-rootfs (2.353) xenial; urgency=medium * drop input group from snappy images, adjust md5 sums in diff --git a/live-build/ubuntu-cpc/functions b/live-build/ubuntu-cpc/functions index 31645633..b5500e70 100644 --- a/live-build/ubuntu-cpc/functions +++ b/live-build/ubuntu-cpc/functions @@ -1,3 +1,5 @@ +# vi: ts=4 expandtab syntax=sh + CLOUD_IMG_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" IMAGE_SIZE=$((2252*1024**2)) # 2.2G (the current size we ship) @@ -84,16 +86,15 @@ modify_vmdk_header() { # remove the comments from vmdk-stream-converter which causes # VirtualBox and others to fail VMDK validation - sed -e 's|ddb.comment.*|ddb.toolsVersion = "2147483647"|' \ - -e 's|ddb.virtualHWVersion.*|ddb.virtualHWVersion = "7"|' \ - -e 's|createType.*|createType="streamOptimized"|' \ - -e 's|# Description file.*|# Disk DescriptorFile|' \ - -e '/# Believe.*/d' \ + sed -e 's|# Description file.*|# Disk DescriptorFile|' \ + -e '/# Believe this is random*/d' \ -e '/# Indicates no parent/d' \ + -e '/# The Disk Data Base/d' \ + -e 's|ddb.comment.*|ddb.toolsVersion = "2147483647"|' \ "${descriptor}" > "${newdescriptor}" # The header is cannot be bigger than 1024 - expr $(stat --format=%s ${newdescriptor}) \< 1024 || { + expr $(stat --format=%s ${newdescriptor}) \< 1024 > /dev/null 2>&1 || { echo "descriptor is too large, VMDK will be invalid!"; exit 1; } # Overwrite the vmdk header with our new, modified one @@ -106,9 +107,9 @@ modify_vmdk_header() { create_vmdk() { # There is no real good way to create a _compressed_ VMDK using open source - # tooling that works across multiple VMDK-capable platforms. Thie functions - # uses vmdk-stream-converter and then call modify_vmdk_header to produce a - # compatiable VMDK. + # tooling that works across multiple VMDK-capable platforms. This functions + # uses vmdk-stream-converter and then calls modify_vmdk_header to produce a + # compatible VMDK. src="$1" destination="$2" @@ -120,12 +121,9 @@ create_vmdk() { cp ${src} ${scratch_d}/resize.img truncate --size=${size}M ${scratch_d}/resize.img - python ${streamconverter} ${scratch_d}/resize.img "${destination}" - modify_vmdk_header "${destination}" - - qemu-img info "${destination}" + python ${streamconverter} ${scratch_d}/resize.img ${destination} + modify_vmdk_header ${destination} + qemu-img info ${destination} rm -rf ${scratch_d} } - - diff --git a/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary b/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary index 11c0ed7f..44f876dc 100755 --- a/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary +++ b/live-build/ubuntu-cpc/hooks/040-vmdk-image.binary @@ -1,5 +1,5 @@ #!/bin/bash -eux -# vi: ts=4 noexpandtab +# vi: ts=4 expandtab # # Generate VMDK files @@ -15,7 +15,7 @@ esac . /build/config/functions -create_vmdk binary/boot/disk.ext4 livecd.ubuntu-cpc.disk1.vmdk +create_vmdk binary/boot/disk.ext4 livecd.ubuntu-cpc.disk1.vmdk if [ -e binary/boot/disk-uefi.ext4 ]; then create_vmdk binary/boot/disk-uefi.ext4 livecd.ubuntu-cpc.uefi.vmdk 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 895d3b27..84134c42 100755 --- a/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary +++ b/live-build/ubuntu-cpc/hooks/041-vmdk-ova-image.binary @@ -1,5 +1,5 @@ #!/bin/bash -eux -# vi: ts=4 noexpandtab +# vi: ts=4 expandtab # # Generate OVA images # diff --git a/live-build/ubuntu-cpc/hooks/042-vagrant.binary b/live-build/ubuntu-cpc/hooks/042-vagrant.binary index 83441598..ee3a03d6 100755 --- a/live-build/ubuntu-cpc/hooks/042-vagrant.binary +++ b/live-build/ubuntu-cpc/hooks/042-vagrant.binary @@ -17,14 +17,12 @@ my_d=$(dirname $(readlink -f ${0})) architecture=$(chroot chroot dpkg --print-architecture) base_vmdk="livecd.ubuntu-cpc.disk1.vmdk" -case ${architecture} in - amd64) base_vmdk="livecd.ubuntu-cpc.uefi.vmdk";; - *) echo "OVA images are not supported for ${architecture} yet."; - exit 0;; -esac - -if [ ! -e ${base_vmdk} ]; then - find . | grep vmdk + +if [[ "${architecture}" =~ (amd64|i386) ]]; then + echo "Vagrant images are not supported for ${architecutre}" + exit 0 +elif [ ! -e ${base_vmdk} ]; then + echo "Did not find VMDK to produce Vagrant images." exit 0 fi