← Back to team overview

vmbuilder team mailing list archive

[Merge] lp:~stgraber/vmbuilder/lxd-metadata into lp:vmbuilder

 

Stéphane Graber has proposed merging lp:~stgraber/vmbuilder/lxd-metadata into lp:vmbuilder.

Requested reviews:
  VMBuilder (vmbuilder)

For more details, see:
https://code.launchpad.net/~stgraber/vmbuilder/lxd-metadata/+merge/289727

We also want cloud-init to work on container clone.
-- 
Your team VMBuilder is requested to review the proposed merge of lp:~stgraber/vmbuilder/lxd-metadata into lp:vmbuilder.
=== added file 'README.files'
--- README.files	1970-01-01 00:00:00 +0000
+++ README.files	2016-03-22 02:54:49 +0000
@@ -0,0 +1,77 @@
+This compressed tar archive contains files relevant to this machine image.
+Each filename is prefixed by a constant string denoting release and
+architecture information.  The prefix, for example, may be
+'maverick-server-cloudimg-amd64', in which case files will be named like
+  maverick-server-cloudimg-amd64.img
+  maverick-server-cloudimg-amd64-vmlinuz-virtual
+
+All or some of the following files may be present in the archive:
+
+- <prefix>.img
+  This file is an partition image.  It can be bundled, uploaded and
+  registered to EC2, Eucalyptus or OpenStack as a Amazon Machine Image
+  (ami/emi).
+
+- <prefix>-disk1.img
+  This is a qcow2 compressed disk image.  It can be uploaded to OpenStack
+  or booted directly via kvm.  You should probably uncompress the image
+  (qemu-img convert) before use in non-testing environment.
+
+- <prefix>-uefi1.img
+  This is a qcow2 compressed disk image that has GPT partitioning and a UEFI
+  bootloader. It is bootable via UEFI, BIOS/GPT and PVGRUB (with support
+  for GPT partition tables. It is bootable in OpenStack or directly via kvm.
+  You should probably uncompress the images (qemu-img convert) before using
+  it in a non-testing environment.
+
+- <prefix>-root.tar.gz
+  This is a compressed tar file containing the contents of the root
+  filesystem.  Essentially, 'tar cpzf - /'.
+
+- <prefix>-vmlinuz-virtual
+  This is a Linux kernel.  It can be bundled, uploaded, and registered
+  UEC as an Amazon Kernel Image (aki/eki).  The '-virtual' string
+  represents the Ubuntu Linux package that this kernel came from.  It
+  could potentially be '-server' or another string.
+
+- <prefix>-initrd-virtual
+  This is a Linux initrd.  It can be bundled, uploaded, and registered
+  UEC as an Amazon Ramdisk Image (ari/eri). Not all images require an
+  initrd, and thus this file may not be present.  If it is not present,
+  then the image should be registered without a ramdisk.
+
+- <prefix>-loader
+  This file is a multiboot compliant image capable of loading the
+  guest image. On UEC installs where the host operating system is 10.10 or
+  later (LP: #611144), this can registered as a kernel (eki).
+  It provides function similar to the Amazon released feature
+  "Enabling User Provided Kernels".  When the loader is used to boot an
+  instance, a kernel upgrade performed inside the instance will take
+  affect on subsequent boots.
+
+- <prefix>-floppy
+  This file is a floppy disk image.  It is not useful or relevant to
+  running inside of EC2 or UEC.
+  The purpose of this file is to allow booting the <prefix>.img outside a cloud.
+  To boot outside of a cloud environment (where a metadata service is not
+  present), the following kvm command line can be used:
+     kvm -boot a -fda <prefix>-floppy -drive file=<prefix>.img,if=virtio
+  This is not necessary, and generally obsolete, if <prefix>-disk1.img is
+  available.
+
+Other notes:
+- This tar file is constructed such that it can be easily
+  bundled uploaded and registered using 'cloud-publish-tarball' as an admin
+  by invoking
+    cloud-publish-tarball tarfile.tar.gz my-bucket i386
+  or, to use the loader file as
+    cloud-publish-tarball --use-loader tarfile.tar.gz my-bucket i386
+- The image file (.img) can be resized before uploading by using
+  'cloud-resize-image', as:
+    cloud-resize-image <prefix>.img 5G
+  or, resized before uploading with cloud-publish-tarball by:
+    cloud-publish-tarball --resize 5G tarfile.tar.gz my-bucket i386
+
+   *Note*: in 11.10 and beyond, 'uec' as a prefix to the commands below is
+      replaced with 'cloud'. So, 'cloud-publish-tarball' may be 'uec-publish-tarball'
+      in your cloud-utils package. Just substitite accordingly.

=== added file 'README.new-release'
--- README.new-release	1970-01-01 00:00:00 +0000
+++ README.new-release	2016-03-22 02:54:49 +0000
@@ -0,0 +1,73 @@
+- Ubuntu 15.04 enablement
+
+- Ubuntu 14.04 LTS (Trust Tahr) enablement
+
+- Ubuntu 13.10 (Saucy Salamander) enablement
+  - Dropped OMAP images
+
+- Ubuntu 13.04 (Raring Ringtail) enablement
+  - No longer using crontab; build system has been re-implemented within
+       Jenkins
+  - copy conf/N-1-desktop.conf to conf/N-desktop.conf (bzr add)
+  - copy conf/N-1-server.conf to conf/N-server.conf (bzr add)
+  - add entries to daily-build-cleaner-schedule.txt
+  - add entries to remove-old-dailies
+  - copy ovf/conf/N-1-server.conf to ovf/conf/N-server.conf (bzr add)
+
+
+- Ubuntu 12.10 (Quantal Quetzal) enablement
+  - edit crontab in automated-ec2-builds
+  - copy conf/N-1-desktop.conf to conf/N-desktop.conf (bzr add)
+  - copy conf/N-1-server.conf to conf/N-server.conf (bzr add)
+  - add entries to daily-build-cleaner-schedule.txt
+  - add entries to remove-old-dailies
+  - copy ovf/conf/N-1-server.conf to ovf/conf/N-server.conf (bzr add)
+
+- vmbuilder changes
+  From branch at lp:~ubuntu-virt/vmbuilder/0.11/
+  example commit at [1]
+  - plugins/ubuntu/distro.py
+  - copy plugins/ubuntu/N-1.py to plugins/ubuntu/N.py and modify
+
+- cdimage changes
+  branchin ~vmbuilder/cdimage.  Example commit at [2]
+  - add release to etc/config
+  - add release to bin/site-manifest
+  - add release to bin/publish-release
+  - add release to bin/make-web-indices
+
+- automated-ec2-builds:
+  branch at lp:~ubuntu-on-ec2/vmbuilder/automated-ec2-builds/
+  example commit at [3]
+  - edit crontab in automated-ec2-builds
+  - copy conf/N-1-desktop.conf to conf/N-desktop.conf (bzr add)
+  - copy conf/N-1-server.conf to conf/N-server.conf (bzr add)
+  - add entries to daily-build-cleaner-schedule.txt
+  - add entries to remove-old-dailies
+  - copy ovf/conf/N-1-server.conf to ovf/conf/N-server.conf (bzr add)
+
+- ec2-publishing-scripts
+  branch at lp:~ubuntu-on-ec2/ubuntu-on-ec2/ec2-publishing-scripts/
+  - no changes necessary
+
+- ami pages updates
+  potentially add new ami pages as described at [4]
+  currently, there is no way to do this, see [5] for more info
+
+- update debootstrap to know about new release:
+  - ln -sf gutsy /usr/share/debootstrap/scripts/N
+    example: ln -sf gutsy /usr/share/debootstrap/scripts/oneiric
+
+- edit un-versioned 'build-daily' 
+  script is in ~vmbuilder/bin/build-daily.  it is a very simple wrapper
+  script around cloudimg-build-launcher
+
+- pull changes to nectarine
+- update crontab on nectarine
+
+--
+[1] http://bazaar.launchpad.net/~ubuntu-virt/vmbuilder/0.11/revision/390
+[2] https://gist.github.com/951854
+[3] http://bazaar.launchpad.net/~ubuntu-on-ec2/vmbuilder/automated-ec2-builds/revision/267
+[4] https://wiki.ubuntu.com/UEC/Images/Publishing
+[5] https://forums.aws.amazon.com/message.jspa?messageID=210521

=== added file 'build-buildd-image'
--- build-buildd-image	1970-01-01 00:00:00 +0000
+++ build-buildd-image	2016-03-22 02:54:49 +0000
@@ -0,0 +1,217 @@
+#!/bin/bash
+# vi: ts=4
+
+## Copyright (C) 2011 Ben Howard <ben.howard@xxxxxxxxxxxxx> and Scott Moser <smoser@xxxxxxxxxxxxx>
+## Date: 01 July 2011
+##
+## Script for doing builds with live-build system in an automated fashion
+## This comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see copyING for details.
+base_d="$(dirname "$(readlink -f "${0}")")"
+TEMP_D=""
+FINAL_DIR=""
+CHOWN_OPTS=""
+
+error() { echo "$@" 1>&2; }
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+debug() { error "$(date -R):" "$@"; }
+cleanup() {
+    if [ -n "${TEMP_D}" -a -d "${TEMP_D}" ]; then
+        umount_r "${TEMP_D}" && rm -rf "${TEMP_D}" || return 1
+    fi
+    if [ -n "${FINAL_DIR}" -a -d "${FINAL_DIR}" -a -n "${CHOWN_OPTS}" ]; then
+        chown -R "${CHOWN_OPTS}" "${FINAL_DIR}"
+    fi
+}
+dist_ge() { [[ "$1" > "$2" || "$1" == "$2" ]]; }
+dist_le() { [[ "$1" < "$2" || "$1" == "$2" ]]; }
+
+usage() {
+cat << EOF
+Live-Build Control Script
+    Uses customized live build to produce Cloud Images
+
+    Optional
+        --arch      Arch type, i.e. amd64 or i386, default all
+        --dest      Directory to put the final image
+        --image     What to name the image, defaults to root.img
+        --owner     Set the owner of the resulting files
+        --copy      Copy the final image for debugig to location
+        --manifest  Where to drop the manfiest file
+        --proposed  Build from proposed
+EOF
+}
+
+# Parse options
+
+short_opts="d,l,h"
+long_opts="arch:,dest:,debug,owner:,copy:,manifest:,name:,suite:,image:,proposed"
+getopt_out=$(getopt --name "${0##*/}" \
+    --options "${short_opts}" --long "${long_opts}" -- "$@") &&
+    eval set -- "${getopt_out}" ||
+    bad_Usage
+
+arch_types="amd64 i386"
+finaldir="/tmp/live-build-$(date +%Y%m%d)_$(uuidgen)" # This is usually overriden at runtime
+debug="0"
+owner=""
+copy_final=""
+manifest=""
+imagename="root.img"
+proposed=
+live_path="${LIVE_BUILD_PATH}"
+
+while [ $# -ne 0 ]; do
+   case $1 in
+           --arch)         arch_types="$2";     shift;;
+           --dest)         finaldir="$2";       shift;;
+        -d|--debug)        debug=1;             shift;;
+           --owner)        owner="$2";          shift;;
+           --manifest)     manifest="$2";       shift;;
+           --copy)         copy_final="$2";     shift;;
+           --name|--suite) suite="$2";          shift;;
+           --image)        imagename="$2";      shift;;
+           --proposed)     proposed=1;          shift;;
+
+        -h|--help) Usage; exit 0;;
+        --) shift; break;;
+    esac
+    shift;
+done
+
+#Done setting options
+
+set -x
+
+# umount_r(mp) : unmount any filesystems under r
+#  this is useful to unmount a chroot that had sys, proc ... mounted
+umount_r() {
+    local p
+    for p in "$@"; do
+        [ -n "$p" ] || continue
+        tac /proc/mounts | sudo sh -c '
+            p=$1
+            while read s mp t opt a b ; do
+                [ "${mp}" = "${p}" -o "${mp#${p}/}" != "${mp}" ] ||
+                    continue
+                umount "$mp" || exit 1
+            done
+            exit 0' umount_r "${p%/}"
+        [ $? -eq 0 ] || return
+    done
+}
+
+get_owner_chown_opts() {
+    local owner="$1" opts="${owner}:"
+    shift;
+    if [ -z "${owner}" -a -n "${SUDO_UID}" ]; then
+        opts="${SUDO_UID}:${SUDO_GID}"
+    elif [ -z "${owner}" -a -n "${SUDO_USER}" ]; then
+        opts="${SUDO_USER}:$(id ${SUDO_USER} -g)"
+    elif [ -n "${owner}" ]; then
+        opts="$(id -u ${owner}):$(id -g ${owner})"
+    else
+        opts="$(id -u):$(id -g)"
+    fi
+    _RET=${opts}
+    return
+}
+
+builder() {
+    #Run live-build. Hopefully this works
+    local base_d=${1} arch="${2}" imagename="${3}" out_d="${4}"
+    local chown_opts=${5} copy_final=${6}
+    local ret=0
+
+    debug "Running builder"
+    debug "  builder1) Image will be named ${imagename}"
+    debug "  builder1) Building for ${arch}"
+    debug "  builder1) build location is ${base_d}"
+
+    cmd=("$(dirname "$(readlink -f "${0}")")/livefs-build.py"
+            ${proposed:+--proposed}
+            --livefs-name cpc
+            --suite "${suite}"
+            --arch "${arch}"
+            --image-format ext4
+            --project ubuntu-cpc
+            --cred-location /.lp_creds
+        )
+
+    # Only use the PPA for versions before wily
+    if dist_le "${suite}" vivid; then
+        cmd+=(--archive ppa:cloud-images-release-managers/cloud-image-tooling)
+    fi
+
+    # Xenial builds are failing due to disk types
+    if dist_ge "${suite}" xenial; then
+        cmd+=(--archive ppa:cloud-images-release-managers/cloud-image-tooling)
+    fi
+
+    "${cmd[@]}"; ret=$?
+
+    # if live-build failed, return failure
+    [ ${ret} -eq 0 ] || { error "live-build failed"; return $ret; }
+    mv "ubuntu-${suite}-core-cloudimg-${arch}.ext4" "${base_d}/binary-raw.img"
+    mv "ubuntu-${suite}-core-cloudimg-${arch}.manifest" "${base_d}/binary.packages"
+    gunzip < build_log.txt.gz > "/tmp/launchpad_build_log.txt"
+
+    # Move the image into place
+    [ -e "${base_d}/binary-raw.img" ] ||
+        { error "binary-raw.img did not exist in output directory"; return 1; }
+    mv "${base_d}/binary-raw.img" "${out_d}/${imagename}"
+
+    if [ ! -z "${copy_final}" ]; then
+        cp "${base_d}/binary-raw.img" "${copy}"
+        debug "  builder3) Copied final image to ${copy_final}"
+    fi
+
+    debug "  builder3) Binary cloud image can be found at ${out_d}/${imagename}"
+
+    # Pull out the binary.packages
+    if [ -e "${base_d}/binary.packages" ]; then
+        cp "${base_d}/binary.packages" "${manifest}" || fail "Unable to copy ${base_d}/binary.packages to ${manifest}"
+        sed -i "s|\t| |g" "${manifest}" || fail "Unable to normalize format of manifest file"
+    else
+        error "  builder3) !! ERROR !! Unable to find manifest"
+    fi
+
+    # Clean up after ourselves
+    if [ -n "${chown_opts}" ]; then
+        sudo chown -R "${chown_opts}" "${base_d}" "${out_d}" ||
+            { error "failed to change ownership to ${owner}" ; return 1; }
+    fi
+
+}
+
+# get the owner chmod opts set up
+get_owner_chown_opts "$owner"
+chown_opts=${_RET}
+CHOWN_OPTS=${chown_opts}
+
+trap cleanup EXIT
+if [ ! -d "${finaldir}" ]; then
+    mkdir -p "${finaldir}" 2> /dev/null || fail "UNABLE TO CREATE FINAL DIR ${finaldir}"
+fi
+TEMP_D=$(mktemp -d "${finaldir}/build-lb-tmpd.XXXXXX")
+
+FINAL_DIR="${finaldir}"
+
+for arch in ${arch_types}
+do
+    work_d="${TEMP_D}/$arch"
+    mkdir -p "${work_d}"
+
+    builder "${work_d}" "${arch}" "${imagename}" "${finaldir}" \
+        "${chown_opts}" "${copy_final}" ||
+        fail "failed to build for ${suite}"
+
+    rm -Rf "${work_d}" || fail "Unable to clean ${temp_d}"
+done
+
+# Cleanup
+cleanup && TEMP_D="" && FINAL_DIR="" && CHOWN_OPTS="" ||
+    fail "failed to cleanup"
+
+debug "Images and logs can be found at "${finaldir}""

=== added file 'build-ec2-image'
--- build-ec2-image	1970-01-01 00:00:00 +0000
+++ build-ec2-image	2016-03-22 02:54:49 +0000
@@ -0,0 +1,523 @@
+#!/bin/bash
+# vi: ts=4 noexpandtab
+umask 022
+cmd_args=$*
+base_d=$(dirname $(readlink -f "${0}"))
+
+SKIP_FINISH=0
+serial=""
+TEMP_D=""
+
+error() { echo "$@" 1>&2; }
+debug() { error "$(date -R):" "$@"; }
+cleanup() {
+		[ "${preserve_image}" = "1" -o -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+cat_partfile() {
+	# Note: this function may be overwritten in a config file
+	local arch=${1} size=${2}
+	if [ "${arch}" = "i386" ]; then
+		printf "%s\n%s\n%s\n" "root ${size} a1" \
+			"/mnt 1 a2" "swap 1024 a3"
+	else
+		printf "%s\n%s\n" "root ${size} a1" "/mnt 1 b"
+	fi
+}
+
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} config output_d
+   build according to config, putting output in output_d
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+# optional_file(filename,directory_src,target)
+#  if filename is non-empty, copy it from directory_src to target
+#  return in _RET the target
+#  if filename is empty, return true, but _RET as empty.
+optional_file() {
+	local fname="$1" src_d=${2} targ=${3}
+	[ -n "${fname}" ] || { _RET=""; return 0; }
+	cp "${src_d}/${fname}" "${targ}" && _RET=${targ} && return 0
+	return 1
+}
+
+short_opts="h"
+long_opts="help,skip-finish,serial:,proposed,hwe"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+skip_gen_image=""
+preserve_image=0
+proposed=0
+hwe=0
+
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-h|--help) Usage; exit 0;;
+		   --serial) serial=$2; shift;;
+		   --skip-finish) SKIP_FINISH=1;;
+		   --image) skip_gen_image=$1;;
+		   --preserve) preserve_image=1;;
+		   --proposed) proposed=1;;
+		   --hwe) hwe=1;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+[ $# -eq 2 ] || bad_Usage "must supply config and output dir"
+
+conf=${1}
+pub_d=${2}
+
+[ -f "${conf}" ] || fail "${conf}: not a file"
+
+owner=${USER}
+suite=""
+build_name=""
+description=""
+copy_out_kernels=1
+unpublished_ramdisks=""
+publish_ec2=1
+fail_on_missing_kernels=1
+root_fs_size="2048"
+root_fs_label=""
+loader=""
+floppy=""
+ovf_create=0
+ovf_cmd=( )
+ova_create=0
+ova_cmd=( )
+package_img_tgz=1
+create_root_tgz=0
+purge_roottgz_pkgs=( )
+
+. "${conf}"
+
+[ -n "${arches}" ] || arches="${img_arches}"
+
+for x in suite build_name description; do
+	[ -n "${!x}" ] || fail "${x} is not defined in ${conf}"
+done
+
+VMBUILDER=$(which vmbuilder 2>/dev/null) || fail "cannot find vmbuilder"
+LBBUILD=$(which build-lb-ec2-image 2> /dev/null ) || fail "cannont find build-lb-ec2-image"
+BUILDD_BUILD=$(which build-buildd-image 2> /dev/null) || fail "cannot find build-buildd-image"
+
+{ [ -d "${pub_d}" ] || mkdir -p "${pub_d}"; } ||
+	fail "failed to make ${pub_d}"
+
+TEMP_D=$(mktemp -d ${pub_d}/.${0##*/}.tmp.XXXXXX) ||
+	fail "failed to make tempd"
+
+trap cleanup EXIT
+
+chownperms=$(printf "%s:%s" "$(id -u)" "$(id -g)")
+
+unpacked_d="${pub_d}/unpacked"
+mkdir -p "${unpacked_d}" || fail "failed to make ${unpacked_d}"
+ovf_d="${pub_d}"
+if [ ${ovf_create:-0} -ne 0 -o ${ova_create:-0} -ne 1 ]; then
+	mkdir -p "${ovf_d}" || fail "failed to make ovf/ova dir ${ovf_d}"
+fi
+
+for arch in ${arches}
+do
+
+	name_prefix="${suite}-${build_name}-cloudimg"
+	img_base="${name_prefix}-${arch}"
+	tmpdest="${pub_d}/tmp-${img_base}"
+
+	# set variables read by copy-out-kernels
+	klist=""
+
+	partfile=${TEMP_D}/partfile.${arch}
+	cat_partfile "${arch}" "${root_fs_size}" > "${partfile}" ||
+		fail "failed to write partfile: cat_partfile $arch $root_fs_size"
+
+	# expose certain variables to the execscript
+	# this could also be done through sudo -E, but this just
+	# seems more reliable
+	execscript="${TEMP_D}/execscript"
+	{
+		spin=
+		printf "#!/bin/bash\n"
+		for v in suite serial build_name root_fs_label; do
+			printf "%s='%s'\n" "$v" "${!v}"
+		done
+		printf "\n"
+		cat "${base_d}/vmbuilder-cloudimg-fixes"
+	} > "${execscript}"
+	chmod 755 "${execscript}"
+
+	kinfo="${img_base}-kernel-info.txt"
+	image="${img_base}.img"
+
+
+	# Use old scripts for Natty and older, and new for Oneiric and later
+	if [ "${suite}" \< "oneiric" -o "${BUILDER}" = "vmbuilder" ]
+	then
+		cmdline=(
+		   ${VMBUILDER} xen ubuntu
+		   "--suite=${suite}"
+		   "--arch=${arch}"
+		   "--dest=${tmpdest}"
+		   --ec2
+		   "--ec2-version=${description}"
+		   --components main,restricted,universe,multiverse
+		   --part "${partfile}"
+		   --ec2-landscape --lock-user
+		   "--manifest=${tmpdest}/${img_base}.manifest"
+		   "--tmp=${TMPDIR:-/tmp}"
+		   --execscript "${execscript}"
+		   --debug "${vmb_addargs[@]}" )
+	elif [ "${suite}" \< "v" -o "${BUILDER}" = "live-build" ]
+	then
+		cmdline=(
+			${LBBUILD}
+			"--suite=${suite}"
+			"--arch=${arch}"
+			"--dest=${tmpdest}"
+			"--image=root.img"
+			"--part=${partfile}"
+			"--rootlabel=${root_fs_label}"
+			"--rootsize=${root_fs_size}"
+			"--owner=${owner}"
+			"--manifest=${tmpdest}/${img_base}.manifest"
+			"--livepath=${LIVE_BUILD_PATH}"
+			"--serial=${serial}"
+			"--hookscript=${execscript}"
+			"--ec2-version=${description}"
+			"--type=${build_type:-server}"
+			"--config=${conf}"
+		 )
+	elif [ "${suite}" \> "u" -o "${BUILDER}" = "buildd" ]
+	then
+		cmdline=(
+			${BUILDD_BUILD}
+			"--suite=${suite}"
+			"--arch=${arch}"
+			"--dest=${tmpdest}"
+			"--image=root.img"
+			"--owner=${owner}"
+			"--manifest=${tmpdest}/${img_base}.manifest"
+		 )
+	fi
+
+	# Allow building from propopsed
+	[ "${proposed:-0}" -eq 1 ] && cmdline+=('--proposed')
+
+	debug "invoking ${cmdline[*]}"
+
+	if [ -z ${skip_gen_image} ]; then
+		sudo env "PATH=$PATH" "${cmdline[@]}" ||
+			fail "image generation command failed: ${cmdline[*]}";
+	else
+		sudo cp ${skip_gen_image} ${tmpdest} ||
+			fail "unable to copy ${skip_gen_image} to ${tmpdest}";
+	fi
+
+	if [ "${suite}" \> "v" -o "${BUILDER}" = "buildd" ]; then
+		sudo env "PATH=$PATH" mount-image-callback "${tmpdest}/root.img" -- \
+			write-versions _MOUNTPOINT_ "${build_type:-server}" "${serial}" \
+			"${description}"
+	fi
+
+	if [ ${copy_out_kernels} -ne 0 ]; then
+		debug "${img_base}: copying out kernels"
+		sudo env "PATH=$PATH" mount-image-callback \
+			--read-only "${tmpdest}/root.img" -- copy-out-kernels \
+			${unpublished_ramdisks:+"--skip-ramdisks=${unpublished_ramdisks}"} \
+			--chown ${chownperms} \
+			_MOUNTPOINT_ "${tmpdest}" \
+			"${tmpdest}/${kinfo}" "${img_base}-" ||
+			fail "failed copy out kernels"
+
+		[ "$fail_on_missing_kernels" = "0" -o -s "${tmpdest}/${kinfo}" ] ||
+			fail "no kernels found"
+	fi
+
+	if [ ${create_root_tgz} -ne 0 ]; then
+		debug "${img_base}: creating root tarball"
+		rpurgeopts=()
+		for purgeopt in "${purge_roottgz_pkgs[@]}"; do
+			rpurgeopts[${#rpurgeopts[@]}]="--purge=${purgeopt}"
+		done
+		if [ "${#rpurgeopts[@]}" -eq 0 ]; then
+			# img2roottgz will mount 'ro' if no packages given
+			ln -sf "$tmpdest/root.img" "$tmpdest/root.img.copy" ||
+				fail "oddly failed to create symlink to $root.img.copy"
+		else
+			cp --sparse=always "${tmpdest}/root.img" \
+				"${tmpdest}/root.img.copy" ||
+			fail "failed copy of root img before img2roottgz"
+		fi
+		sudo env "PATH=$PATH" img2roottgz "${rpurgeopts[@]}" \
+			"${tmpdest}/root.img.copy" "${pub_d}/${img_base}-root.tar.gz" ||
+			fail "failed to run img2roottgz"
+		rm -f "$tmpdest/root.img.copy"
+
+		gzip -dc "${pub_d}/${img_base}-root.tar.gz" | 
+			xz > "${pub_d}/${img_base}-root.tar.xz" ||
+			fail "failed to create xz-compressed root.tar"
+
+		sudo env PATH=$PATH serial=$serial arch=$arch suite=$suite \
+			lxd_metadata "${pub_d}/${img_base}-lxd.tar.xz" ||
+			fail "failed to create LXD metadata for root.tar"
+	fi
+
+	rootimg="${tmpdest}/root.img"
+
+	# Zero out the free space, to make the image smaller
+	zerofree ${rootimg}
+	sync
+
+	if [ -n "${root_fs_label}" ]; then
+		e2label "${rootimg}" "${root_fs_label}" ||
+			fail "failed to add label ${root_fs_label} to ${rootimg}"
+	fi
+
+	debug "${img_base}: moving files produced by vmbuilder"
+	mv "${rootimg}" "${tmpdest}/${img_base}.img" ||
+		fail "failed to move root.img to ${img_base}"
+
+	[ "${SKIP_FINISH:-0}" = "0" ] || continue
+
+	# move all files to 'unpacked' dir
+	mv ${tmpdest}/${img_base}*  "${unpacked_d}/" ||
+		fail "failed to move files to ${unpacked_d}"
+
+	addl_tarmembers=""
+
+	opt_ldrs=""
+	# 'loader' could have a '%a' in it which would be replaced by arch
+	optional_file "${loader//%a/${arch}}" "${base_d}/loaders" \
+		"${unpacked_d}/${img_base}-loader" &&
+		{ [ -z "${_RET}" ] || opt_ldrs="${opt_ldrs} ${_RET##*/}"; } ||
+		fail "failed to copy optional loader"
+
+	optional_file "${floppy//%a/${arch}}" "${base_d}/loaders" \
+		"${unpacked_d}/${img_base}-floppy" &&
+		{ [ -z "${_RET}" ] || opt_ldrs="${opt_ldrs} ${_RET##*/}"; } ||
+		fail "failed to copy optional floppy"
+
+	# get a list of non-ec2 kernels in unpacked_d
+	if [ -s "${unpacked_d}/${kinfo}" -o -n "${opt_ldrs}" ]; then
+		addl_tarmembers=$( cd "${unpacked_d}" ; out="";
+			for f in ${img_base}*initrd* ${img_base}*vmlinu* ${opt_ldrs}; do
+				[ -f "${f}" -a "${f##*-ec2}" = "${f}" ] || continue
+				out="${out} ${f}"
+			done
+			[ -z "${out}" ] || echo "${out}"
+		)
+	fi
+
+	debug "${img_base}: creating tarfiles"
+
+	( cd "${unpacked_d}" && tar \
+		-S --use-compress-program=gzip-rsyncable \
+		-cf "${pub_d}/${img_base}.tar.gz" "${image}" ${addl_tarmembers} \
+		-C "${base_d}" README.files ) ||
+		fail "failed to create ${pub_d}/${img_base}.tar.gz"
+
+	if [ "${package_img_tgz:-0}" != "0" ]; then
+		debug "${img_base}: creating unpacked tarfile"
+		( cd "${unpacked_d}" && tar \
+			-S --use-compress-program=gzip-rsyncable \
+			-cf "${img_base}.img.tar.gz" "${image}" ) ||
+			fail "failed to create ${img_base}.img.tar.gz in ${unpacked_d}"
+	fi
+
+	# split up the image creatiom. Before this was done with part2ovf. However with the introduction
+    # of armel and qemu images, the creation of disk images seperate from an OVF container is needed
+
+	# create raw paritioned disk
+	disk_img="${pub_d}/${img_base}-filesystem.img"
+	if [ "${qcow2_create:-0}" -ne 0 -o "${vmdk_create:-0}" -ne 0 -o \
+		 "${ovf_create:-0}" -ne 0 -o "${raw_img:-0}" -ne 0 -o \
+		 "${qemu_img:-0}" -ne 0 -o "${ova_create:-0}" ]; then
+	    debug "creating raw partitioned disk image"
+		part2disk_opts="-v"
+        [ "${nogrub:-0}" -ne 1 ] && part2disk_opts="${part2disk_opts} -G"
+		part2disk="${base_d}/ovf/part2disk"
+		# Certain arches need their own handling
+		[[ "${arch}" =~ ppc64el ]] && part2disk="${part2disk}.${arch}"
+		part2cmd="${part2disk} --size=${img_size} ${part2disk_opts} ${unpacked_d}/${image} ${disk_img}"
+	    debug "  cmd: ${part2cmd}"
+		$part2cmd || fail "failed to run part2cmd: ${part2cmd}"
+	fi
+
+	# create qemu images
+	if [ "${qemu_img:-0}" -ne 0 ]; then
+	    cmd=( "${qemu_img_cmd[@]}" )
+		# %d- > base_dir, %o -> pub dir, %i -> final image, %r -> root fs
+		cmd=( "${cmd[@]//%d/${base_d}}" )
+		cmd=( "${cmd[@]//%r/${disk_img}}" )
+		cmd=( "${cmd[@]//%i/${img_base}}" )
+		cmd=( "${cmd[@]//%o/${pub_d}}" )
+		cmd=( "${cmd[@]//%l/${root_fs_label}}" )
+
+        debug "creating qemu/metal disk image with ${cmd[@]}"
+        ${cmd[@]} ||
+             fail "failed to run qemu_img_cmd: ${cmd[@]}"
+	fi
+
+	ovf_disks=""
+	disk_out="${pub_d}/${img_base}-disk1"
+	# create img files
+	if [ "${qcow2_create:-0}" -ne 0 ]; then
+		qcow_cmd="${base_d}/ovf/part2img --type qcow2 --source ${disk_img} --target ${disk_out} --extension img"
+		debug "creating qcow2 from partitioned ${disk_img} to ${disk_out}.img"
+		$qcow_cmd || fail "failed to run qcow_cmd: ${qcow_cmd}"
+		[ "${qcow2_ovf:-0}" -eq 1 ] && { ovf_disks="${ovf_disks} img"; debug "qcow OVF queued for creation"; }
+		[ "${ovf_default:-vmdk}" = "qcow2" ] && ovf_default="img"
+	fi
+
+	# create vmdk image
+	if [ "${vmdk_create:-0}" -ne 0 ]; then
+		vmdk_cmd="${base_d}/ovf/part2img --type vmdk --source ${disk_img} --target ${disk_out}"
+		debug "creating vmdk from partitioned ${disk_img} to ${disk_out}.vmdk"
+		$vmdk_cmd || fail "failed to run vmdk_cmd: ${vmdk_cmd}"
+		[ "${vmdk_ovf:-0}" -eq 1 ] && { ovf_disks="${ovf_disks} vmdk"; debug "vmdk OVF queue for creation"; }
+	fi
+
+	# UEFI boot paths only work for {arm,amd}64
+	if [[ "${arch}" =~ (amd64|arm64) ]]; then
+		uefi_disk_out="${pub_d}/${img_base}-uefi1"
+
+		# create raw UEFI/BIOS/GPT partitioned disk
+		uefi_img="${pub_d}/${img_base}-uefi.img"
+		if [ "${qcow2_uefi_create:-0}" -ne 0 -o ${vmdk_uefi_create:-0} -ne 0 ]; then
+			debug "creating raw UEFI disk image"
+			part2cmd_base="${base_d}/ovf/part2disk-gpt.${arch}"
+			part2cmd="${part2cmd_base} --size=${img_size} ${part2disk_opts} ${unpacked_d}/${image} ${uefi_img}"
+			debug "   cmd: ${part2cmd}"
+			$part2cmd || fail "failed to run part2cmd: ${part2cmd}"
+		fi
+
+		# create UEFI qcow's
+		if [ "${qcow2_uefi_create:-0}" -ne 0 ]; then
+			qcow_cmd="${base_d}/ovf/part2img --type qcow2 --source ${uefi_img} --target ${uefi_disk_out} --extension img"
+			debug "creating qcow2 from UEFI partitioned ${uefi_img} to ${uefi_disk_out}.img"
+			$qcow_cmd || fail "failed to run qcow_cmd: ${qcow_cmd}"
+			[ "${qcow2_ovf:-0}" -eq 1 ] && { ovf_disks="${ovf_disks} img"; debug "qcow OVF queued for creation"; }
+			[ "${ovf_default:-vmdk}" = "qcow2" ] && ovf_default="img"
+		fi
+
+		# create UEFI vmdk's
+		if [ "${vmdk_uefi_create:-0}" -ne 0 ]; then
+			qcow_cmd="${base_d}/ovf/part2img --type vmdk --source ${uefi_img} --target ${uefi_disk_out}"
+			debug "creating vmdk from UEFI partitioned ${uefi_img} to ${uefi_disk_out}.vmdk"
+			$qcow_cmd || fail "failed to run qcow_cmd: ${qcow_cmd}"
+			[ "${qcow2_ovf:-0}" -eq 1 ] && { ovf_disks="${ovf_disks} img"; debug "qcow OVF queued for creation"; }
+			[ "${ovf_default:-vmdk}" = "qcow2" ] && ovf_default="img"
+		fi
+
+		[ "${raw_disk:-0}" -ne 0 ] || {	[ -e "${uefi_img}" ] && rm ${uefi_img}; }
+	fi
+
+	# GPT/PReP images for ppc64el
+	if [ "${arch}" == "ppc64el" ]; then
+		gpt_disk_out="${pub_d}/${img_base}-disk1"
+
+		# create raw GPT partitioned disk
+		gpt_img="${pub_d}/${img_base}-gpt.img"
+		if [ "${qcow2_gpt_create:-0}" -ne 0 -o ${vmdk_gpt_create:-0} -ne 0 ]; then
+			debug "creating raw GPT disk image"
+			part2cmd="${base_d}/ovf/part2disk-gpt.ppc64el --size=${img_size} ${part2disk_opts} ${unpacked_d}/${image} ${gpt_img}"
+			debug "   cmd: ${part2cmd}"
+			$part2cmd || fail "failed to run part2cmd: ${part2cmd}"
+		fi
+
+		# create GPT qcow's
+		if [ "${qcow2_gpt_create:-0}" -ne 0 ]; then
+			qcow_cmd="${base_d}/ovf/part2img --type qcow2 --source ${gpt_img} --target ${gpt_disk_out} --extension img"
+			debug "creating qcow2 from GPT/PReP partitioned ${gpt_img} to ${gpt_disk_out}.img"
+			$qcow_cmd || fail "failed to run qcow_cmd: ${qcow_cmd}"
+			[ "${qcow2_ovf:-0}" -eq 1 ] && { ovf_disks="${ovf_disks} img"; debug "qcow OVF queued for creation"; }
+			[ "${ovf_default:-vmdk}" = "qcow2" ] && ovf_default="img"
+		fi
+
+		# create GPT vmdk's
+		# XXX UNTESTED
+		if [ "${vmdk_gpt_create:-0}" -ne 0 ]; then
+			qcow_cmd="${base_d}/ovf/part2img --type vmdk --source ${gpt_img} --target ${gpt_disk_out}"
+			debug "creating vmdk from GPT partitioned ${gpt_img} to ${gpt_disk_out}.vmdk"
+			$qcow_cmd || fail "failed to run qcow_cmd: ${qcow_cmd}"
+			[ "${qcow2_ovf:-0}" -eq 1 ] && { ovf_disks="${ovf_disks} img"; debug "qcow OVF queued for creation"; }
+			[ "${ovf_default:-vmdk}" = "qcow2" ] && ovf_default="img"
+		fi
+
+		[ "${raw_disk:-0}" -ne 0 ] || {	[ -e "${gpt_img}" ] && rm ${gpt_img}; }
+	fi
+
+	# create the OVA container
+	if [ "${ova_create:-0}" -eq 1 ]; then
+		prefix="${img_base}"
+		debug "Creating OVA for ${disk_name}"
+		debug "    OVA Filename: ${ovf_d}/${prefix}.ova"
+		cmd=( "${ova_cmd[@]}" )
+		cmd=( "${cmd[@]//%d/${base_d}}" )
+		cmd=( "${cmd[@]//%o/${ovf_d}}" )
+		cmd=( "${cmd[@]//%p/${prefix}}" )
+		cmd=( "${cmd[@]//%r/${disk_img}}" )
+		cmd=( "${cmd[@]//%s/${img_size}}" )
+
+		debug "creating ova with ${cmd[@]}"
+		"${cmd[@]}" || 	fail "failed to run ova_cmd: ${cmd[@]}"
+		sudo chown -R "$(id -u):$(id -g)" "${ovf_d}"
+		chmod go+r "${ovf_d}/"*
+		touch "${ovf_d}/"*
+	fi
+
+	# create OVF containers
+	for disk_type in ${ovf_disks}; do
+		[ "${ovf_default:-vmdk}" = "${disk_type}" ] &&
+			prefix="${img_base}" ||
+			prefix="${img_base}-${disk_type}"
+		disk_name="${img_base}-disk1.${disk_type}"
+
+		debug "Creating OVF for ${disk_type} disk: ${disk_name}"
+		debug "    OVF Filename: ${ovf_d}/${prefix}.ovf"
+
+		cmd=( "${ovf_cmd[@]}" )
+		cmd=( "${cmd[@]//%o/${ovf_d}}" )
+		cmd=( "${cmd[@]//%i/${unpacked_d}/${image}}" )
+		cmd=( "${cmd[@]//%d/${base_d}}" )
+		cmd=( "${cmd[@]//%p/${prefix}}" )
+		cmd=( "${cmd[@]//%r/${disk_name}}" )
+		cmd=( "${cmd[@]//%s/${img_size}}" )
+		cmd=( "${cmd[@]//%t/${disk_type}}" )
+
+		debug "creating ovf with ${cmd[@]}"
+		"${cmd[@]}" || 	fail "failed to run ovf_cmd: ${cmd[@]}"
+		sudo chown -R "$(id -u):$(id -g)" "${ovf_d}"
+		chmod go+r "${ovf_d}/"*
+		touch "${ovf_d}/"*
+	done
+
+	[ "${raw_disk:-0}" -ne 0 ] || {	[ -e "${disk_img}" ] && rm ${disk_img}; }
+
+	{ [ "${copy_out_kernels}" -eq 0 ] ||
+	  cp "${unpacked_d}/${kinfo}" "${pub_d}"; } &&
+		cp "${unpacked_d}/${img_base}.manifest" "${pub_d}" ||
+			fail "failed to copy kinfo and manifest"
+
+	[ -e "${unpacked_d}/${img_base}.img" ] && {
+			rm "${unpacked_d}/${img_base}.img" ||
+				fail "failed deletion of ${img_base}.img";
+		}
+
+	if [ "${preserve_image}" = 0 ]; then
+		rm -rf "${tmpdest}" || fail "failed to delete ${tmpdest}"
+	fi
+
+done
+
+exit 0

=== added file 'build-lb-ec2-image'
--- build-lb-ec2-image	1970-01-01 00:00:00 +0000
+++ build-lb-ec2-image	2016-03-22 02:54:49 +0000
@@ -0,0 +1,375 @@
+#!/bin/bash
+# vi: ts=4 noexpandtab
+
+## Copyright (C) 2011 Ben Howard <ben.howard@xxxxxxxxxxxxx> and Scott Moser <smoser@xxxxxxxxxxxxx>
+## Date: 01 July 2011
+##
+## Script for doing builds with live-build system in an automated fashion
+## This comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+## This is free software, and you are welcome to redistribute it
+## under certain conditions; see copyING for details.
+base_d=$(dirname $(readlink -f "${0}"))
+TEMP_D=""
+FINAL_DIR=""
+CHOWN_OPTS=""
+
+error() { echo "$@" 1>&2; }
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+debug() { error "$(date -R):" "$@"; }
+cleanup() {
+    if [ -n "${TEMP_D}" -a -d "${TEMP_D}" ]; then
+        umount_r "${TEMP_D}" && rm -rf "${TEMP_D}" || return 1
+    fi
+    if [ -n "${FINAL_DIR}" -a -d "${FINAL_DIR}" -a -n "${CHOWN_OPTS}" ]; then
+        chown -R "${CHOWN_OPTS}" "${FINAL_DIR}"
+    fi
+}
+
+usage() {
+cat << EOF
+Live-Build Control Script
+    Uses customized live build to produce Cloud Images
+
+    Required Flags:
+    --config    Config
+
+    Optional
+        --arch      Arch type, i.e. amd64 or i386, default all
+        --dest      Directory to put the final image
+        --image     What to name the image, defaults to root.img
+        --rootlabel Over-ride configuration default name for rootfs label.
+        --rootsize  Size of root fs in MM
+        --owner     Set the owner of the resulting files
+        --copy      Copy the final image for debugig to location
+        --manifest  Where to drop the manfiest file
+        --livepath  Location of live-build scripts
+        --serial    image serial number, defaults to YYYYMMDD
+        --hookscript Add a script to hooks script section
+        --ec2-version Destription of EC2 image
+        --propsoed  Build from propoposed
+EOF
+}
+
+# Parse options
+
+short_opts="d,l,h"
+long_opts="arch:,dest:,part:,debug,owner:,copy:,manifest:,name:,suite:,version:,type:,rootlabel:,moniker:,image:,rootsize:,livepath:,serial:,hookscript:,ec2-version:,config:,proposed"
+getopt_out=$(getopt --name "${0##*/}" \
+    --options "${short_opts}" --long "${long_opts}" -- "$@") &&
+    eval set -- "${getopt_out}" ||
+    bad_Usage
+
+arch_types="amd64 i386"
+finaldir="/tmp/live-build-$(date +%Y%m%d)_$(uuidgen)" # This is usually overriden at runtime
+host_lsb_release=$(lsb_release -c -s)
+partfile=""
+debug="0"
+partfile=""
+owner=""
+copy_final=""
+manifest=""
+version=""
+plist=""
+build_type="server"
+imagename="root.img"
+description=""
+distribution_override=""
+root_label=""
+root_size=""
+hookscript=""
+config=""
+proposed=0
+serial=$(date +%Y%m%d)
+live_path="${LIVE_BUILD_PATH}"
+
+while [ $# -ne 0 ]; do
+   case $1 in
+           --config)       config="$2";         shift;;
+           --arch)         arch_types="$2";     shift;;
+           --dest)         finaldir="$2";       shift;;
+           --part)         partfile="$2";       shift;;
+        -d|--debug)        debug=1;             shift;;
+           --owner)        owner="$2";          shift;;
+           --manifest)     manifest="$2";       shift;;
+           --copy)         copy_final="$2";     shift;;
+           --name|--suite) suite="$2";          shift;;
+           --version)      version="$2";        shift;;
+           --type)         build_type="$2";     shift;;
+           --rootlabel)    root_label="$2";     shift;;
+           --moniker)      moniker="$2";        shift;;
+           --image)        imagename="$2";      shift;;
+           --rootsize)     root_size="$2";      shift;;
+           --livepath)     live_path="$2";      shift;;
+           --serial)       serial="$2";         shift;;
+           --hookscript)   hookscript="$2";     shift;;
+           --ec2-version)  description="$2";    shift;;
+           --proposed)     proposed=1;          shift;;
+
+        -h|--help) Usage; exit 0;;
+        --) shift; break;;
+    esac
+    shift;
+done
+
+#Done setting options
+
+if [ "${debug}" != "0" ]; then
+   set -x
+fi
+
+### INITIALIZATION
+lb_config_src_loc="$(dirname $(readlink -f "${0}"))/live-config"
+
+[ -n "${live_path}" ] || fail "must specify --livepath or set LIVE_BUILD_PATH environment"
+[ -d "${live_path}" ] || fail "live_path: not a directory [$live_path]"
+
+
+[ -n "${config}" ] || fail "must provide configuratoin file"
+[ -e "${config}" ] || fail "configuration file does not exist"
+
+. ${config}
+
+# umount_r(mp) : unmount any filesystems under r
+#  this is useful to unmount a chroot that had sys, proc ... mounted
+umount_r() {
+    local p
+    for p in "$@"; do
+        [ -n "$p" ] || continue
+        tac /proc/mounts | sudo sh -c '
+            p=$1
+            while read s mp t opt a b ; do
+                [ "${mp}" = "${p}" -o "${mp#${p}/}" != "${mp}" ] ||
+                    continue
+                umount "$mp" || exit 1
+            done
+            exit 0' umount_r "${p%/}"
+        [ $? -eq 0 ] || return
+    done
+}
+
+pids_using() {
+    local ppids="" pids=""
+    for path in "$@"; do
+        pids=$(sudo lsof |
+            awk '( $9 == mp || $9 ~ mps ) { printf("%s ",$2); }' \
+                "mp=${path%/}" "mps=^${path%/}/" ) ||
+            return 1
+        pids=${pids% }
+        ppids="${ppids}${pids:+ ${pids}}"
+        ppids=${ppids# }
+    done
+    _RET=${ppids}
+}
+
+force_unuse_d() {
+    local d="$1" i=0 tries=10 pids=""
+    while pids_using "$d" && pids=${_RET} && [ -n "${pids}" ] &&
+        [ $i -lt $tries ] && i=$(($i+1)); do
+        error "killing pids occupying ${d}:"
+        sudo ps -p ${pids} 1>&2
+        sudo kill -9 ${pids}
+        sleep 2
+        pids=""
+    done
+    # if there are pids around, then we failed
+    [ -z "${pids}" ]
+}
+
+get_owner_chown_opts() {
+    local owner="$1" opts="${owner}:"
+    shift;
+    if [ -z "${owner}" -a -n "${SUDO_UID}" ]; then
+        opts="${SUDO_UID}:${SUDO_GID}"
+    elif [ -z "${owner}" -a -n "${SUDO_USER}" ]; then
+        opts="${SUDO_USER}:$(id ${SUDO_USER} -g)"
+    elif [ -n "${owner}" ]; then
+        opts="$(id -u ${owner}):$(id -g ${owner})"
+    else
+        opts="$(id -u):$(id -g)"
+    fi
+    _RET=${opts}
+    return
+}
+
+builder() {
+    #Run live-build. Hopefully this works
+    local base_d=${1} arch="${2}" imagename="${3}" out_d="${4}"
+    local chown_opts=${5} copy_final=${6}
+    local ret=0 start_d="$PWD"
+
+    debug "Running builder"
+    debug "  builder1) Image will be named ${imagename}"
+    debug "  builder1) Building for ${arch}"
+    debug "  builder1) build location is "${base_d}""
+
+    local lbb="${base_d}/live-build" lb_env="" lbcmd=""
+    lb_env=( "LB_BASE=${lbb}" "PATH=${lbb}/scripts/build:${PATH}"
+        "${lbb}/scripts/build/lb" build )
+    lb_cmd=( sudo "${lb_env[@]}" "${lbb}/scripts/build/lb" build )
+
+    debug "  builder2) cmd: " "${lb_cmd[@]}"
+    debug "  builder3) Starting build prcoess...this might take a while"
+
+    debug "  _______ LIVE-BUILD OUTPUT _______"
+    cd "${base_d}"
+    "${lb_cmd[@]}";  ret=$?
+    cd "${start_d}"
+    debug "  _______ END LIVE-BUILD OUTPUT _____"
+
+    if ! umount_r "${base_d}/chroot" "${base_d}/cloud"; then
+        error "failed to unmount directories under ${base_d}";
+        force_unuse_d "${base_d}/chroot" "${base_d}/cloud" &&
+            umount_r "${base_d}/chroot" "${base_d}/cloud" &&
+            error "  recovered via force_unuse_d"
+        return 1;
+    fi
+
+    # if live-build failed, return failure
+    [ ${ret} -eq 0 ] || { error "live-build failed"; return $ret; }
+
+    # Move the image into place
+    [ -e "${base_d}/binary-raw.img" ] ||
+        { error "binary-raw.img did not exist in output directory"; return 1; }
+    mv "${base_d}/binary-raw.img" "${out_d}/${imagename}"
+
+    if [ ! -z "${copy_final}" ]; then
+        cp "${base_d}/binary-raw.img" "${copy}"
+        debug "  builder3) Copied final image to ${copy_final}"
+    fi
+
+    debug "  builder3) Binary cloud image can be found at ${out_d}/${imagename}"
+
+    # Pull out the binary.packages
+    if [ -e "${base_d}/binary.packages" ]; then
+        cp "${base_d}/binary.packages" "${manifest}" || fail "Unable to copy ${base_d}/binary.packages to ${manifest}"
+        sed -i "s|\t| |g" "${manifest}" || fail "Unable to normalize format of manifest file"
+    else
+        error "  builder3) !! ERROR !! Unable to find manifest"
+    fi
+
+    # Clean up after ourselves
+    if [ -n "${chown_opts}" ]; then
+        sudo chown -R "${chown_opts}" "${base_d}" "${out_d}" ||
+            { error "failed to change ownership to ${owner}" ; return 1; }
+    fi
+
+}
+
+# get the owner chmod opts set up
+get_owner_chown_opts "$owner"
+chown_opts=${_RET}
+CHOWN_OPTS=${chown_opts}
+
+trap cleanup EXIT
+if [ ! -d "${finaldir}" ]; then
+    mkdir -p "${finaldir}" 2> /dev/null || fail "UNABLE TO CREATE FINAL DIR ${finaldir}"
+fi
+TEMP_D=$(mktemp -d "${finaldir}/build-lb-tmpd.XXXXXX")
+
+FINAL_DIR="${finaldir}"
+
+for arch in ${arch_types}
+do
+    work_d="${TEMP_D}/$arch"
+    conf_d="${work_d}/config"
+    mkdir -p "${work_d}"
+
+
+    # Dynamically configure LB
+    {
+        debug "Dynamically configuring live-build"
+        cd ${work_d}
+
+        lbb="${work_d}/live-build"
+        lbb_path="${lbb}/scripts/build"
+        mkdir -p "${lbb_path}"
+
+        rsync -a "${live_path}/" "${work_d}/live-build" ||
+            fail "failed to copy ${live_path}"
+
+        new_path="PATH=${live_path}/scripts/build:${PATH}"
+
+        # %d-> distro, %l-> hard disk label, %s-> size, %q-> qemu-static location
+        lbcmd=( "${lb_conf[@]}" )
+        lbcmd=( "${lbcmd[@]//%d/${suite}}")
+        lbcmd=( "${lbcmd[@]//%l/${root_fs_label}}")
+        lbcmd=( "${lbcmd[@]//%s/${root_fs_size}}")
+        lbcmd=( "${lbcmd[@]//%P/${lbb_path}}")
+        lbcmd=( "${lbcmd[@]//%L/${lbb}}")
+        lbcmd=( "${lbcmd[@]//%x/${new_path}}")
+        lbcmd=( "${lbcmd[@]//%A/${arch}}")
+
+		# Build the chroot from -proposed
+		[ "${proposed}" -eq 1 ] && lbcmd+=("--proposed=true")
+
+        # Discover qemu location and set it for arm images
+        [[ "${arch}" =~ (arm|arm64) ]] && {
+                case ${arch} in
+                        armel|armhf) q_arch="arm";;
+                        arm64) q_arch="aarch64";;
+                        *) q_arch="$arch";;
+                esac
+                debug "looking for qemu-${q_arch}-static"
+
+                [ -e "${HOME}/ec2-daily/qemu-static/${host_lsb_release}/qemu-${q_arch}-static" ] &&
+                qemu_exec="${HOME}/ec2-daily/qemu-static/${host_lsb_release}/qemu-${q_arch}-static" ||
+                [ -e "${lb_config_src_loc}/qemu-static/${host_lsb_release}/qemu-${q_arch}-static" ] &&
+                        qemu_exec="${lb_config_src_loc}/qemu-static/${host_lsb_release}/qemu-${q_arch}-static" ||
+                        qemu_exec="$(which qemu-${q_arch}-static)" ||
+                        fail "Unable to locate qemu-${q_arch}-static"
+
+                lbcmd=( "${lbcmd[@]//%q/${qemu_exec}}" )
+                debug "found ${qemu_exec}"
+                debug "debootstrap will be foreign"
+        }
+
+
+        debug "lb_config commmand is: ${lbcmd[@]}"
+        sudo "${lbcmd[@]}" ||
+            fail "Failed to dynammicaly configure live-build"
+
+    }
+
+    # Update ubuntu-cloud definition for precise
+    [ "${suite}" \< "precise" ] || {
+        echo "update-notifier-common" >> "${work_d}/live-build/package-lists/ubuntu-cloud" ||
+            fail "Unable append update-notifier-common to package definition"
+    }
+
+    # make config tempdir
+    rsync -a "${lb_config_src_loc}/common/"  "${conf_d}" ||
+        fail "failed to copy common hooks"
+
+    # seed directories
+    mkdir -p "${conf_d}/includes.chroot/etc/cloud"
+
+    # write build.info
+    echo "build_name: ${build_type}" >> "${conf_d}/includes.chroot/etc/cloud/build.info" &&
+        echo "serial: ${serial}"  >> "${conf_d}/includes.chroot/etc/cloud/build.info" ||
+            fail "Unable to write etc/cloud/build.info"
+
+    # write ec2-version
+    echo "${description}" >> "${conf_d}/includes.chroot/etc/ec2_version" ||
+        fail "Unable to write ${conf_d}/includes.chroot/etc/ec2_version"
+
+    [ -z "${hookscript}" ] || {
+        local_hook="${conf_d}/hooks/999hookscript.chroot"
+
+        cp -a "${hookscript}" "${local_hook}" ||
+            fail "Unable to copy ${hookscript} to ${local_hook}"
+
+        debug "Populated hookscript to: ${conf_d}/hooks"
+    }
+
+    builder "${work_d}" "${arch}" "${imagename}" "${finaldir}" \
+        "${chown_opts}" "${copy_final}" ||
+        fail "failed to build for ${suite}"
+
+    rm -Rf "${work_d}" || fail "Unable to clean ${temp_d}"
+done
+
+# Cleanup
+cleanup && TEMP_D="" && FINAL_DIR="" && CHOWN_OPTS="" ||
+    fail "failed to cleanup"
+
+debug "Images and logs can be found at "${finaldir}""

=== added file 'chroot_helper'
--- chroot_helper	1970-01-01 00:00:00 +0000
+++ chroot_helper	2016-03-22 02:54:49 +0000
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# For non-Intel builds (and building Intel on non-intel) we need the ability to
+# chroot into things. Proot is a package that allows you to use qemu without
+# having to put qemu-<ARCH>-static into the image.
+#
+
+# Bail if no proot, because the rest is not needed
+which proot >> /dev/null || exec chroot ${@};
+
+root_d=$(readlink -f ${1}); shift;
+cmd=(chroot)
+target_arch=$(file ${root_d}/bin/bash | awk -F',' '{print$2}')
+my_arch=$(uname -m)
+compat_arches=()
+
+case $target_arch in
+    *aarch64*)       compat_arches+=(aarch);
+                     qemu_static="qemu-aarch64-static";;
+    *ARM*|*arm*)     compat_arches+=(ARM arm);
+                     qemu_static="qemu-arm-static";;
+    *80386*|*686*)   compat_arches+=(386 686 x86_64);
+                     qemu_static="qemu-i386-static";;
+    *x86-64*)        compat_arches+=(x86_64);
+                     qemu_static="qemu-x86_64-static";;
+esac
+
+[[ "${compat_arches[@]}" =~ ${my_arch} ]] &&
+    unset qemu_static
+
+# Get the version of proot
+proot_version=$(dpkg-query -W proot | cut -f2)
+[ -z "${proot_version}" ] && proot_version=$(proot --version | awk '/3.0.?/{print"3"}')
+[ -n "${proot_version}" ] && proot_v="$(cut -f1 -d'.' <<< ${proot_version})"
+
+# Use proot for everything if its available.
+if [ -n "${proot_v}" ]; then
+    cmd=(proot -0 -w /)
+
+    if [ -n "${qemu_static}" -a -x "/usr/bin/${qemu_static}" ]; then
+        cmd+=(--qemu=${qemu_static})
+    fi
+
+    # support version specific proots
+    case ${proot_v} in
+        3) ;;
+        4|*) cmd+=(-S);;
+    esac
+fi
+
+# Now execute it and run
+exec "${cmd[@]}" "${root_d}" "${@}"

=== added file 'cloudimg-build-launcher'
--- cloudimg-build-launcher	1970-01-01 00:00:00 +0000
+++ cloudimg-build-launcher	2016-03-22 02:54:49 +0000
@@ -0,0 +1,340 @@
+#!/bin/bash
+# vi: ts=4 noexpandtab
+
+# these environment variables must be set
+env_vars="START_D PUBLISH_BASE"
+
+base_d=$(dirname $(readlink -f "${0}"))
+PATH="${base_d}:${PATH}"
+SKIP_PUBLISH=0
+WORK_D=""
+PUB_D=""
+OUT_D=""
+BUILDING_LOCK=""
+ARM_IMAGES=0
+ARCHS="amd64 i386"
+LOG_D=${LOG_D:-${START_D}/logs}
+LOG_OUT=""
+LOG_ERR=""
+FAIL=0
+DEBUG=0
+STD_OUT=1
+STD_ERR=2
+
+umask 022
+
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [ options ] config
+
+   run an ec2 build according to settings in config
+
+   -d | --debug           debug mode (output to stdout/stderr)
+   -s | --skip-publish    do not publish
+        --working-dir d   put build-ec2-image output in d (default tmpdir)
+                          if specified, it will not be deleted
+        --fake-only       quick-testing, only fake the long running commands
+EOF
+}
+bad_Usage() { Usage >&2; [ $# -eq 0 ] || fail "$@"; }
+error() { echo "$@" >&2; };
+debug() { 
+	local date=$(date -R)
+	error "${date}:" "$@"; 
+	# if stderr is a terminal and not --debug, send this there
+	[ "${DEBUG}" = "0" -a -t "${STD_ERR}" ] &&
+		echo "${date}" "${@}" >&${STD_ERR}
+}
+fail() { [ $# -eq 0 ] || error "$(date -R)" "$@"; FAIL=1; exit 1; }
+summary_file() {
+	local file=${1} head=${2:-20} tail=${2:-40}
+    local lines="" remain=""
+	lines=$(wc -l < "${file}")
+	if [ $lines -le $(($head+$tail)) ]; then
+		cat "${file}"
+	else
+		head -n "${head}" "${file}"
+		echo "lines=${lines} head=${head} tail=${tail}"
+		echo "... <<<< $((${lines}-${head}-${tail})) lines >>>>..."
+		tail -n "${tail}" "${file}"
+	fi
+}
+
+do_exit() {
+	[ -z "${WORK_D}" -a -n "${OUT_D}" ] && rm -Rf "${OUT_D}"
+	[ -z "${BUILDING_LOCK}" ] || rm -f "${BUILDING_LOCK}"
+
+	[ "${DEBUG}" = "0" ] || return
+	[ "${FAIL}" = "0" ] && return
+
+	[ "${STD_ERR}" = "2" ] || exec 2>&${STD_ERR}
+	[ "${STD_OUT}" = "1" ] || exec 1>&${STD_OUT}
+	if [ -n "${LOG_OUT}" -a -f "${LOG_OUT}" ]; then
+		local label="stdout"
+		[ "${LOG_OUT}" = "${LOG_ERR}" ] && label="stdout.stderr"
+		echo "==== [${label}] ${LOG_OUT} ====";
+		summary_file "${LOG_OUT}";
+		[ -n "${PUB_D}" ] && cp "${LOG_OUT}" "${PUB_D}/log.${label}"
+	fi
+	if [ -n "${LOG_ERR}" -a -f "${LOG_OUT}" ] &&
+	   [ "${LOG_ERR}" != "${LOG_OUT}" ]; then
+		echo "==== [stderr] ${LOG_ERR} ===="
+		summary_file "${LOG_ERR}"
+		[ -n "${PUB_D}" ] && cp "${LOG_OUT}" "${PUB_D}/log.stderr"
+	fi
+}
+
+do_mkdir() {
+	local p=""
+	[ "$1" = "-p" ] && { p=${1}; shift; }
+	[ -d "${1}" ] || mkdir ${p} "${1}"
+}
+
+push_build() {
+	trigger-sync
+}
+
+trap do_exit EXIT
+
+short_opts="d:hsa"
+long_opts="debug,help,fake-only,no-publish-ec2,skip-publish,working-dir"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+publish_ec2=1
+fake_only=0
+
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-d|--debug) DEBUG=1;;
+		-h|--help) Usage; exit 0;;
+		-s|--skip-publish) SKIP_PUBLISH=1;;
+		   --no-publish-ec2) publish_ec2=0;;
+		   --fake-only) fake_only=1;;
+		--working-dir)
+			case "${next}" in
+				/*) WORK_D=${next};;
+				*) WORK_D="$PWD/${next}";;
+			esac
+			shift;;
+		--) shift; break;;
+	esac
+	shift
+done
+
+[ $# -eq 1 ] || bad_Usage "must supply config file"
+
+conf_in="$1"
+
+conf=""
+if [ -f "${conf_in}" ]; then
+	conf=$(readlink -f "${conf_in}")
+else
+	[ "${conf_in#/}" = "${conf_in}" ] || fail "${conf_in}: not a file"
+	for f in "${base_d}/${conf_in}" "${base_d}/${conf_in}.conf" \
+	         "${base_d}/conf/${conf_in}" "${base_d}/conf/${conf_in}.conf"; do
+		[ -f "$f" ] && conf=$(readlink -f "${f}") && break
+	done
+fi
+
+[ -n "${conf}" -a -f "${conf}" ] ||
+	fail "${conf_in}: unable to find config"
+
+conf_base=$(dirname ${conf})
+
+for x in ${env_vars}; do
+	[ -n "${!x}" ] || fail "must set ${env_vars} (${x} not set)"
+done
+
+publish_base=${PUBLISH_BASE}
+
+unset suite build_name;
+out=$(bash -c '. "$1" && echo "${suite}:${build_name}"' "${0}" "${conf}") &&
+	[ -n "${out}" ] ||
+	fail "failed to get suite, build_name from conf";
+
+do_mkdir -p "${publish_base}" ||
+	fail "failed to make publish dir ${publish_base}"
+
+publish_base=$(readlink -f "${publish_base}")
+
+if [ "${fake_only}" = "1" ]; then
+	build-ec2-image() {
+		while [ "${1#-}" != "${1}" ]; do shift; done
+		local conf=${1} out=${2} x pre d
+		for x in "${ARCHS}"; do
+			pre="${suite}-${build_name}-cloudimg-${x}"
+			for d in "${out}" "${out}/unpacked"; do
+				do_mkdir "${d}" || return 1;
+				: > "${d}/${pre}.tar.gz"
+				: > "${d}/${pre}.manifest"
+			done
+		done
+	}
+
+	publish-build() {
+		[ "$1" = "--verbose" ] && shift;
+		local out_d=${4}
+		echo "${*}" > "${out_d}/published-ec2-daily.txt"
+	}
+
+	make-web-indices() {
+		local out_d=${1}
+		echo "$*" > "${out_d}/HEADER.html"
+		echo "$*" > "${out_d}/FOOTER.html"
+	}
+
+	checksum-directory() {
+		: > "${1}/MD5SUMS"
+	}
+
+	push_build() {
+		:
+	}
+fi
+
+[ -d "${START_D}" ] || fail "${START_D} does not exist"
+
+if [ "${DEBUG}" = "0" ]; then
+	do_mkdir -p "${LOG_D}" ||
+		fail "failed to make logdir ${LOG_D}"
+	LOG_D=$(cd "${LOG_D}" && pwd) || fail "failed to get full path for log dir"
+fi
+
+cd "${START_D}" || fail "failed cd ${START_D}"
+
+suite=${out%%:*}
+build_name=${out#*:}
+
+case "${build_name}" in
+	server) base_d="${publish_base}/${suite}";;
+	desktop) base_d="${publish_base}/desktop/${suite}";;
+	*) fail "unknown build_name: ${build_name}";;
+esac
+
+do_mkdir -p "${base_d}" ||
+	fail "failed to mkdir ${base_d}"
+
+source "${conf}"
+ds=$(date +"%Y%m%d") || fail "failed to run date"
+
+serial=""
+pub_d=""
+for p in "" .1 .2 .3 .4 .5 .6 .7 .8 .9; do
+	mkdir "${base_d}/${ds}${p}" 2>/dev/null || continue
+	pub_d="${base_d}/${ds}${p}"
+	serial="${ds}${p}"
+	break
+done
+[ -n "${pub_d}" -a -d "${pub_d}" ] ||
+	fail "failed to make output dir under ${base_d}"
+
+echo "$$" > "${pub_d}/.building.pid" &&
+	BUILDING_LOCK="${pub_d}/.building.pid" ||
+	fail "failed to lock ${pub_d}"
+PUB_D="${pub_d}"
+
+if [ "$DEBUG" = "0" ]; then
+	log_out="${LOG_D}/${suite}-${build_name}-cloudimg-${serial}.log"
+	# redirect output to log file. keep file descriptors for
+	# sending output at end on failure (ie, so cron output gets mailed)
+	LOG_OUT=${log_out}
+	LOG_ERR=${log_out}
+	exec 3>&1 && STD_OUT=3 || fail "failed stdout dupe"
+	exec 4>&2 && STD_ERR=4 || fail "failed stderr dupe"
+	exec 1> "${log_out}" 2>&1  # stderr, stdout same location
+	# exec 1> "${log_out}"   # for separate stderr
+	# exec 2> "${log_err}"   # for separate stderr
+	[ $? -eq 0 ] || fail "failed to write to ${log_out}"
+fi
+
+debug "building ${conf_in} to ${pub_d}.${log_out:+ log in ${log_out} .}"
+
+if [ -z "${WORK_D}" ]; then
+	OUT_D=$(mktemp -d "${START_D}/${0##*/}.${serial}.XXXXXX") ||
+		fail "failed to make tempdir"
+else
+	OUT_D="${WORK_D}"
+fi
+
+build-ec2-image --serial=${serial} "${conf}" "${OUT_D}" ||
+	fail "failed: build-ec2-image '${conf}' '${OUT_D}'"
+
+source "${conf}"
+[ -n "${extra_arches}" ] && {
+    for nested_conf in "${extra_arches}" 
+    do
+        debug "Processing nested configuration file ${nested_conf}"
+        build-ec2-image --serial=${serial} "${conf_base}/${nested_conf}" "${OUT_D}" ||
+           fail "failed nested configuration: build-ec2-image ${nested_conf} ${OUT_D}"
+    done
+}
+
+[ "${SKIP_PUBLISH}" = "0" ] || exit 0
+
+debug "finalizing working dir ${OUT_D}"
+
+U_OUT_D="${OUT_D}/unpacked"
+
+printf "serial=%s\norig_prefix=%s\nsuite=%s\nbuild_name=%s\n" \
+	"${serial}" "${suite}-${build_name}-cloudimg" "${suite}" "${build_name}" \
+	> "${U_OUT_D}/build-info.txt"
+
+{
+for tool in "${0}" "$(which vmbuilder)" "${LIVE_BUILD_PATH}/live-build"; do
+	dir=$(dirname "${tool}")
+	echo "====== ${tool##*/} [${tool}] ======"
+	if ( cd "${dir}" && bzr root ) >/dev/null 2>&1; then
+		( cd "${dir}" && bzr info && bzr version-info && 
+		  { bzr diff || :; } ) ||
+			fail "getting bzr info failed"
+	elif dpkg_out=$(dpkg -S "${tool}" 2>/dev/null); then
+		pkg=${dpkg_out%%:*}
+		dpkg-query --show "${pkg}"
+		if debsum_out=$(debsums "${pkg}" >/dev/null 2>&1); then
+			echo "package unmodified"
+		else
+			echo "package modified"
+			echo "${out}"
+		fi
+	else
+		echo "unversioned"
+		md5sum "${tool}"
+	fi
+done
+} > "${U_OUT_D}/tool-version-info.txt" 2>&1
+
+checksum-directory "${OUT_D}" &&
+	checksum-directory "${U_OUT_D}" ||
+	fail "failed to make checksums"
+
+# from here out, we're working on the published directory
+debug "publishing image ${suite}-${build_name}-cloudimg to ${pub_d}"
+if [ ! -d "${pub_d}" ]; then
+    error "WARNING: ${0##*/} found no publish dir (${pub_d}). creating it."
+	mkdir -p "${pub_d}" || fail "failed to create ${pub_d}"
+fi
+mv "${OUT_D}"/* "${pub_d}/" || fail "failed to move files to ${pub_d}"
+
+if [ ${publish_ec2} -ne 0 ]; then
+	debug "publishing to ec2"
+	publish-build --verbose "${suite}" "${build_name}" daily "${pub_d}" ||
+		fail "failed publish-build ${suite} ${build_name} daily ${pub_d}"
+else
+	# publish-build above would do this, but in this case, do it here.
+	DIST=${suite} make-web-indices "${pub_d}" "${suite}" daily &&
+		DIST=${suite} make-web-indices "${pub_d}/unpacked" "${suite}" daily ||
+		fail "failed to make web indices"
+fi
+
+
+current="${base_d}/current"
+rm -f "${current}" && ln -sf "${serial}" "${current}" ||
+	fail "failed to link current"
+
+debug "built ${conf} to ${pub_d} ${SECONDS}"
+
+push_build

=== added directory 'conf'
=== added file 'conf/hardy-server.conf'
--- conf/hardy-server.conf	1970-01-01 00:00:00 +0000
+++ conf/hardy-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,10 @@
+suite="hardy"
+description="Ubuntu 8.04 (Hardy Heron)"
+copy_out_kernels=1
+build_name="server"
+root_fs_size="2048"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+nogrub=0
+img_arches="amd64 i386"
+img_size=2G

=== added file 'conf/karmic-server.conf'
--- conf/karmic-server.conf	1970-01-01 00:00:00 +0000
+++ conf/karmic-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,10 @@
+suite="karmic"
+description="Ubuntu 9.10 (Karmic Koala)"
+copy_out_kernels=1
+build_name="server"
+root_fs_size="2048"
+publish_ec2=1
+#vmb_addargs=( "${vmb_addargs[@]}" --proposed )
+nogrub=0
+img_arches="amd64 i386"
+img_size=2G

=== added file 'conf/lucid-desktop.conf'
--- conf/lucid-desktop.conf	1970-01-01 00:00:00 +0000
+++ conf/lucid-desktop.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,20 @@
+suite="lucid"
+description="Ubuntu 10.04 (Lucid Lynx)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+vmb_addargs=( "--addpkg=ubuntu-desktop^" )
+# uncomment below to add neatx-server from freenx-team ppa
+#vmb_addargs=( ${vmb_addargs[@]}" 
+#              "--ppa=freenx-team" "--addpkg" "neatx-server" )
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+nogrub=0
+img_arches="amd64 i386"
+img_size=2G

=== added file 'conf/lucid-server.conf'
--- conf/lucid-server.conf	1970-01-01 00:00:00 +0000
+++ conf/lucid-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,23 @@
+suite="lucid"
+description="Ubuntu 10.04 (Lucid Lynx)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+vmb_addargs=( )
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+nogrub=0
+img_arches="amd64 i386"
+img_size=2G
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+ovf_default=qcow2
+img_size=2G

=== added file 'conf/maverick-desktop.conf'
--- conf/maverick-desktop.conf	1970-01-01 00:00:00 +0000
+++ conf/maverick-desktop.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,21 @@
+suite="maverick"
+description="Ubuntu 10.10 (Maverick Meerkat)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+vmb_addargs=( "--addpkg=ubuntu-desktop^" )
+# uncomment below to add neatx-server from freenx-team ppa
+#vmb_addargs=( "${vmb_addargs[@]}" 
+#              "--ppa=freenx-team" "--addpkg" "neatx-server" )
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+img_size=2G

=== added file 'conf/maverick-server.conf'
--- conf/maverick-server.conf	1970-01-01 00:00:00 +0000
+++ conf/maverick-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,18 @@
+suite="maverick"
+description="Ubuntu 10.10 (Maverick Meerkat)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+vmb_addargs=( )
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+img_size=2G

=== added file 'conf/natty-desktop.conf'
--- conf/natty-desktop.conf	1970-01-01 00:00:00 +0000
+++ conf/natty-desktop.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,21 @@
+suite="natty"
+description="Ubuntu 11.04 (Natty Narwhal)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+vmb_addargs=( "--addpkg=ubuntu-desktop^" )
+# uncomment below to add neatx-server from freenx-team ppa
+#vmb_addargs=( "${vmb_addargs[@]}" 
+#              "--ppa=freenx-team" "--addpkg" "neatx-server" )
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+img_size=2G

=== added file 'conf/natty-server.conf'
--- conf/natty-server.conf	1970-01-01 00:00:00 +0000
+++ conf/natty-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,25 @@
+suite="natty"
+description="Ubuntu 11.04 (Natty Narwhal)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=natty-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" --size=2G "--out=%o" "%i"  )
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+ovf_default=qcow2
+img_size=2G

=== added file 'conf/oneiric-arm-server.conf'
--- conf/oneiric-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/oneiric-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,29 @@
+suite="oneiric"
+description="Ubuntu 11.10 (Oneiric Ocelot)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+package_img_tgz=0
+build_name="server"
+root_fs_size="800"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armel"
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=1
+qemu_img_cmd=( sudo "%d/ovf/armel2qemu" --type qcow2 "--disk %o/%i_omap-disk1.img" "--mlo %d/loaders/oneiric-armel/MLO"
+               "--uboot %d/loaders/oneiric-armel/u-boot.bin" "--rootfs %r" "--label %l")
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true" 
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-arm" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext3"
+	"--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=armel" "--architecture=%A" "--cache=false")
+
+

=== added file 'conf/oneiric-desktop.conf'
--- conf/oneiric-desktop.conf	1970-01-01 00:00:00 +0000
+++ conf/oneiric-desktop.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,21 @@
+suite="oneiric"
+description="Ubuntu 11.10 (Oneiric Ocelot)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true" 
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	"--architecture=%A" "--cache=false" "--linux-flavours=virtual")
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"

=== added file 'conf/oneiric-server.conf'
--- conf/oneiric-server.conf	1970-01-01 00:00:00 +0000
+++ conf/oneiric-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,31 @@
+suite="oneiric"
+description="Ubuntu 11.10 (Oneiric Ocelot)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=oneiric-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true" 
+	"--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud" "--hdd-fs-label=%l" "--hdd-new-fstab"
+	"--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	"--architecture=%A" "--cache=false" "--linux-flavours=virtual")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="oneiric-arm-server.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+ovf_default=qcow2
+img_size=2G

=== added file 'conf/precise-arm-server.conf'
--- conf/precise-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/precise-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,28 @@
+suite="precise"
+description="Ubuntu 12.04 (Precise Pangolin)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+package_img_tgz=0
+build_name="server"
+root_fs_size="1200"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armhf"
+create_root_tgz=1
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=1
+qemu_img_cmd=( sudo "%d/ovf/armhf2qemu" --type qcow2 "--disk %o/%i_omap-disk1.img" "--mlo %d/loaders/precise-armhf/MLO"
+               "--uboot %d/loaders/precise-armhf/u-boot.bin" "--rootfs %r" "--label %l" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-arm" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+        "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A" "--cache=false" "--source=false" )

=== added file 'conf/precise-desktop.conf'
--- conf/precise-desktop.conf	1970-01-01 00:00:00 +0000
+++ conf/precise-desktop.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,21 @@
+suite="precise"
+description="Ubuntu 12.04 (Precise Pangolin)"
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"

=== added file 'conf/precise-server.conf'
--- conf/precise-server.conf	1970-01-01 00:00:00 +0000
+++ conf/precise-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+suite="precise"
+description="Ubuntu 12.04 (Precise Pangolin)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=precise-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud" "--hdd-fs-label=%l" "--hdd-new-fstab" 
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="precise-arm-server.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+ovf_default=qcow2
+img_size=2G
+create_root_tgz=1

=== added file 'conf/quantal-arm-server.conf'
--- conf/quantal-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/quantal-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,29 @@
+suite="quantal"
+description="Ubuntu 12.10 (Quantal Quetzal)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armhf"
+create_root_tgz=1
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=1
+create_root_tgz=1
+qemu_img_cmd=( sudo "%d/ovf/armhf2qemu" --type qcow2 "--disk %o/%i_omap-disk1.img" "--mlo %d/loaders/quantal-armhf/MLO"
+               "--uboot %d/loaders/quantal-armhf/u-boot.bin" "--rootfs %r" "--label %l" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-arm" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+        "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A" "--cache=false"  "--source=false")

=== added file 'conf/quantal-desktop.conf'
--- conf/quantal-desktop.conf	1970-01-01 00:00:00 +0000
+++ conf/quantal-desktop.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,22 @@
+suite="quantal"
+description="Ubuntu 12.10 (Quantal Quetzal)"
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"
+

=== added file 'conf/quantal-server.conf'
--- conf/quantal-server.conf	1970-01-01 00:00:00 +0000
+++ conf/quantal-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+suite="quantal"
+description="Ubuntu 12.10 (Quantal Quetzal)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=quantal-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true" 
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud" "--hdd-fs-label=%l" "--hdd-new-fstab" 
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="quantal-arm-server.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+ovf_default=qcow2
+img_size=2G
+create_root_tgz=1

=== added file 'conf/raring-arm-server.conf'
--- conf/raring-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/raring-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,29 @@
+suite="raring"
+description="Ubuntu 13.04 (Raring Ringtail)"
+copy_out_kernels=1
+unpublished_ramdisks="."
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armhf"
+create_root_tgz=1
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=1
+create_root_tgz=1
+qemu_img_cmd=( sudo "%d/ovf/armhf2qemu" --type qcow2 "--disk %o/%i_omap-disk1.img" "--mlo %d/loaders/raring-armhf/MLO"
+               "--uboot %d/loaders/raring-armhf/u-boot.bin" "--rootfs %r" "--label %l" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-arm" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+        "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A" "--cache=false"  "--source=false")

=== added file 'conf/raring-desktop.conf'
--- conf/raring-desktop.conf	1970-01-01 00:00:00 +0000
+++ conf/raring-desktop.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,22 @@
+suite="raring"
+description="Ubuntu 12.10 (Raring Ringtail)"
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"
+

=== added file 'conf/raring-server.conf'
--- conf/raring-server.conf	1970-01-01 00:00:00 +0000
+++ conf/raring-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+suite="raring"
+description="Ubuntu 13.04 (Raring Ringtail)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=raring-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true" 
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud" "--hdd-fs-label=%l" "--hdd-new-fstab" 
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="raring-arm-server.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+ovf_default=qcow2
+img_size=2G
+create_root_tgz=1

=== added file 'conf/saucy-arm-server.conf'
--- conf/saucy-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/saucy-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,30 @@
+suite="saucy"
+description="Ubuntu 13.10 (Saucy Salamander)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armhf"
+create_root_tgz=1
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic-lpae" )

=== added file 'conf/saucy-desktop.conf'
--- conf/saucy-desktop.conf	1970-01-01 00:00:00 +0000
+++ conf/saucy-desktop.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,22 @@
+suite="saucy"
+description="Ubuntu 12.10 (Saucy Salamander)"
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"
+

=== added file 'conf/saucy-server.conf'
--- conf/saucy-server.conf	1970-01-01 00:00:00 +0000
+++ conf/saucy-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+suite="saucy"
+description="Ubuntu 13.10 (Saucy Salamander)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=saucy-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true" 
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud" "--hdd-fs-label=%l" "--hdd-new-fstab" 
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="saucy-arm-server.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+ovf_default=qcow2
+img_size=2G
+create_root_tgz=1

=== added file 'conf/trusty-arm-server.conf'
--- conf/trusty-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/trusty-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,31 @@
+suite="trusty"
+description="Ubuntu 14.04 LTS (Trusty Tahr)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armhf"
+create_root_tgz=1
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic-lpae" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/trusty-arm64-server.conf'
--- conf/trusty-arm64-server.conf	1970-01-01 00:00:00 +0000
+++ conf/trusty-arm64-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+suite="trusty"
+description="Ubuntu 14.04 LTS (Trusty Tahr)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="arm64"
+create_root_tgz=1
+qcow2_create=1
+qcow2_uefi_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/trusty-desktop-server.conf'
--- conf/trusty-desktop-server.conf	1970-01-01 00:00:00 +0000
+++ conf/trusty-desktop-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,22 @@
+suite="trusty"
+description="Ubuntu 12.10 (Trusty Tahr)"
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/trusty-ppc64el-server.conf'
--- conf/trusty-ppc64el-server.conf	1970-01-01 00:00:00 +0000
+++ conf/trusty-ppc64el-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,52 @@
+suite="trusty"
+description="Ubuntu 14.04 LTS (Trusty Tahr)"
+copy_out_kernels=1
+
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config"
+   "--architecture=%A"
+   "--binary-filesystem=ext4"
+   "--binary-images=binary-hdd-raw"
+   "--bootloader=none"
+   "--build-with-chroot=true"
+   "--cache=false"
+   "--cache-indices=false"
+   "--chroot-filesystem=plain"
+   "--distribution=%d"
+   "--hdd-fs-label=%l"
+   "--hdd-new-fstab"
+   "--hdd-size=%s"
+   "--linux-flavours=virtual"
+   "--mode=ubuntu"
+   "--package-list=ubuntu-cloud"
+   "--root-mount-by=LABEL"
+   "--source=false"
+   "--system=normal"
+)
+
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="ppc64el"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=0
+qcow2_ovf=0
+qcow2_gpt_create=1
+vmdk_gpt_create=0
+ovf_default=qcow2
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )
+
+# vi: syntax=sh

=== added file 'conf/trusty-server-hwe-u.conf'
--- conf/trusty-server-hwe-u.conf	1970-01-01 00:00:00 +0000
+++ conf/trusty-server-hwe-u.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,38 @@
+suite="trusty"
+description="Ubuntu 14.04 LTS (Trusty Tahr HWE-U)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=trusty-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+ova_cmd=( sudo "%d/ovf/diskimg2ova" "--prefix=%p" "--disk=%r" "--size=10G" "--out=%o"
+                "--version=14.04-LTS")
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-t-hwe" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual-lts-utopic" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server-hwe-u"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches=""
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+qcow2_uefi_create=1
+vmdk_uefi_create=0
+ovf_default=qcow2
+ova_create=1
+img_size=2G
+create_root_tgz=0
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/trusty-server-hwe-v.conf'
--- conf/trusty-server-hwe-v.conf	1970-01-01 00:00:00 +0000
+++ conf/trusty-server-hwe-v.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,38 @@
+suite="trusty"
+description="Ubuntu 14.04 LTS (Trusty Tahr HWE-V)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=trusty-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+ova_cmd=( sudo "%d/ovf/diskimg2ova" "--prefix=%p" "--disk=%r" "--size=10G" "--out=%o"
+                "--version=14.04-LTS")
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-t-hwe" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual-lts-vivid" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server-hwe-v"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches=""
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+qcow2_uefi_create=1
+vmdk_uefi_create=0
+ovf_default=qcow2
+ova_create=1
+img_size=2G
+create_root_tgz=0
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/trusty-server-hwe-w.conf'
--- conf/trusty-server-hwe-w.conf	1970-01-01 00:00:00 +0000
+++ conf/trusty-server-hwe-w.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,38 @@
+suite="trusty"
+description="Ubuntu 14.04 LTS (Trusty Tahr HWE-W)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=trusty-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+ova_cmd=( sudo "%d/ovf/diskimg2ova" "--prefix=%p" "--disk=%r" "--size=10G" "--out=%o"
+                "--version=14.04-LTS")
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-t-hwe" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual-lts-wily" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server-hwe-w"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches=""
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+qcow2_uefi_create=1
+vmdk_uefi_create=0
+ovf_default=qcow2
+ova_create=1
+img_size=2G
+create_root_tgz=0
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/trusty-server-hwe-x.conf'
--- conf/trusty-server-hwe-x.conf	1970-01-01 00:00:00 +0000
+++ conf/trusty-server-hwe-x.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,38 @@
+suite="trusty"
+description="Ubuntu 14.04 LTS (Trusty Tahr HWE-X)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=trusty-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+ova_cmd=( sudo "%d/ovf/diskimg2ova" "--prefix=%p" "--disk=%r" "--size=10G" "--out=%o"
+                "--version=14.04-LTS")
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-t-hwe" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual-lts-xenial" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server-hwe-x"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches=""
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+qcow2_uefi_create=1
+vmdk_uefi_create=0
+ovf_default=qcow2
+ova_create=1
+img_size=2G
+create_root_tgz=0
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/trusty-server.conf'
--- conf/trusty-server.conf	1970-01-01 00:00:00 +0000
+++ conf/trusty-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,38 @@
+suite="trusty"
+description="Ubuntu 14.04 LTS (Trusty Tahr)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=trusty-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+ova_cmd=( sudo "%d/ovf/diskimg2ova" "--prefix=%p" "--disk=%r" "--size=10G" "--out=%o"
+                "--version=14.04-LTS")
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-t" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="trusty-arm-server.conf trusty-aarch64-server.conf trusty-server-hwe.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+qcow2_uefi_create=1
+vmdk_uefi_create=0
+ovf_default=qcow2
+ova_create=1
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/utopic-arm-server.conf'
--- conf/utopic-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/utopic-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,31 @@
+suite="utopic"
+description="Ubuntu 14.10 (Utopic Unicorn)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armhf"
+create_root_tgz=1
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic-lpae" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/utopic-arm64-server.conf'
--- conf/utopic-arm64-server.conf	1970-01-01 00:00:00 +0000
+++ conf/utopic-arm64-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+suite="utopic"
+description="Ubuntu 14.10 (Utopic Unicorn)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="arm64"
+create_root_tgz=1
+qcow2_create=1
+qcow2_uefi_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/utopic-desktop-server.conf'
--- conf/utopic-desktop-server.conf	1970-01-01 00:00:00 +0000
+++ conf/utopic-desktop-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,22 @@
+suite="utopic"
+description="Ubuntu 12.10 (Utopic Unicorn)"
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/utopic-ppc64el-server.conf'
--- conf/utopic-ppc64el-server.conf	1970-01-01 00:00:00 +0000
+++ conf/utopic-ppc64el-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,52 @@
+suite="utopic"
+description="Ubuntu 14.10 (Utopic Unicorn)"
+copy_out_kernels=1
+
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config"
+   "--architecture=%A"
+   "--binary-filesystem=ext4"
+   "--binary-images=binary-hdd-raw"
+   "--bootloader=none"
+   "--build-with-chroot=true"
+   "--cache=false"
+   "--cache-indices=false"
+   "--chroot-filesystem=plain"
+   "--distribution=%d"
+   "--hdd-fs-label=%l"
+   "--hdd-new-fstab"
+   "--hdd-size=%s"
+   "--linux-flavours=virtual"
+   "--mode=ubuntu"
+   "--package-list=ubuntu-cloud"
+   "--root-mount-by=LABEL"
+   "--source=false"
+   "--system=normal"
+)
+
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="ppc64el"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=0
+qcow2_ovf=0
+qcow2_gpt_create=1
+vmdk_gpt_create=0
+ovf_default=qcow2
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )
+
+# vi: syntax=sh

=== added file 'conf/utopic-server.conf'
--- conf/utopic-server.conf	1970-01-01 00:00:00 +0000
+++ conf/utopic-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,38 @@
+suite="utopic"
+description="Ubuntu 14.10 (Utopic Unicorn)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=utopic-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+ova_cmd=( sudo "%d/ovf/diskimg2ova" "--prefix=%p" "--disk=%r" "--size=10G" "--out=%o"
+               "--version=14.10" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-t" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="utopic-arm-server.conf utopic-aarch64-server.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+qcow2_uefi_create=1
+vmdk_uefi_create=0
+ovf_default=qcow2
+ova_create=1
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/vivid-arm-server.conf'
--- conf/vivid-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/vivid-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,31 @@
+suite="vivid"
+description="Ubuntu 15.04 (Vivid Vervet)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armhf"
+create_root_tgz=1
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic-lpae" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/vivid-arm64-server.conf'
--- conf/vivid-arm64-server.conf	1970-01-01 00:00:00 +0000
+++ conf/vivid-arm64-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+suite="vivid"
+description="Ubuntu 15.04 (Vivid Vervet)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="arm64"
+create_root_tgz=1
+qcow2_create=1
+qcow2_uefi_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/vivid-desktop-server.conf'
--- conf/vivid-desktop-server.conf	1970-01-01 00:00:00 +0000
+++ conf/vivid-desktop-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,22 @@
+suite="vivid"
+description="Ubuntu 12.10 (Vivid Vervet)"
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/vivid-ppc64el-server.conf'
--- conf/vivid-ppc64el-server.conf	1970-01-01 00:00:00 +0000
+++ conf/vivid-ppc64el-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,52 @@
+suite="vivid"
+description="Ubuntu 15.04 (Vivid Vervet)"
+copy_out_kernels=1
+
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config"
+   "--architecture=%A"
+   "--binary-filesystem=ext4"
+   "--binary-images=binary-hdd-raw"
+   "--bootloader=none"
+   "--build-with-chroot=true"
+   "--cache=false"
+   "--cache-indices=false"
+   "--chroot-filesystem=plain"
+   "--distribution=%d"
+   "--hdd-fs-label=%l"
+   "--hdd-new-fstab"
+   "--hdd-size=%s"
+   "--linux-flavours=virtual"
+   "--mode=ubuntu"
+   "--package-list=ubuntu-cloud"
+   "--root-mount-by=LABEL"
+   "--source=false"
+   "--system=normal"
+)
+
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="ppc64el"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=0
+qcow2_ovf=0
+qcow2_gpt_create=1
+vmdk_gpt_create=0
+ovf_default=qcow2
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )
+
+# vi: syntax=sh

=== added file 'conf/vivid-server.conf'
--- conf/vivid-server.conf	1970-01-01 00:00:00 +0000
+++ conf/vivid-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,38 @@
+suite="vivid"
+description="Ubuntu 15.04 (Vivid Vervet)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=vivid-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+ova_cmd=( sudo "%d/ovf/diskimg2ova" "--prefix=%p" "--disk=%r" "--size=10G" "--out=%o"
+               "--version=15.04" )
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-t" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="vivid-arm-server.conf vivid-aarch64-server.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+qcow2_uefi_create=1
+vmdk_uefi_create=0
+ovf_default=qcow2
+ova_create=1
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/wily-arm-server.conf'
--- conf/wily-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/wily-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,31 @@
+suite="wily"
+description="Ubuntu 15.10 (Wily Werewolf)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armhf"
+create_root_tgz=1
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic-lpae" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/wily-arm64-server.conf'
--- conf/wily-arm64-server.conf	1970-01-01 00:00:00 +0000
+++ conf/wily-arm64-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+suite="wily"
+description="Ubuntu 15.10 (Wily Werewolf)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="arm64"
+create_root_tgz=1
+qcow2_create=1
+qcow2_uefi_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/wily-desktop-server.conf'
--- conf/wily-desktop-server.conf	1970-01-01 00:00:00 +0000
+++ conf/wily-desktop-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,22 @@
+suite="wily"
+description="Ubuntu 15.10 (Wily Werewolf)"
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/wily-ppc64el-server.conf'
--- conf/wily-ppc64el-server.conf	1970-01-01 00:00:00 +0000
+++ conf/wily-ppc64el-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,52 @@
+suite="wily"
+description="Ubuntu 15.10 (Wily Werewolf)"
+copy_out_kernels=1
+
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config"
+   "--architecture=%A"
+   "--binary-filesystem=ext4"
+   "--binary-images=binary-hdd-raw"
+   "--bootloader=none"
+   "--build-with-chroot=true"
+   "--cache=false"
+   "--cache-indices=false"
+   "--chroot-filesystem=plain"
+   "--distribution=%d"
+   "--hdd-fs-label=%l"
+   "--hdd-new-fstab"
+   "--hdd-size=%s"
+   "--linux-flavours=virtual"
+   "--mode=ubuntu"
+   "--package-list=ubuntu-cloud"
+   "--root-mount-by=LABEL"
+   "--source=false"
+   "--system=normal"
+)
+
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="ppc64el"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=0
+qcow2_ovf=0
+qcow2_gpt_create=1
+vmdk_gpt_create=0
+ovf_default=qcow2
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )
+
+# vi: syntax=sh

=== added file 'conf/wily-server.conf'
--- conf/wily-server.conf	1970-01-01 00:00:00 +0000
+++ conf/wily-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,38 @@
+suite="wily"
+description="Ubuntu 15.10 (Wily Werewolf)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=wily-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+ova_cmd=( sudo "%d/ovf/diskimg2ova" "--prefix=%p" "--disk=%r" "--size=10G" "--out=%o"
+               "--version=15.10")
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-t" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="wily-arm-server.conf wily-aarch64-server.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+qcow2_uefi_create=1
+vmdk_uefi_create=0
+ovf_default=qcow2
+ova_create=1
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/xenial-arm-server.conf'
--- conf/xenial-arm-server.conf	1970-01-01 00:00:00 +0000
+++ conf/xenial-arm-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,31 @@
+suite="xenial"
+description="Ubuntu 16.04 LTS (Xenial Xerus)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="armhf"
+create_root_tgz=1
+qcow2_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic-lpae" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/xenial-arm64-server.conf'
--- conf/xenial-arm64-server.conf	1970-01-01 00:00:00 +0000
+++ conf/xenial-arm64-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+suite="xenial"
+description="Ubuntu 16.04 LTS (Xenial Xerus)"
+copy_out_kernels=1
+unpublished_ramdisks=""
+package_img_tgz=0
+build_name="server"
+root_fs_size="1400"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="arm64"
+create_root_tgz=1
+qcow2_create=1
+qcow2_uefi_create=1
+qcow2_ovf=0
+qemu_img=0
+create_root_tgz=1
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d"
+         "--mode=ubuntu" "--build-with-chroot=true" "--chroot-filesystem=plain"
+         "--system=normal" "--package-list=ubuntu-cloud-arm-t" "--hdd-fs-label=%l"
+         "--hdd-new-fstab" "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw"
+         "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+         "--bootstrap-qemu-static=%q" "--bootstrap-qemu-arch=%A" "--architecture=%A"
+         "--cache=false" "--source=false" "--linux-flavours=generic" )
+purge_roottgz_pkgs=( "linux-*" )

=== added file 'conf/xenial-desktop-server.conf'
--- conf/xenial-desktop-server.conf	1970-01-01 00:00:00 +0000
+++ conf/xenial-desktop-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,22 @@
+suite="xenial"
+description="Ubuntu 12.10 (Xenial Xerus)"
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-desktop" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+    	"--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--source=false")
+copy_out_kernels=1
+unpublished_ramdisks="."
+build_name="desktop"
+root_fs_size="4096"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+build_type="desktop"
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'conf/xenial-ppc64el-server.conf'
--- conf/xenial-ppc64el-server.conf	1970-01-01 00:00:00 +0000
+++ conf/xenial-ppc64el-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,52 @@
+suite="xenial"
+description="Ubuntu 16.04 LTS (Xenial Xerus)"
+copy_out_kernels=1
+
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config"
+   "--architecture=%A"
+   "--binary-filesystem=ext4"
+   "--binary-images=binary-hdd-raw"
+   "--bootloader=none"
+   "--build-with-chroot=true"
+   "--cache=false"
+   "--cache-indices=false"
+   "--chroot-filesystem=plain"
+   "--distribution=%d"
+   "--hdd-fs-label=%l"
+   "--hdd-new-fstab"
+   "--hdd-size=%s"
+   "--linux-flavours=virtual"
+   "--mode=ubuntu"
+   "--package-list=ubuntu-cloud"
+   "--root-mount-by=LABEL"
+   "--source=false"
+   "--system=normal"
+)
+
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=0
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader=""
+floppy=""
+nogrub=1
+img_arches="ppc64el"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=0
+qcow2_ovf=0
+qcow2_gpt_create=1
+vmdk_gpt_create=0
+ovf_default=qcow2
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )
+
+# vi: syntax=sh

=== added file 'conf/xenial-server.conf'
--- conf/xenial-server.conf	1970-01-01 00:00:00 +0000
+++ conf/xenial-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,38 @@
+suite="xenial"
+description="Ubuntu 16.04 LTS (Xenial Xerus)"
+copy_out_kernels=1
+ovf_cmd=( sudo "%d/ovf/diskimg2ovf" --conf=xenial-server.conf
+          --template=ubuntu-ovf-v1-%t.tmpl "--prefix=%p" "--disk=%r" "--size=%s" "--out=%o" )
+ova_cmd=( sudo "%d/ovf/diskimg2ova" "--prefix=%p" "--disk=%r" "--size=10G" "--out=%o"
+               "--version=16.04 LTS")
+lb_conf=( sudo "LB_BASE=%L" "PATH=%x" "%P/lb_config" "--distribution=%d" "--mode=ubuntu" "--build-with-chroot=true"
+        "--chroot-filesystem=plain" "--system=normal" "--package-list=ubuntu-cloud-t" "--hdd-fs-label=%l" "--hdd-new-fstab"
+        "--root-mount-by=LABEL" "--binary-images=binary-hdd-raw" "--bootloader=none" "--hdd-size=%s" "--binary-filesystem=ext4"
+	    "--architecture=%A" "--cache=false" "--linux-flavours=virtual" "--cache-indices=false" "--source=false")
+package_img_tgz=0
+unpublished_ramdisks="."
+build_name="server"
+root_fs_size="1408"
+root_fs_label="cloudimg-rootfs"
+publish_ec2=1
+cat_partfile() {
+	local size=${2};
+   printf "%s\n" "root ${size} a1"
+}
+build_type="server"
+loader="grub-maverick-20100729.img"
+floppy="floppy-maverick-20111012.img"
+nogrub=0
+img_arches="amd64 i386"
+extra_arches="xenial-arm-server.conf xenial-aarch64-server.conf"
+vmdk_create=0
+vmdk_ovf=0
+qcow2_create=1
+qcow2_ovf=1
+qcow2_uefi_create=1
+vmdk_uefi_create=0
+ovf_default=qcow2
+ova_create=1
+img_size=2G
+create_root_tgz=1
+purge_roottgz_pkgs=( "linux-*" "grub-*" )

=== added file 'copy-out-kernels'
--- copy-out-kernels	1970-01-01 00:00:00 +0000
+++ copy-out-kernels	2016-03-22 02:54:49 +0000
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [ options ] root_dir output_dir info_file output_prefix
+
+   copy kernels out of root_dir, put them in output_dir
+   prefix names with output_prefix, write information about them to info_file
+
+   --help | -h         output help
+   --skip-ramdisks r   do not copy or record ramdisks found that match regex r
+   --chown c           change perm of files copied out. pass 'c' to chown
+EOF
+}
+
+my_name=$(readlink -f ${0})
+my_path=$(dirname ${my_name})
+export PATH="${my_path}:${PATH}"
+
+error() { echo "$@" 1>&2; }
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+short_opts="h"
+long_opts="chown:,help,skip-ramdisks:"
+getopt_out=$(getopt --name "${0##*/}" --shell sh \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+skip_ramdisk=""
+chown=""
+while [ $# -ne 0 ]; do
+   case $1 in
+         --skip-ramdisks) skip_ramdisks=$2; shift;;
+         --chown) chown=$2; shift;;
+      -h|--help) Usage; exit 0;;
+      --) shift; break;;
+   esac
+   shift;
+done
+
+root_dir=${1}
+output_dir=${2:-${KRD_OUTPUT_DIR:-.}}
+outfile=${3:-${KRD_OUTPUT_FILE}}
+output_prefix=${4:-${KRD_PREFIX}}
+
+[ -n "${root_dir}" -a -n "${output_dir}" ] && 
+[ -n "${outfile}" -a -n "${output_prefix}" ] || bad_Usage
+
+bootd="boot"
+
+fail() { echo "$@" 1>&2; exit 1; }
+
+# get a list of kernels in /boot
+: > "${outfile}"
+for kfp in ${root_dir}/${bootd}/vmlinu?-*; do
+   [ -f "${kfp}" ] || continue
+   kname=${kfp##*/}
+   iname=initrd.img-${kname#vmlinu?-}
+   if [ -n "${skip_ramdisks}" ]; then
+      echo "${iname}" | egrep -q "${skip_ramdisks}" && iname=""
+   fi
+
+   pkg=$(dpkg --root=${root_dir} -S ${kname}); pkg=${pkg%%:*};
+   [ -z "${pkg}" ] && fail "kernel ${kvp} is not packaged!"
+
+   flav="${pkg##*-}"
+   dquery_cmd=(sudo env PATH=${PATH} chroot_helper ${root_dir} dpkg-query --show)
+   vers=$(${dquery_cmd[@]} --showformat="\${Version}\n" "${pkg}");
+   arch=$(${dquery_cmd[@]} --showformat="\${Architecture}\n" "${pkg}");
+   [ -z "${arch}" ] && fail "failed to get kernel arch info for ${kvp}"
+   [ -z "${flav}" ] && fail "failed to get kernel flavour info for ${kvp}"
+   [ -z "${vers}" ] && fail "failed to get kernel version info for ${kvp}"
+
+   printf "%s\t%s\t%s\t%s\t%s\n"  "${output_prefix}vmlinuz-${flav}" "${kname}" \
+                 "${arch}" "${pkg}" "${vers}" >> "${outfile}"
+
+   [ -z "${iname}" -o ! -e "${bootd}/${ird}" ] ||
+           printf "%s\t%s\t%s\t%s\t%s\n" "${output_prefix}initrd-${flav}" "${iname}" \
+                  "${arch}" "${pkg}" "${vers}" >> "${outfile}"
+done
+
+[ -s "${outfile}" ] || exit 0
+
+[ -z "$(awk '-F\t' '{print $1}' ${outfile} | sort | uniq -d)" ] || {
+   cat "${outfile}" 1>&2;
+   fail "multiple kernels of the same flavor were found in ${root_dir}";
+}
+
+while read tname file arch pkg vers; do
+   cp "${root_dir}/${bootd}/${file}" "${output_dir}/${tname}" ||
+      fail "failed to copy ${file} -> ${output_dir}/${tname}"
+   { [ -z "${chown}" ] || chown "${chown}" "${output_dir}/${tname}"; } ||
+      fail "failed to change ownership of ${tname} to '$chown'"
+   chmod ugo+r "${output_dir}/${tname}"
+done < "${outfile}"

=== added file 'cronrun'
--- cronrun	1970-01-01 00:00:00 +0000
+++ cronrun	2016-03-22 02:54:49 +0000
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+# this does nothing more than set environment variables and exec a command
+# the advantage of setting here versus in cron, is that anyone can
+# easily look at a crontab line and copy and paste it
+
+HOME=/home/vmbuilder
+umask 022
+
+EC2_DAILY=${HOME}/ec2-daily
+CDIMAGE_BIN="${HOME}/cdimage/bin"
+AUTO_BUILDS=${EC2_DAILY}/automated-ec2-builds
+PUBLISH_SCRIPTS=${HOME}/ec2-publishing-scripts
+XC2_PATH="${EC2_DAILY}/xc2"
+S3CMD_PATH="${EC2_DAILY}/s3cmd-0.9.9.91"
+MISC_PATH="${EC2_DAILY}/misc"
+VMBUILDER_PATH="${EC2_DAILY}/vmbuilder"
+EUCA2OOLS_PATH="${EC2_DAILY}/euca2ools"
+BOTO_PATH="${EC2_DAILY}/boto-2.1.1"
+
+export EC2_AMITOOL_HOME="$EC2_DAILY/ec2-ami-tools"
+export LIVE_BUILD_PATH="${EC2_DAILY}/live-build"
+MYPATH=${VMBUILDER_PATH}:${XC2_PATH}:${S3CMD_PATH}:${PUBLISH_SCRIPTS}:${AUTO_BUILDS}:${VMBUILDER_PATH}:${EC2_AMITOOL_HOME}/bin:$HOME/bin:${CDIMAGE_BIN}:${EUCA2OOLS_PATH}/bin
+export PYTHONPATH="${BOTO_PATH}:${EUCA2OOLS_PATH}"
+
+LOGDIR="${EC2_DAILY}/logs"
+
+export PATH=${MYPATH}:/usr/bin:/usr/sbin:/usr/bin:/sbin:/bin
+export JAVA_HOME=/usr
+export START_D=${EC2_DAILY}
+export PUBLISH_BASE=/srv/ec2-images
+export XC2_RETRY_ON="Server.InternalError Read.timeout Server.Unavailable Unable.to.connect"
+
+unset LANG
+
+summary_file() {
+	local file=${1} head=${2:-20} tail=${2:-80}
+    local lines="" remain=""
+	lines=$(wc -l < "${file}")
+	if [ $lines -le $(($head+$tail)) ]; then
+		cat "${file}"
+	else
+		head -n "${head}" "${file}"
+		echo "lines=${lines} head=${head} tail=${tail}"
+		echo "... <<<< $((${lines}-${head}-${tail})) lines >>>>..."
+		tail -n "${tail}" "${file}"
+	fi
+}
+
+if [ "${1%=*}" = "--logname" -o "$1" = "--log" ]; then
+   if [ "$1" = "--log" ]; then
+      lbname="${2}-%s"
+   else
+      lbname="${1#*=}"
+   fi
+   shift
+   logname=$(printf "${lbname}" "$(date +%Y%m%d)")
+   [ -d "${LOGDIR}" ] || mkdir -p "${LOGDIR}" ||
+      { echo "failed to create ${LOGDIR}" 1>&2; exit 1; }
+   lfile="${LOGDIR}/${logname}"
+   i=0;
+   while lfile="${LOGDIR}/${logname}.${i}.log" && [ -e "${lfile}" ]; do
+      i=$((${i}+1))
+   done
+   "$@" > "${lfile}" 2>&1
+   [ $? -eq 0 ] && exit 0
+	echo "command failed: ${*}"
+	echo "==== [stdout/stderr] ${lfile} ====";
+   summary_file "${lfile}"
+else
+   exec "$@"
+fi

=== added file 'daily-build-cleaner-schedule.txt'
--- daily-build-cleaner-schedule.txt	1970-01-01 00:00:00 +0000
+++ daily-build-cleaner-schedule.txt	2016-03-22 02:54:49 +0000
@@ -0,0 +1,244 @@
+# this file is read by 'daily-build-cleaner', and specifies
+# information about how many daily builds to keep, and how long to
+# store them un-registered before deletion.
+#
+# Each represents a set of like objects in a series.  Everything
+# that matches the regex shown will be considered for both public build
+# count and cleaning
+
+# IMPORTANT: when defining a new LTS series, make sure to copy from 12.04 or 14.04!
+#            Otherwise you may end up with dailies getting inappropriately cleaned due
+#            due to the presence of HWE builds!
+
+# number-published keep-private-for-days region regex-for-manifest
+5 30 all ^099720109477/ubuntu/images-testing/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-precise-daily-%{a}-server-([^hwe])
+
+5 30 all ^099720109477/ubuntu/images-testing/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/ebs-io1/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/ebs-ssd/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing/ubuntu-utopic-daily-%{a}-server
+
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/ebs-io1/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/ebs-ssd/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-vivid-daily-%{a}-server
+
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/ebs-io1/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/ebs-ssd/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-wily-daily-%{a}-server
+
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/ebs-io1/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/ebs-ssd/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-xenial-daily-%{a}-server
+
+
+# test images
+5 30 all ^099720109477/ubuntu/images-testing-dev/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/ebs-ssd/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/ebs-io1/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/ebs/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm-io1/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm-ssd/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm-instance/ubuntu-precise-daily-%{a}-server-([^hwe])
+
+5 30 all ^099720109477/ubuntu/images-testing-dev-dev/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/ebs-io1/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/ebs-ssd/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/ebs/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm-io1/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm-ssd/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm-instance/ubuntu-trusty-daily-%{a}-server-([^hwe])
+
+5 30 all ^099720109477/ubuntu/images-testing-dev-dev/ubuntu-xenial-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/ebs-io1/ubuntu-xenial-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/ebs-ssd/ubuntu-xenial-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/ebs/ubuntu-xenial-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm/ubuntu-xenial-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm-io1/ubuntu-xenial-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm-ssd/ubuntu-xenial-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-testing-dev/hvm-instance/ubuntu-xenial-daily-%{a}-server-([^hwe])
+
+# test images
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-precise-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-precise-daily-%{a}-server-([^hwe])
+
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-trusty-daily-%{a}-server-([^hwe])
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-trusty-daily-%{a}-server-([^hwe])
+
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-vivid-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-vivid-daily-%{a}-server
+
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-wily-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-wily-daily-%{a}-server
+
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-xenial-daily-%{a}-server
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-xenial-daily-%{a}-server
+
+
+#####################################################
+# precise hwe-t
+
+5 30 all ^099720109477/ubuntu/images-testing/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-precise-daily-%{a}-server-hwe-t
+
+# test images
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-precise-daily-%{a}-server-hwe-t
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-precise-daily-%{a}-server-hwe-t
+
+#####################################################
+
+#####################################################
+# trusty hwe-u
+
+5 30 all ^099720109477/ubuntu/images-testing/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-trusty-daily-%{a}-server-hwe-u
+
+# test images
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-trusty-daily-%{a}-server-hwe-u
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-trusty-daily-%{a}-server-hwe-u
+
+#
+#####################################################
+
+#####################################################
+# trusty hwe-v
+
+5 30 all ^099720109477/ubuntu/images-testing/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-trusty-daily-%{a}-server-hwe-v
+
+# test images
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-trusty-daily-%{a}-server-hwe-v
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-trusty-daily-%{a}-server-hwe-v
+
+#####################################################
+
+#####################################################
+# trusty hwe-w
+
+5 30 all ^099720109477/ubuntu/images-testing/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-trusty-daily-%{a}-server-hwe-u
+
+# test images
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-trusty-daily-%{a}-server-hwe-w
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-trusty-daily-%{a}-server-hwe-w
+
+#####################################################
+
+#####################################################
+# trusty hwe-x
+# This is the last server-hwe series for Trusty
+
+5 30 all ^099720109477/ubuntu/images-testing/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-testing/ebs/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-testing/hvm/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-testing/hvm-io1/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-testing/hvm-ssd/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-testing/hvm-instance/ubuntu-trusty-daily-%{a}-server-hwe-x
+
+# test images
+5 30 all ^099720109477/ubuntu/images-proposed/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-ssd/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-proposed/ebs-io1/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-proposed/ebs/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-io1/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-ssd/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-proposed/hvm/ubuntu-trusty-daily-%{a}-server-hwe-x
+5 30 all ^099720109477/ubuntu/images-proposed/hvm-instance/ubuntu-trusty-daily-%{a}-server-hwe-x
+
+#####################################################
+
+
+

=== added directory 'functions'
=== added file 'functions/common'
--- functions/common	1970-01-01 00:00:00 +0000
+++ functions/common	2016-03-22 02:54:49 +0000
@@ -0,0 +1,3 @@
+# common functions for cloud images
+
+CLOUD_IMG_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process"

=== added file 'gzip-rsyncable'
--- gzip-rsyncable	1970-01-01 00:00:00 +0000
+++ gzip-rsyncable	2016-03-22 02:54:49 +0000
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec gzip --rsyncable "$@"

=== added file 'img2roottgz'
--- img2roottgz	1970-01-01 00:00:00 +0000
+++ img2roottgz	2016-03-22 02:54:49 +0000
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} input-partition-image output-tarball
+
+   turn a .img file to a -root.tar.gz file
+
+   options:
+      --purge WILDCARD
+EOF
+}
+
+my_name=$(readlink -f ${0})
+my_path=$(dirname ${my_name})
+export PATH="${my_path}:${PATH}"
+
+error() { echo "$@" 1>&2; }
+bad_Usage() { Usage 1>&2; [ $# -eq 0 ] || error "$@"; return 1; }
+
+CLEAN_AND_TAR='
+#!/bin/bash
+set -e
+export LANG=C
+
+mp="$1"
+shift
+if [ $# -gt 0 ]; then
+	topurge=$(chroot_helper "$mp" dpkg -l "$@" |
+		awk "\$1 == ii { print \$2 }" ii=ii)
+	topurge=( $(set +f; echo $topurge) )
+	if [ "${#topurge[@]}" -ne 0 ]; then
+		purgecmd=( env DEBIAN_FRONTEND=noninteractive chroot_helper "$mp" apt-get
+		           --purge remove --assume-yes "${topurge[@]}" )
+		echo "removing:" "${topurge[@]}" 1>&2
+		if [ "${CLEAN_VERBOSE:-0}" != "0" ]; then
+			"${purgecmd[@]}" 1>&2 </dev/null
+		else
+			out=$("${purgecmd[@]}" 2>&1 </dev/null) || {
+				ret=$?
+				echo "FAILED[$ret]: ${purgecmd[*]}"
+				echo "$out"
+				exit $ret
+			} 1>&2
+		fi
+	else
+		echo "WARN: these did not match installed packages:" "$@" 1>&2
+	fi
+fi
+slist=( $(shopt -s dotglob && cd "$mp" && ls -d *) )
+
+attropts=( )
+if tar --help 2>&1 | grep -q xattr; then
+    attropts=( "--xattrs" "--xattrs-include=*" "--acls" )
+fi
+tar --use-compress-program=gzip-rsyncable \
+    "${attropts[@]}" \
+	-C "$mp" -Scpf - "${slist[@]}"
+'
+
+
+main() {
+	local short_opts="hv"
+	local long_opts="help,purge:,verbose"
+	local getopt_out=$(getopt --name "${0##*/}" \
+		--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+		eval set -- "${getopt_out}" ||
+		{ bad_Usage; return; }
+
+	local input="" output="" remove_kernels=false remove_grub=false
+	local cur="" next=""
+	local purges=""
+	purges=( )
+	while [ $# -ne 0 ]; do
+		cur="$1"; next="$2";
+		case "$cur" in
+			-h|--help) Usage ; exit 0;;
+			   --purge) purges[${#purges[@]}]="$next"; shift;;
+			-v|--verbose) VERBOSITY=$((${VERBOSITY}+1));;
+			--) shift; break;;
+		esac
+		shift;
+	done
+
+	[ $# -eq 2 ] || { bad_Usage "Expected input and output, got: $*"; return; }
+	input="$1"
+	output="$2"
+
+	[ "${#pglobs[@]}" -gt 0 ] && ro="--read-only" || ro=""
+	sudo env "PATH=$PATH" "mount-image-callback" $ro "$input" -- \
+		bash -c "$CLEAN_AND_TAR" -- _MOUNTPOINT_ "${purges[@]}" > "$output"
+	return
+}
+
+main "$@"
+
+# vi: ts=4 noexpandtab

=== added directory 'live-config'
=== added directory 'live-config/common'
=== added directory 'live-config/common/hooks'
=== added file 'live-config/common/hooks/020-pkg-configure.chroot'
--- live-config/common/hooks/020-pkg-configure.chroot	1970-01-01 00:00:00 +0000
+++ live-config/common/hooks/020-pkg-configure.chroot	2016-03-22 02:54:49 +0000
@@ -0,0 +1,32 @@
+#!/bin/bash
+# Configure certain packages
+
+## console-setup
+
+# Select the fontface 
+printf "%s\t%s\t%s\t%s\n" \
+    console-setup console-setup/console-setup/fontface47 string "Fixed" debconf-set-selections ||
+    { echo "FAILED to setup console fontface"; exit 1; }
+
+# Select the code page for font
+printf "%s\t%s\t%s\t%s\n" \
+    console-setup console-setup/codesetcode string "Uni2" | debconf-set-selections ||
+    { echo "FAILED to setup console code page to Uni2"; exit 1; }
+
+# Set Language string for codepage 47
+printf "%s\t%s\t%s\t%s\n" \
+    console-setup console-setup/codeset47 string ". Combined - Latin; Slavic Cyrillic; Greek" | debconf-set-selections ||
+    { echo "FAILED to setup codeset47 to proper string"; exti 1; }
+
+# Replace the console font and typ ein /etc/default/console-setup
+sed -i -e 's,^CODESET.*,CODESET="Uni2",g' \
+       -e 's,^FONTFACE.*,FONTFACE="Fixed",g' \
+          /etc/default/console-setup
+
+
+# Configure the console-setup
+dpkg-reconfigure --frontend=noninteractive console-setup ||
+    { echo "FAILED to recofigure console-setup"; exit 1; }
+
+# dpkg-configure fix
+#dpkg --configure -a

=== added file 'live-config/common/hooks/025-create-groups.chroot'
--- live-config/common/hooks/025-create-groups.chroot	1970-01-01 00:00:00 +0000
+++ live-config/common/hooks/025-create-groups.chroot	2016-03-22 02:54:49 +0000
@@ -0,0 +1,14 @@
+#!/bin/bash
+#
+#	Create the necessary users and set their passwords.  If needed,
+#	make sure they belong to the proper groups
+#
+# Author: Ben Howard <ben.howard@xxxxxxxxxxxxx>
+# Date:   29 Jun 2011
+#
+
+echo "Adding admin group..."
+addgroup --system --quiet admin
+
+echo "Adding netdev group..."
+addgroup --system --quiet netdev

=== added file 'live-config/common/hooks/030-create-users.chroot'
--- live-config/common/hooks/030-create-users.chroot	1970-01-01 00:00:00 +0000
+++ live-config/common/hooks/030-create-users.chroot	2016-03-22 02:54:49 +0000
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+#	Create the necessary users and set their passwords.  If needed,
+#	make sure they belong to the proper groups
+#
+# Author: Ben Howard <ben.howard@xxxxxxxxxxxxx>
+# Date:   29 Jun 2011
+
+codename=$(sh -c 'lsb_release --short --codename')
+dist_ge() { [[ "$1" > "$2" || "$1" == "$2" ]]; }
+
+if dist_ge "${codename}" quantal; then
+    echo "User creation on 12.10 is handled by cloud-init."
+    exit 0
+fi
+
+echo "Adding ubuntu user..."
+useradd -U -m ubuntu  -c "Ubuntu" --shell /bin/bash
+usermod -a -G adm,admin,audio,cdrom,dialout,floppy,video,plugdev,dip,netdev ubuntu
+gpasswd -a ubuntu netdev
+echo "ubuntu:ubuntu" | chpasswd
+
+echo "Locking ubuntu user..."
+usermod --lock ubuntu
+
+echo "Disabling root user..."
+usermod --lock root
+
+echo "Enabling sudo for user"
+cat > /etc/sudoers.d/90-cloudimg-ubuntu <<EOF
+# ubuntu user is default user in cloud-images.
+# It needs passwordless sudo functionality.
+ubuntu ALL=(ALL) NOPASSWD:ALL
+EOF
+chmod 0440 /etc/sudoers.d/90-cloudimg-ubuntu
+

=== added file 'live-config/common/hooks/051-hwclock.chroot'
--- live-config/common/hooks/051-hwclock.chroot	1970-01-01 00:00:00 +0000
+++ live-config/common/hooks/051-hwclock.chroot	2016-03-22 02:54:49 +0000
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+printf "HWCLOCKACCESS=no" >> /etc/default/rcS

=== added file 'live-config/common/hooks/052-ssh_authentication.chroot'
--- live-config/common/hooks/052-ssh_authentication.chroot	1970-01-01 00:00:00 +0000
+++ live-config/common/hooks/052-ssh_authentication.chroot	2016-03-22 02:54:49 +0000
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+sed -i "s|#PasswordAuthentication yes|PasswordAuthentication no|g" /etc/ssh/sshd_config

=== added file 'live-config/common/hooks/060-ipv6.chroot'
--- live-config/common/hooks/060-ipv6.chroot	1970-01-01 00:00:00 +0000
+++ live-config/common/hooks/060-ipv6.chroot	2016-03-22 02:54:49 +0000
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Disable IPv6 privacy extensions on Utopic and later
+#
+
+codename=$(sh -c 'lsb_release --short --codename')
+dist_ge() { [[ "$1" > "$2" || "$1" == "$2" ]]; }
+
+if ! dist_ge "${codename}" "trusty"; then
+    exit 0
+fi
+
+cat << EOF > /etc/sysctl.d/99-cloudimg-ipv6.conf
+# Written by the Cloud Image build process
+# See https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1068756
+net.ipv6.conf.all.use_tempaddr = 0
+net.ipv6.conf.default.use_tempaddr = 0
+EOF

=== added file 'live-config/common/hooks/098-apt-sources.chroot'
--- live-config/common/hooks/098-apt-sources.chroot	1970-01-01 00:00:00 +0000
+++ live-config/common/hooks/098-apt-sources.chroot	2016-03-22 02:54:49 +0000
@@ -0,0 +1,29 @@
+#!/bin/bash
+release=$(lsb_release -c -s)
+security_url="http://security.ubuntu.com/ubuntu";
+package_url="http://archive.ubuntu.com/ubuntu";
+
+case "$(dpkg --print-architecture)" in
+    i386|amd64)
+        security_url="http://security.ubuntu.com/ubuntu"; 
+        package_url="http://archive.ubuntu.com/ubuntu";
+        ;;
+    *)
+        security_url="http://ports.ubuntu.com/ubuntu-ports";
+        package_url="${security_url}"
+        ;;
+esac
+
+cat << EOF > /etc/apt/sources.list
+deb ${package_url} ${release} main restricted universe multiverse
+deb ${package_url} ${release}-updates main restricted universe multiverse
+deb ${security_url} ${release}-security main restricted universe multiverse
+EOF
+
+#Cleanup and resync packages
+
+apt-get clean || echo "Non-fatal error, unable to cleanup packages"
+apt-get update || {
+    echo "FATAL! Unable to run 'apt-get update'"
+    exit 10
+}

=== added file 'live-config/common/hooks/099-cleanup.chroot'
--- live-config/common/hooks/099-cleanup.chroot	1970-01-01 00:00:00 +0000
+++ live-config/common/hooks/099-cleanup.chroot	2016-03-22 02:54:49 +0000
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+# Clean up extraneous log files that may be left around
+rm /etc/ssh/ssh_host*key*      		|| echo "No SSH keys to remove"
+
+# Fix LP: #1047707, 1019338
+# Truncate logs that are owned, otherwise remove
+whitelisted_logs=(/var/log/btmp /var/log/lastlog /var/log/wtmp /var/log/fsck/checkfs /var/log/fsck/checkroot)
+
+for log in $(find /var/log -type f)
+do
+    whitelisted=$(echo "${whitelisted_logs[@]}" | grep -o ${log})
+
+    if [ -n "${whitelisted}" ]; then
+        : > ${log} &&
+            echo "Truncated whitelisted log ${log}" ||
+            echo "Failed to truncate whitelisted log ${log}"
+    else
+
+       dpkg -S ${log} > /dev/null 2>&1 &&
+           { : > ${log} ||
+                echo "Failed to truncate $f"; } ||
+           { rm ${log} &&
+               echo "Removed ${log} as an orphaned log file" ||
+               echo "Failed to remove unnecessary log $f"; }
+    fi
+done
+
+# Remove un-owned log directories
+whitelisted_dirs=(/var/log/fsck)
+
+for log_d in $(find /var/log/* -type d)
+do
+    whitelisted=$(echo "${whitelisted_dirs[@]}" | grep -o "${log_d}")
+    if [ -z "${whitelisted}" ]; then
+        dpkg -S ${log_d} > /dev/null 2>&1 &&
+            echo "Preserving log directory ${log_d}" ||
+            { rm -rf ${log_d} &&
+                echo "Removed log directory ${log_d} as orphaned log dir" ||
+                echo "Failed to remove unnessasary log dir ${log_d}"; }
+
+    else
+        echo "Preserving whitelisted directory ${log_d}"
+    fi
+
+done
+
+
+rm -rf /var/run/*       	        || echo "Failed to clean /var/run/*"
+rm /etc/passwd-  	                || echo "No spare passwd file to cleanup"
+rm /etc/shadow-     				|| echo "No spare shadow file to cleanup"
+rm /etc/gshadow-		        	|| echo "No spare gshadow file to cleanup"
+rm /etc/group- 	        			|| echo "No spare group file to clenaup"
+rm -f /etc/apt/conf.d/00secure  	|| echo "No apt cache to cleanup"
+
+# Truncate instead of delete, LP: #707311
+truncate --size=0 -c /etc/popularity-contest.conf
+
+exit 0

=== added directory 'live-config/common/includes.chroot'
=== added directory 'live-config/common/includes.chroot/etc'
=== added file 'live-config/common/includes.chroot/etc/hostname'
--- live-config/common/includes.chroot/etc/hostname	1970-01-01 00:00:00 +0000
+++ live-config/common/includes.chroot/etc/hostname	2016-03-22 02:54:49 +0000
@@ -0,0 +1,1 @@
+ubuntu

=== added file 'live-config/common/includes.chroot/etc/hosts'
--- live-config/common/includes.chroot/etc/hosts	1970-01-01 00:00:00 +0000
+++ live-config/common/includes.chroot/etc/hosts	2016-03-22 02:54:49 +0000
@@ -0,0 +1,9 @@
+127.0.0.1 localhost
+
+# The following lines are desirable for IPv6 capable hosts
+::1 ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+ff02::3 ip6-allhosts

=== added directory 'live-config/common/includes.chroot/etc/network'
=== added file 'live-config/common/includes.chroot/etc/network/interfaces'
--- live-config/common/includes.chroot/etc/network/interfaces	1970-01-01 00:00:00 +0000
+++ live-config/common/includes.chroot/etc/network/interfaces	2016-03-22 02:54:49 +0000
@@ -0,0 +1,15 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# Source interfaces
+# Please check /etc/network/interfaces.d before changing this file
+# as interfaces may have been defined in /etc/network/interfaces.d
+# NOTE: the primary ethernet device is defined in
+# /etc/network/interfaces.d/eth0
+# See LP: #1262951
+source /etc/network/interfaces.d/*.cfg
+

=== added directory 'live-config/common/includes.chroot/etc/network/interfaces.d'
=== added file 'live-config/common/includes.chroot/etc/network/interfaces.d/eth0.cfg'
--- live-config/common/includes.chroot/etc/network/interfaces.d/eth0.cfg	1970-01-01 00:00:00 +0000
+++ live-config/common/includes.chroot/etc/network/interfaces.d/eth0.cfg	2016-03-22 02:54:49 +0000
@@ -0,0 +1,3 @@
+# The primary network interface
+auto eth0
+iface eth0 inet dhcp

=== added directory 'live-config/qemu-static'
=== added file 'live-config/qemu-static/README'
--- live-config/qemu-static/README	1970-01-01 00:00:00 +0000
+++ live-config/qemu-static/README	2016-03-22 02:54:49 +0000
@@ -0,0 +1,4 @@
+Some versions of qemu-*-static are broken, i.e. lucid. 
+
+In order to build ARMEL on AMD64/i386 hosts, qemu-*-static images will need to be built. 
+ 

=== added file 'live-config/qemu-static/build-qemu-static.sh'
--- live-config/qemu-static/build-qemu-static.sh	1970-01-01 00:00:00 +0000
+++ live-config/qemu-static/build-qemu-static.sh	2016-03-22 02:54:49 +0000
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+my_path=$(pwd)
+build_binary="qemu-arm"
+host_type=$(lsb_release -c -s)
+src_loc="http://git.linaro.org/git/qemu/qemu-linaro.git";
+build_tmp=$(mktemp -d)
+build_bin="${build_tmp}/arm-linux-user/${build_binary}"
+bin_final="${my_path}/${host_type}/qemu-arm-static"
+qemu_config_opts='--static --target-list=arm-linux-user'
+
+error() { echo "$@" 1>&2; }
+fail() { [ $# -eq 0 ] || error "$@"; rm -rf ${build_tmp}; exit 1; }
+
+mkdir "${my_path}/${host_type}" 2> /dev/null 
+
+for pkg in libglib2.0-dev git git-core zlib1g-dev
+do
+    sudo apt-get -y install $pkg
+done
+
+
+git_bin=$(which git) ||
+	fail "Unable to find git binaries, please run 'apt-get install git'"
+
+${git_bin} clone "${src_loc}" "${build_tmp}" || 
+	fail "Unable to clone git source from $src_loc"
+
+cd ${build_tmp}
+./configure ${qemu_config_opts} ||
+	fail "Failed to configure qemu"
+
+make ||
+	fail "Failed to make qemu"
+
+[ -e "${build_bin}" ] || 
+	fail "Did not find final binary at ${build_bin}"
+
+cp ${build_bin} ${bin_final} ||
+	fail "Failed to copy static binary from build path."
+
+echo "Final binary found ${bin_final}"
+
+cd ${my_path}

=== added file 'livefs-build.py'
--- livefs-build.py	1970-01-01 00:00:00 +0000
+++ livefs-build.py	2016-03-22 02:54:49 +0000
@@ -0,0 +1,170 @@
+#!/usr/bin/env python
+import argparse
+import os.path
+import sys
+import time
+from collections import defaultdict
+from multiprocessing import Process
+from urllib import ContentTooShortError, urlretrieve
+
+from launchpadlib.launchpad import Launchpad
+from launchpadlib.credentials import UnencryptedFileCredentialStore
+from lazr.restfulclient.errors import NotFound
+
+
+LIVEFS_OWNER = '~cloud-images-release-managers'
+
+
+def mangle_ppa_shortcut(shortcut):
+    ppa_shortcut = shortcut.split(":")[1]
+    user = ppa_shortcut.split("/")[0]
+    if (user[0] == "~"):
+        user = user[1:]
+    ppa_path_objs = ppa_shortcut.split("/")[1:]
+    ppa_path = []
+    if (len(ppa_path_objs) < 1):
+        ppa_path = ['ubuntu', 'ppa']
+    elif (len(ppa_path_objs) == 1):
+        ppa_path.insert(0, "ubuntu")
+        ppa_path.extend(ppa_path_objs)
+    else:
+        ppa_path = ppa_path_objs
+    ppa = "~%s/%s" % (user, "/".join(ppa_path))
+    return ppa
+
+
+def _get_livefs(lp, livefs_name, suite, image_format, project):
+    kwargs = {
+        'distro_series': '/ubuntu/{}'.format(suite),
+        'name': livefs_name,
+        'owner': '/{}'.format(LIVEFS_OWNER),
+    }
+    try:
+        return lp.livefses.getByName(**kwargs)
+    except NotFound:
+        kwargs['metadata'] = {}
+        return lp.livefses.new(**kwargs)
+
+
+def trigger_build(lp, livefs_name, suite, arch, image_format, project,
+                  archive=None, proposed=False):
+    if archive is None:
+        reference = 'ubuntu'
+    elif archive.startswith('ppa:'):
+        reference = mangle_ppa_shortcut(archive)
+    else:
+        raise Exception('We only support archives like ppa:person/ppa.')
+    archive = lp.archives.getByReference(reference=reference)
+    lfs = _get_livefs(lp, livefs_name, suite, image_format, project)
+    metadata = {'image_format': image_format, 'project': project}
+    build = lfs.requestBuild(
+        pocket='Updates' if not proposed else 'Proposed',
+        archive=archive,
+        distro_arch_series='/ubuntu/{}/{}'.format(suite, arch),
+        metadata_override=metadata)
+    print "Build queued; track progress at {}".format(build.web_link)
+    return build
+
+
+def _start_download(file_url, target_path):
+    def perform_download(file_url, target_path, iteration=0):
+        print('Downloading {} to {}...'.format(file_url, target_path))
+        try:
+            urlretrieve(file_url, target_path)
+        except ContentTooShortError:
+            if iteration > 4:
+                raise
+            perform_download(file_url, target_path, iteration=iteration+1)
+    p = Process(target=perform_download, args=(file_url, target_path))
+    p.start()
+    return p
+
+
+def download(build, target_prefix):
+    mapping = {
+        '.ext4': '.ext4',
+        '.img': '.ext4',
+        '.manifest': '.manifest',
+        '.tar.gz': '-root.tar.gz',
+    }
+    file_urls = build.getFileUrls()
+    print("{} build completed; the following files were created:\n{}".format(
+        build.distro_arch_series.architecture_tag, '\n'.join(file_urls)))
+    download_processes = set()
+    for file_url in file_urls:
+        for suffix in mapping:
+            if file_url.endswith(suffix):
+                target_path = '{}{}'.format(target_prefix, mapping[suffix])
+                download_processes.add(_start_download(file_url, target_path))
+    print("Waiting for downloads to complete.")
+    for process in download_processes:
+        process.join()
+
+
+def fetch_build_log(build, target_dir):
+    target_path = os.path.join(target_dir, 'build_log.txt.gz')
+    process = _start_download(build.build_log_url, target_path)
+    process.join()
+
+
+def main(livefs_name, suite, arch, download_directory, image_format, project,
+         archive=None, cred_location=None, proposed=False):
+    if not os.path.exists(download_directory):
+        raise Exception(
+            'Download directory {} does not exist.'.format(download_directory))
+    if cred_location is None:
+        cred_location = os.path.expanduser('~/.lp_creds')
+    print "Using creds in {}".format(cred_location)
+    credential_store = UnencryptedFileCredentialStore(cred_location)
+    lp = Launchpad.login_with('cpc', 'production', version='devel',
+                              credential_store=credential_store)
+    build = trigger_build(lp, livefs_name, suite, arch, image_format, project,
+                          archive=archive, proposed=proposed)
+    try:
+        previous_buildstate = defaultdict(unicode)
+        while build.buildstate != 'Successfully built':
+            if build.buildstate != previous_buildstate:
+                print '{} build now in "{}" state'.format(
+                    arch, build.buildstate)
+                previous_buildstate = build.buildstate
+            if build.buildstate in ['Cancelled build', 'Failed to build']:
+                fetch_build_log(build, download_directory)
+                sys.exit(1)
+            time.sleep(10)
+            build.lp_refresh()
+    finally:
+        build.lp_refresh()
+        if build.can_be_cancelled:
+            print 'Scheduling build cancellation...'
+            build.cancel()
+    fetch_build_log(build, download_directory)
+    target_prefix = 'ubuntu-{}-core-cloudimg-{}'.format(suite, arch)
+    target_path = os.path.join(download_directory, target_prefix)
+    download(build, target_path)
+    print("All downloads complete; done!")
+
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(
+        description="Build an Ubuntu Core tarball using Launchpad's buildds.")
+    parser.add_argument('--download-directory', default='.',
+                        help='The directory to download files to.')
+    parser.add_argument('--livefs-name', default='docker-ubuntu-core',
+                        help="The name of the livefs to build in.")
+    parser.add_argument('--livefs-owner', default=LIVEFS_OWNER,
+                        help='The owner of the livefs to build in.')
+    parser.add_argument('--suite', required=True, help="The suite to build.")
+    parser.add_argument('--arch', required=True, help="The arch to build.")
+    parser.add_argument('--archive',
+                        help="An (optional) archive to build the image from.")
+    parser.add_argument('--image-format', default='plain',
+                        help='The image format to build.')
+    parser.add_argument('--project', default='ubuntu-core',
+                        help='The project to build.')
+    parser.add_argument('--cred-location',
+                        help='The location of the LP creds.')
+    parser.add_argument('--proposed', action='store_true')
+    args = parser.parse_args()
+    main(args.livefs_name, args.suite, args.arch, args.download_directory,
+         args.image_format, args.project, archive=args.archive,
+         cred_location=args.cred_location, proposed=args.proposed)

=== added directory 'loaders'
=== added file 'loaders/floppy-maverick-20111012.img'
Binary files loaders/floppy-maverick-20111012.img	1970-01-01 00:00:00 +0000 and loaders/floppy-maverick-20111012.img	2016-03-22 02:54:49 +0000 differ
=== added file 'loaders/grub-maverick-20100729.img'
Binary files loaders/grub-maverick-20100729.img	1970-01-01 00:00:00 +0000 and loaders/grub-maverick-20100729.img	2016-03-22 02:54:49 +0000 differ
=== added directory 'loaders/oneiric-armel'
=== added file 'loaders/oneiric-armel/MLO'
Binary files loaders/oneiric-armel/MLO	1970-01-01 00:00:00 +0000 and loaders/oneiric-armel/MLO	2016-03-22 02:54:49 +0000 differ
=== added file 'loaders/oneiric-armel/u-boot.bin'
Binary files loaders/oneiric-armel/u-boot.bin	1970-01-01 00:00:00 +0000 and loaders/oneiric-armel/u-boot.bin	2016-03-22 02:54:49 +0000 differ
=== added directory 'loaders/precise-armhf'
=== added file 'loaders/precise-armhf/MLO'
Binary files loaders/precise-armhf/MLO	1970-01-01 00:00:00 +0000 and loaders/precise-armhf/MLO	2016-03-22 02:54:49 +0000 differ
=== added file 'loaders/precise-armhf/u-boot.bin'
Binary files loaders/precise-armhf/u-boot.bin	1970-01-01 00:00:00 +0000 and loaders/precise-armhf/u-boot.bin	2016-03-22 02:54:49 +0000 differ
=== added directory 'loaders/quantal-armhf'
=== added file 'loaders/quantal-armhf/MLO'
Binary files loaders/quantal-armhf/MLO	1970-01-01 00:00:00 +0000 and loaders/quantal-armhf/MLO	2016-03-22 02:54:49 +0000 differ
=== added file 'loaders/quantal-armhf/u-boot.bin'
Binary files loaders/quantal-armhf/u-boot.bin	1970-01-01 00:00:00 +0000 and loaders/quantal-armhf/u-boot.bin	2016-03-22 02:54:49 +0000 differ
=== added directory 'loaders/raring-armhf'
=== added file 'loaders/raring-armhf/MLO'
Binary files loaders/raring-armhf/MLO	1970-01-01 00:00:00 +0000 and loaders/raring-armhf/MLO	2016-03-22 02:54:49 +0000 differ
=== added file 'loaders/raring-armhf/u-boot.bin'
Binary files loaders/raring-armhf/u-boot.bin	1970-01-01 00:00:00 +0000 and loaders/raring-armhf/u-boot.bin	2016-03-22 02:54:49 +0000 differ
=== added file 'lxd_metadata'
--- lxd_metadata	1970-01-01 00:00:00 +0000
+++ lxd_metadata	2016-03-22 02:54:49 +0000
@@ -0,0 +1,135 @@
+#!/bin/bash
+
+# Create the LXD metadata tar.xz file named in $1
+
+## The following environment variable are required:
+##  serial
+##  arch
+##  suite
+
+set -xe
+DEST=${1?}
+
+# Double duty command output and variable check
+cat << EOF
+Generating LXD metadata for:
+serial=${serial?}
+arch=${arch?}
+suite=${suite?}
+EOF
+
+cleanup() {
+    [ -z "${TMP_D}" -o ! -d "${TMP_D}" ] || rm -rf "${TMP_D}"
+}
+trap cleanup EXIT SIGINT SIGTERM
+
+OUT_D=`dirname ${DEST}`
+TMP_D=`mktemp --directory --tmpdir=${OUT_D}`
+
+# Distro -> LXD architecture translation table
+ARCH_TABLE="i386 i686
+amd64 x86_64
+armhf armv7l
+arm64 aarch64
+powerpc ppc
+ppc64el ppc64le"
+
+lxd_arch() {
+    arch=$1
+    echo "$ARCH_TABLE" | grep $arch | cut -d' ' -f2
+}
+
+ubuntu_fullversion() {
+    grep -i $1 /usr/share/distro-info/ubuntu.csv | cut -d, -f1
+}
+
+date=`date +%s`
+arch=`lxd_arch ${arch}`
+
+cat > "${TMP_D}/metadata.yaml" << EOF
+architecture: "${arch}"
+creation_date: ${date}
+properties:
+    architecture: "${arch}"
+    description: "Ubuntu `ubuntu_fullversion ${suite}` server (${serial})"
+    os: "ubuntu"
+    release: "${suite}"
+templates:
+    /var/lib/cloud/seed/nocloud-net/meta-data:
+        when:
+            - create
+            - copy
+        template: cloud-init-meta.tpl
+    /var/lib/cloud/seed/nocloud-net/user-data:
+        when:
+            - create
+            - copy
+        template: cloud-init-user.tpl
+        properties:
+            default: |
+                #cloud-config
+                {}
+    /var/lib/cloud/seed/nocloud-net/vendor-data:
+        when:
+            - create
+            - copy
+        template: cloud-init-vendor.tpl
+        properties:
+            default: |
+                #cloud-config
+                {}
+    /etc/network/interfaces.d/eth0.cfg:
+        when:
+            - create
+        template: interfaces.tpl
+    /etc/init/console.override:
+        when:
+            - create
+        template: upstart-override.tpl
+    /etc/init/tty1.override:
+        when:
+            - create
+        template: upstart-override.tpl
+    /etc/init/tty2.override:
+        when:
+            - create
+        template: upstart-override.tpl
+    /etc/init/tty3.override:
+        when:
+            - create
+        template: upstart-override.tpl
+    /etc/init/tty4.override:
+        when:
+            - create
+        template: upstart-override.tpl
+EOF
+
+TMPL_D="${TMP_D}/templates"
+mkdir "${TMPL_D}"
+
+cat > "${TMPL_D}/cloud-init-user.tpl" << EOF
+{{ config_get("user.user-data", properties.default) }}
+EOF
+
+cat > "${TMPL_D}/cloud-init-meta.tpl" << EOF
+#cloud-config
+instance-id: {{ container.name }}
+local-hostname: {{ container.name }}
+{{ config_get("user.meta-data", "") }}
+EOF
+
+cat > "${TMPL_D}/cloud-init-vendor.tpl" << EOF
+{{ config_get("user.vendor-data", properties.default) }}
+EOF
+
+cat > "${TMPL_D}/upstart-override.tpl" << EOF
+manual
+EOF
+
+cat > "${TMPL_D}/interfaces.tpl" << EOF
+# The primary network interface
+auto eth0
+iface eth0 inet {% if config_get("user.network_mode", "") == "link-local" %}manual{% else %}dhcp{% endif %}
+EOF
+
+tar --xz -cvf "${DEST}" -C ${TMP_D} metadata.yaml templates

=== added directory 'misc'
=== added file 'misc/devel-builder'
--- misc/devel-builder	1970-01-01 00:00:00 +0000
+++ misc/devel-builder	2016-03-22 02:54:49 +0000
@@ -0,0 +1,191 @@
+#!/bin/bash
+# Setup up the build environment by doing bzr checkouts for development purpouses
+# Unlike the other builders, this one is focused on developers. It allows you to
+# build based on your bzr branches.
+#
+# This is developer builder
+
+TEMP_D=""
+VERBOSITY=0
+DEPS=(
+    bzr kpartx gdisk qemu-utils zerofree debootstrap
+    python-vm-builder # lucid builds with vm-builder, but need its deps
+    u-boot-utils # only necessary for arm
+)
+error() { echo "$@" 1>&2; }
+fail() {
+    [ $# -eq 0 ] || error "$@";
+    echo "Failed" > /tmp/failed;
+    exit 1;
+}
+debug() { [ "$VERBOSITY" = "0" ] && return 0; error "$(date -R):" "$@"; }
+sysfail() { fail "General failure!"; }
+cleanup() {
+    [ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+
+bad_usage() {
+    cat <<EOM
+
+Build a cloud image:
+    --serial: the serial of the image
+    --distro: distro name, i.e. Trusty
+    --arch: the architecture, i.e. amd64
+    --buildname: server, unless you know what your doing
+    --automated: BZR branch of automated builds
+    --livebuild: the Ubuntu cloud image bzr branch for that
+    --vmbuilder: BZR branch of vmbuilder
+    --no-check: path of previous check outs
+    --pack-only: check out BZR branches and create a tarball
+                 you can then use that with --no-check
+    --install-deps: install dependant pkgs
+    --proposed: build from proposed
+
+This is a developer builder. After you do you first run, you can
+use "--no-check <path>" to avoid checking stuff out all over again.
+
+To get the patches, run "--no-check <path> --get-patches <file>"
+
+EOM
+}
+
+trap sysfail SIGINT SIGTERM
+trap cleanup EXIT
+short_opts="hv"
+long_opts="arch:,automated:,buildname:,distro:,help,install-deps,livebuild:,no-check:,pack-only:,serial:,verbose:,vmbuilder:,get-patches:,proposed"
+getopt_out=$(getopt --name "${0##*/}" \
+    --options "${short_opts}" --long "${long_opts}" -- "$@") &&
+    eval set -- "${getopt_out}" ||
+        bad_usage
+
+distro="trusty"
+arch="amd64"
+build_name="server"
+serial="$(date +%Y%m%d)"
+no_check=""
+pack_only=""
+get_patches=""
+proposed=0
+
+BZR_AUTOMATED_EC2_BUILDS="http://bazaar.launchpad.net/~ubuntu-on-ec2/vmbuilder/automated-ec2-builds";
+BZR_LIVEBUILD="http://bazaar.launchpad.net/~ubuntu-on-ec2/live-build/cloud-images/";
+BZR_VMBUILDER="http://bazaar.launchpad.net/~ubuntu-on-ec2/vmbuilder/0.11a";
+
+while [ $# -ne 0 ]; do
+    cur=${1}; next=${2};
+    case "$cur" in
+        --serial) serial=${next}; shift;;
+        --distro) distro=${next}; shift;;
+        --buildname) build_name=${next}; shift;;
+        --arch) arch=${next}; shift;;
+        --automated) BZR_AUTOMATED_EC2_BUILDS=${next}; shift;;
+        --livebuild) BZR_LIVEBUILD=${next}; shift;;
+        --vmbuilder) BZR_VMBUILDER=${next}; shift;;
+        --no-check) no_check=${next}; shift;;
+        --pack-only) pack_only=${next}; shift;;
+        --get-patches) get_patches=${next}; shift;;
+        --install-deps) install_deps=1;;
+        --proposed) proposed=1;;
+        -v|--verbose) VERBOSITY=$(($VERBOSITY+1));;
+        --) shift; break;;
+    esac
+    shift;
+done
+
+[ -n "$no_check" -a -n "$install_deps" ] &&
+    fail "no-check is incompatible with install-deps"
+
+TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/build.XXXXXX")
+co_dir=${TEMP_D}
+if [ -n "$no_check" ]; then
+    no_check=$(cd "$no_check" && pwd) ||
+        fail "failed to get full path for --no-check" 
+    co_dir=${no_check}
+fi
+
+# Set up the path
+AB_D="${co_dir}/automated-ec2-builds"
+VB_D="${co_dir}/vmbuilder-0.11"
+LB_D="${co_dir}/live-build"
+PATH="${AB_D}:${VB_D}:${EC2PUB_D}:$PATH"
+
+# Check out the builder tools
+if [ -z "${no_check}" ]; then
+    debug "branching ${BZR_AUTOMATED_EC2_BUILDS}"
+    bzr branch "${BZR_AUTOMATED_EC2_BUILDS}" "${AB_D}"
+    debug "branching ${BZR_LIVEBUILD}"
+    bzr branch "${BZR_LIVEBUILD}" "${LB_D}"
+    debug "branching ${BZR_VMBUILDER}"
+    bzr branch "${BZR_VMBUILDER}" "${VB_D}"
+fi
+
+# Create a tarball
+if [ -n "${pack_only}" ]; then
+    tar -C "$co_dir" -aczf "${pack_only}" \
+        "${AB_D##*/}" "${VB_D##*/}" "${LB_D##*/}" ||
+        fail "failed to create tarball of checked out code"
+    error "wrote ${pack_only}"
+    exit 0
+fi
+
+# Get the patches out
+if [ -n "${get_patches}" ]; then
+    PATCH_D=$(mktemp -d "${TMPDIR:-/tmp}/patch.XXXXXX")
+    bzr diff -p1 "${AB_D}" > "${PATCH_D}/automated_ec2_builds.patch"
+    bzr diff -p1 "${LB_D}" > "${PATCH_D}/live_build.patch"
+    bzr diff -p1 "${VB_D}" > "${PATCH_D}/vmbuilder.patch"
+    tar -C "${PATCH_D}" -acvf "${get_patches}" .
+    exit 0
+fi
+
+# Set stuff up
+dest="${PWD}/${distro}-${arch}"
+img_base="${distro}-${arch}"
+description="${distro}-${arch}"
+partfile="${dest}/partfile"
+
+# Make sure the distro is supported
+debootstrap_parent_definition="/usr/share/debootstrap/scripts/gutsy"
+debootstrap_definition="/usr/share/debootstrap/scripts/${distro}"
+[ -e "${debootstrap_definition}" ] ||
+    ln -s "${debootstrap_parent_definition}" "${debootstrap_definition}" ||
+    fail "Unable to create debootstrap definition for ${distro}"
+
+mkdir -p "${dest}" ||
+    fail "Unable to create destination directory"
+
+if [ "${install_deps:-0}" -eq 1 ]; then
+    debug "installing dependencies"
+    sudo apt-get --quiet --assume-yes update &&
+    sudo apt-get --quiet --assume-yes install "${DEPS[@]}" ||
+        fail "update/upgrade failed"
+fi
+
+export LIVE_BUILD_PATH="${LB_D}"
+
+if [[ "${arch}" =~ "arm64" ]]; then
+    conf="${AB_D}/conf/${distro}-arm64-${build_name}.conf"
+elif [[ "${arch}" =~ "arm" ]]; then
+    conf="${AB_D}/conf/${distro}-arm-${build_name}.conf"
+    sudo apt-get --quiet --assume-yes install u-boot-utils
+else
+    conf="${AB_D}/conf/${distro}-${arch}-${build_name}.conf"
+    if [ ! -e "$conf" ]; then
+        conf="${AB_D}/conf/${distro}-${build_name}.conf"
+    fi
+fi
+
+echo "using conf at ${conf}"
+source "${conf}" || fail "failed to read ${conf}"
+
+cmd=("${AB_D}/build-ec2-image"
+     "--serial=${serial}"
+     "${conf}"
+     "${dest}")
+
+[ "${proposed:-0}" -eq 1 ] && cmd+=("--proposed")
+
+arches=${arch} ${cmd[@]} ||
+        fail "Failed to build image!"
+
+# vi: ts=4 expandtab

=== added file 'misc/ec2-build-dist-on-ec2'
--- misc/ec2-build-dist-on-ec2	1970-01-01 00:00:00 +0000
+++ misc/ec2-build-dist-on-ec2	2016-03-22 02:54:49 +0000
@@ -0,0 +1,84 @@
+#!/bin/bash
+###
+### This is a script build all archs on ec2.  It calls build-ec2-image
+### and downloads everything it needs. Should be able to call on a fresh
+### instance
+###
+### you can download it with:
+###    wget http://build-ubuntu-on-ec2.notlong.com -O ec2-build-on-ec2
+set -e
+
+suite=${1}
+mod_dns=${2:-yes}
+dest="$PWD/${suite}"
+img_base="${suite}"
+partfile="${dest}/partfile"
+[ $# -eq 1 ] ||
+   { echo "must give suite"; exit 1; }
+
+# one time setup stuff
+toinst=( )
+for p in bzr python-vm-builder resolvconf dnsmasq virtualbox-ose qemu-kvm qemu-kvm-extras-static qemu-kvm-extras; do
+   ver=$(dpkg-query --show --showformat '${Version}\n' "${p}") || :
+   [ -z "${ver}" ] && toinst[${#toinst[@]}]="${p}"
+done
+
+[ ${#toinst} -eq 0 ] || sudo apt-get install --assume-yes "${toinst[@]}"
+
+[ ${mod_dns} = "yes" ] && {
+	mark="### USE_EC2_MIRRORS ###"
+	if ! grep -q "${mark}" /etc/hosts; then
+	   sudo service resolvconf restart
+	   sudo ifdown eth0; sudo ifup eth0
+	   mirror=$(sed -n '/archive.ubuntu.com/s,.*http://\([^/]*\).*,\1,p' \
+	      /etc/apt/sources.list | sort -u )
+	   echo "setting up mirror: archive.ubuntu.com -> ${mirror}"
+	   ip=""
+	   for n in 1 2 3 4; do
+	      ip=$(host "${mirror}" |
+		 awk '$2 == "has"  && $3 == "address" { print $4 ; exit(0); }')
+	      [ -z "${ip}" ] || break
+	      echo "waiting a bit for dns"; sleep ${n}
+	   done
+	   [ -n "${ip}" ] || { echo "couldn't set up dnsmasq hack?"; exit 1; }
+	   sudo sh -c "{ echo '${mark}'; echo '${ip} archive.ubuntu.com us.archive.ubuntu.com'; } >> /etc/hosts"
+	   sudo service dnsmasq restart
+	fi
+}
+
+[ -f "/usr/share/debootstrap/scripts/${suite}" ] ||
+	sudo ln -s gutsy "/usr/share/debootstrap/scripts/${suite}"
+
+[ -d vmbuilder-0.11 ] ||
+   bzr branch lp:~ubuntu-virt/vmbuilder/0.11 vmbuilder-0.11
+[ -d automated-ec2-builds ] ||
+   bzr branch lp:~ubuntu-on-ec2/vmbuilder/automated-ec2-builds
+[ -d live-build ] ||
+   bzr branch lp:~ubuntu-on-ec2/live-build/cloud-images live-build
+[ -d ec2-publishing-scripts ] ||
+   bzr branch lp:~ubuntu-on-ec2/ubuntu-on-ec2/ec2-publishing-scripts
+
+### end onetime setup
+
+AB_D="${PWD}/automated-ec2-builds"
+VB_D="${PWD}/vmbuilder-0.11"
+EC2PUB_D="${PWD}/ec2-publishing-scripts"
+PATH="${AB_D}:${VB_D}:${EC2PUB_D}:$PATH"
+
+export LIVE_BUILD_PATH="${PWD}/live-build"
+
+serial=$(date +%Y%m%d)
+conf="${AB_D}/conf/${suite}"
+source ${conf}.conf
+build-ec2-image --serial=${serial} "${conf}.conf" "${dest}"
+
+# Process nested configurations
+[ -n "${extra_arches}" ] && {
+    for nested_conf in "${extra_arches}"
+    do
+        echo "Processing nested configuration file ${nested_conf}"
+        build-ec2-image --serial=${serial} "${AB_D}/conf/${nested_conf}" "${dest}"
+    done
+}
+
+

=== added file 'misc/ec2-build-on-ec2'
--- misc/ec2-build-on-ec2	1970-01-01 00:00:00 +0000
+++ misc/ec2-build-on-ec2	2016-03-22 02:54:49 +0000
@@ -0,0 +1,81 @@
+#!/bin/bash
+###
+### This is a script to run a build on ec2.  It calls build-ec2-image
+### and downloads everything it needs. Should be able to call on a fresh
+### instance
+###
+### you can download it with:
+###    wget http://build-ubuntu-on-ec2.notlong.com -O ec2-build-on-ec2
+set -e
+
+suite=${1}
+arch=${2}
+build_name=${3:-server}
+mod_dns=${4:-no}
+
+dest="$PWD/${suite}-${arch}"
+img_base="${suite}-${arch}"
+description="${suite}-${arch}"
+partfile="${dest}/partfile"
+[ $# -eq 2 -o $# -eq 3 -o $# -eq 4 ] ||
+   { echo "must give suite, arch, [build_name] [modify_dns]"; exit 1; }
+
+release=$(lsb_release -c -s)
+dist_pkg="uboot-mkimage" 
+[ "${release}" = "natty" -o "${release}" = "oneiric" ] && dist_pkg="uboot-tools"
+
+# one time setup stuff
+toinst=( )
+for p in bzr python-vm-builder resolvconf dnsmasq virtualbox-ose qemu-kvm qemu-kvm-extras-static qemu-kvm-extras zerofree $dist_pkgs; do
+   ver=$(dpkg-query --show --showformat '${Version}\n' "${p}") || :
+   [ -z "${ver}" ] && toinst[${#toinst[@]}]="${p}"
+done
+
+[ ${#toinst} -eq 0 ] || sudo apt-get install --assume-yes "${toinst[@]}"
+
+[ ${mod_dns} = "yes" ] && {
+	mark="### USE_EC2_MIRRORS ###"
+	if ! grep -q "${mark}" /etc/hosts; then
+	   sudo service resolvconf restart
+	   sudo ifdown eth0; sudo ifup eth0
+	   mirror=$(sed -n '/archive.ubuntu.com/s,.*http://\([^/]*\).*,\1,p' \
+	      /etc/apt/sources.list | sort -u )
+	   echo "setting up mirror: archive.ubuntu.com -> ${mirror}"
+	   ip=""
+	   for n in 1 2 3 4; do
+	      ip=$(host "${mirror}" |
+		 awk '$2 == "has"  && $3 == "address" { print $4 ; exit(0); }')
+	      [ -z "${ip}" ] || break
+	      echo "waiting a bit for dns"; sleep ${n}
+	   done
+	   [ -n "${ip}" ] || { echo "couldn't set up dnsmasq hack?"; exit 1; }
+	   sudo sh -c "{ echo '${mark}'; echo '${ip} archive.ubuntu.com us.archive.ubuntu.com'; } >> /etc/hosts"
+	   sudo service dnsmasq restart
+	fi
+}
+
+[ -f "/usr/share/debootstrap/scripts/${suite}" ] ||
+	sudo ln -s gutsy "/usr/share/debootstrap/scripts/${suite}"
+
+[ -d vmbuilder-0.11 ] ||
+   bzr branch lp:~ubuntu-virt/vmbuilder/0.11 vmbuilder-0.11
+[ -d automated-ec2-builds ] ||
+   bzr branch lp:~ubuntu-on-ec2/vmbuilder/automated-ec2-builds
+[ -d live-build ] ||
+   bzr branch lp:~ubuntu-on-ec2/live-build/cloud-images live-build
+[ -d ec2-publishing-scripts ] ||
+   bzr branch lp:~ubuntu-on-ec2/ubuntu-on-ec2/ec2-publishing-scripts
+
+### end onetime setup
+
+AB_D="${PWD}/automated-ec2-builds"
+VB_D="${PWD}/vmbuilder-0.11"
+EC2PUB_D="${PWD}/ec2-publishing-scripts"
+PATH="${AB_D}:${VB_D}:${EC2PUB_D}:$PATH"
+
+export LIVE_BUILD_PATH="${PWD}/live-build"
+
+serial=$(date +%Y%m%d)
+conf="${AB_D}/conf/${suite}-${build_name}"
+source ${conf}.conf
+arches=${arch} build-ec2-image --serial=${serial} "${conf}.conf" "${dest}"

=== added file 'misc/img-diff'
--- misc/img-diff	1970-01-01 00:00:00 +0000
+++ misc/img-diff	2016-03-22 02:54:49 +0000
@@ -0,0 +1,180 @@
+#!/bin/bash
+#
+# This script is used to compare the images to spot differences
+
+old_loop=""
+old_loop_dm=""
+old_mp=$(mktemp -d)
+new_loop=""
+new_loop_dm=""
+new_mp=$(mktemp -d)
+
+useage() {
+cat << EOF
+Compare two images. Example:
+   ./img-diff old.img new.img
+EOF
+exit 1
+}
+
+error() { echo "$@" 1>&2; }
+do_done() {
+	[ -z "${old_loop_dm}" ] || { umount "${old_mp}" ; kpartx -d "${old_loop}"; }
+	[ -z "${new_loop_dm}" ] || { umount "${new_mp}" ; kpartx -d "${new_loop}"; }
+	[ -z "${old_loop}" ] || { losetup -d "${old_loop}"; }
+	[ -z "${new_loop}" ] || { losetup -d "${new_loop}"; }
+
+	rm -rf ${old_mp} ${new_mp}
+}
+fail() { 
+	[ $# -eq 0 ] || { 
+		error "$@";
+		do_done
+	    exit 1;	
+	}
+}
+
+oldimg="$1" 
+newimg="$2" 
+
+
+[ ! -z "${oldimg}" ] || useage
+[ ! -z "${newimg}" ] || useage
+[ "${oldimg}" != "${newimg}" ] || fail "Images must be different"
+[ -e "$oldimg" ] || fail "${oldimg} must exist"
+[ -e "$newimg" ] || fail "${newimg} must exist"
+[ "${EUID}" = 0 ] || fail "This program must run as root"
+
+working_old_img="${oldimg}"
+working_new_img="${newimg}" 
+
+# Convert the image into something usable
+if [ $( file ${oldimg} | awk '/Qemu Image/ {print$NF}' ) -eq "2" ]; then
+	echo "Converting ${oldimg} to ${oldimg}.raw "
+	qemu-img convert -O raw ${oldimg} ${oldimg}.raw
+	working_old_img="${oldimg}.raw"
+elif [ $( file ${oldimg}  | awk '/VMware/ {print$2}' ) = "VMware4" ]; then
+	echo "Converting ${oldimg} to ${oldimg}.raw "
+	vboxmange clonehd -O raw ${oldimg} ${oldimg}.raw
+	working_old_img="${oldimg}.raw"
+else
+	working_old_img="${oldimg}"
+fi
+
+if [ $( file ${newimg}  | awk '/Qemu Image/ {print$NF}' ) -eq "2" ]; then
+	echo "Converting ${newimg} to ${newimg}.raw "
+	qemu-img convert -O raw ${newimg} ${newimg}.raw
+	working_new_img="${newimg}.raw"
+elif [ $( file ${newimg}  | awk '/VMware/ {print$2}' ) = "VMware4" ]; then
+	echo "Converting ${newimg} to ${newimg}.raw "
+	vboxmanage clonehd --format RAW ${newimg} ${newimg}.raw
+	working_new_img="${newimg}.raw"
+else 
+	working_new_img="${newimg}"
+fi
+
+# setup the images
+echo "Setting up device mapper for ${working_old_img}"
+kpartx -a "${working_old_img}"  || fail "unable to add device mapping for ${working_old_img}"
+old_loop=$( kpartx -l "${working_old_img}" | head -n1 | awk '{print$5}'  ) || fail "unable to determine loop device for ${working_old_img}" 
+old_loop_dm="/dev/mapper/$(kpartx -l "${working_old_img}" | head -n1 | awk '{print$1}')" || fail "unable to determine DM loop for ${working_old_img}"
+echo "   setup on ${old_loop}"
+echo "   device mapper setup on ${old_loop_dm}"
+
+echo "Setting up device mapper for ${working_new_img}"
+kpartx -a "${working_new_img}"  || fail "unable to add device mapping for ${working_new_img}" 
+new_loop=$( kpartx -l "${working_new_img}" | head -n1 | awk '{print$5}'  ) || fail "unable to determine loop device for ${working_new_img}" 
+new_loop_dm="/dev/mapper/$(kpartx -l "${working_new_img}" | head -n1 | awk '{print$1}')" || fail "unable to determine DM loop for ${working_new_img}"
+echo "   setup on ${new_loop}"
+echo "   device mapper setup on ${new_loop_dm}"
+
+# Determine the image labels
+old_label=$(blkid "${old_loop_dm}" | awk '/LABEL/ {print$2}') || error "Unable to determine label for ${old_loop_dm}"
+new_label=$(blkid "${new_loop_dm}" | awk '/LABEL/ {print$2}') || error "Unable to determine label for ${new_loop_dm}"
+
+echo "Old Image Label: ${old_label}"
+echo "New Image Label: ${new_label}"
+
+# Mount the images
+[ -e "${old_loop_dm}" ] || fail "unable to find ${old_loop_dm}"
+[ -e "${new_loop_dm}" ] || fail "unable to find ${new_loop_dm}"
+
+mount "${old_loop_dm}" "${old_mp}" || fail "unable to mount ${old_loop_dm}"
+mount "${new_loop_dm}" "${new_mp}" || fail "unable to mount ${new_loop_dm}"
+old_md5=$(mktemp)
+old_pkgs=$(mktemp)
+old_perms=$(mktemp)
+new_md5=$(mktemp)
+new_pkgs=$(mktemp)
+new_perms=$(mktemp)
+exclude='egrep -v "/lib/modules|/usr/share|/var/log|/lib/firmware|/var/lib/dpkg|/var/cache/man|/var/cache/apt"'
+
+
+# Calculate the differences
+for what in new old
+do
+		echo "Calculating for $what image"
+
+		case ${what} in 
+			new) md5="${new_md5}"; perms="${new_perms}"; pkgs="${new_pkgs}"; mp="${new_mp}" ;;
+			old) md5="${old_md5}"; perms="${old_perms}"; pkgs="${old_pkgs}"; mp="${old_mp}" ;;
+		esac
+
+		printf "...md5"
+		chroot "${mp}" sh -c 'find . -type f |  xargs md5sum 2>/dev/null | sort -k2' | $exclude > "${md5}" ||
+			error "Unable to calculate MD5 for old image"
+
+		printf "...permissions"
+		chroot "${mp}" find . -type f -printf "%h/%f\t\t %M\n" 2> /dev/null | $exclude | sort -k1 > "${perms}" ||
+			error "Unable to report file persmissions for old image"
+
+		printf "...packages"
+		chroot "${mp}" dpkg-query -W --showformat='${Package} ${Version}\n' > "${pkgs}" ||
+			error "Unable to report packages installed on old image"
+
+		printf "...done\n"
+done
+
+
+echo -e "\nPackage Diff"
+diff "${old_pkgs}" "${new_pkgs}" 
+
+echo -e "\n\nPermissions Diff"
+diff "${old_perms}" "${new_perms}"
+
+echo -e "\n\nFile System Diff"
+echo -e "\nOLD versus NEW"
+diff "${old_md5}" "${new_md5}" 
+
+newfiles=""
+missing=""
+binary=""
+skipped=""
+compared=""
+changed=""
+
+divline="_______________________________________________________________________________"
+minline="-------------------------------------------------------------------------------"
+for f in $( diff "${old_md5}" "${new_md5}" | grep "./" | awk '{print$3}' | sort | uniq ); do
+    [ ! -e "${old_mp}/${f}" -a -e "${new_mp}/$f" ] && { newfiles="${newfiles}\n$f"; continue; }
+    [ ! -e "${new_mp}/${f}" -a -e "${old_mp}/$f" ] && { missing="${missing}\n$f"; continue; }
+
+    comment="BEGIN DIFF of OLD to NEW ${f}"
+    [ -e "${old_mp}/${f}" -o -e "${new_mp}/${f}" ] || continue
+    diff_comment="$(diff -u ${old_mp}/${f} ${new_mp}/${f})"
+    
+    [ $(expr match "${diff_comment}" "Binary files") -ne "0" ] && { binary="${binary}\n${f}"; continue; } ||
+         { comment="${comment}\n${diff_comment}\nEND DIFF of ${f}\n${minline}\n"; compared="${compared}\n${comment}"; changed="${changed}\n${f}"; }
+done
+
+echo -e "${divline}\nNEW FILES added to NEW IMAGE\n${newfiles}\n\n"
+echo -e "${divline}\nMISSING FILES from OLD to NEW \n${missing}\n\n"
+echo -e "${divline}\nSIMPLE LIST OF CHANGED\n${changed}\n\n"
+echo -e "${divline}\nBINARY UNDIFFED \n${binary}\n\n"
+echo -e "${divline}\nDIFFED \n${compared}"
+
+
+
+do_done
+
+rm -rf "${old_pkgs}" "${new_pkgs}" "${new_md5}" "${old_md5}" "${old_mp}" "${new_mp}" "${old_perms}" "${new_perms}"

=== added file 'misc/license.py'
--- misc/license.py	1970-01-01 00:00:00 +0000
+++ misc/license.py	2016-03-22 02:54:49 +0000
@@ -0,0 +1,551 @@
+#!/usr/bin/python3
+#
+# Extract license information from manifest file
+#
+# This script is dead simple -- using the pull-lp-source tool, it
+# iterates over a manifest and then downloads the source. Then it
+# uses the 'license-check' tool to extract the information.
+#
+#
+
+import __future__
+import argparse
+import codecs
+import csv
+import logging as LOG
+import json
+import os
+import os.path
+import re
+import subprocess
+import time
+import tempfile
+
+LOG.basicConfig(format='%(levelname)s:%(message)s', level=LOG.DEBUG)
+
+# Populate the system licenses we know about
+system_licenses = {}
+common_license_d = "/usr/share/common-licenses"
+for root, dirs, files in os.walk(common_license_d):
+    for f in files:
+        LOG.info("Added system license: %s" % f)
+        system_licenses[f] = "%s/%s" % (common_license_d, f)
+
+## Shamelessly stolen from cloud-init
+def subp(args, data=None, rcs=None, env=None, capture=True, shell=False,
+         logstring=False):
+    if rcs is None:
+        rcs = [0]
+    try:
+
+        if not logstring:
+            LOG.debug(("Running command %s with allowed return codes %s"
+                       " (shell=%s, capture=%s)"), args, rcs, shell, capture)
+        else:
+            LOG.debug(("Running hidden command to protect sensitive "
+                       "input/output logstring: %s"), logstring)
+
+        if not capture:
+            stdout = None
+            stderr = None
+        else:
+            stdout = subprocess.PIPE
+            stderr = subprocess.PIPE
+        stdin = subprocess.PIPE
+        sp = subprocess.Popen(args, stdout=stdout,
+                        stderr=stderr, stdin=stdin,
+                        env=env, shell=shell)
+        (out, err) = sp.communicate(data)
+    except OSError as e:
+        LOG.warn("cmd=%s reason=%s" % (args, e))
+        return (None, None)
+
+    rc = sp.returncode  # pylint: disable=E1101
+    if rc not in rcs:
+        LOG.warn("stdout=%s\nstderr=%s\nexit_code=%s\ncmd=%s" % \
+                        (out, err, rc, args))
+        return (None, None)
+
+    # Just ensure blank instead of none?? (iff capturing)
+    if not out and capture:
+        out = ''
+    if not err and capture:
+        err = ''
+    return (out, err)
+
+def _normalize_license(lic):
+    """
+    Take the long name and map to the canonical form, i.e.
+        GPL (v1 or later) to GPL
+    """
+    version = None
+    try:
+        version = re.search(r".*(\(.*\))", lic).group(1)
+        LOG.debug("Reduced license version to: %s" % version)
+    except:
+        LOG.info("Did not find license version for %s" % lic)
+
+    # Get just the version
+    name = lic.split()[0]
+    if version:
+        version = re.sub(r'(\(|\)|v)', '', version)
+        version = version.split()[0]
+
+    # v1 are not shown as "-1"
+    if version:
+        if version == "1":
+            version = None
+        elif ".0" in version:
+            version = version.split('.0')[0]
+
+    # Handle short names, i.e. GPL
+    nam_ver = "%s-%s" % (name, version)
+    if not version:
+        nam_ver = name
+
+    LOG.debug("Looking for '%s' [%s] in system licenses" % (lic, nam_ver))
+    if nam_ver in system_licenses:
+        LOG.debug("   found %s as matching license" % nam_ver)
+        return (nam_ver, system_licenses[nam_ver])
+    else:
+        LOG.debug("   did not find %s in system licenses" % nam_ver)
+
+    return (None, None)
+
+def _stripper(string):
+    # Match on explicit licences
+    if re.search("\/usr\/share\/common-licenses\/([A-z].*)", string):
+        string =  re.search("\/usr\/share\/common-licenses\/(.*)", string).group(1)
+
+    # Reg-exes to try and find stuff
+    licenses = {
+        "(the.BSD.license|BSD.Copyright)": 'BSD',
+        "(BSD-1|BSD \(2 clause\))": 'BSD (2 clause)',
+        "(BSD-3|BSD \(3 clause\))": 'BSD (3 clause)',
+        "(BSD-4|BSD \(4 clause\))": 'BSD (4 clause)',
+        "BSD with advertising": 'BSD Advertising',
+        "GPL \(unversioned/unknown version\)": 'GPL',
+        "GFDL \(unversioned/unknown version\)": 'GFDL',
+        "GFDL-NIV \(unversioned/unknown version\)": 'GFDL-NIV',
+        "(GFDL-NIV \(v1\)|GFDL-1)": 'GFDL (v1)',
+        "(GFDL-NIV \(v2\)|GFDL-2)": 'GFDL (v2)',
+        "(GFDL-NIV \(v3\)|GFDL-3)": 'GFDL (v3)',
+        "(GFDL-NIV \(v1 or later\)|GNU GFDL, Version 2 or later|GFDL-1\+|GFDL \(1,\))":
+            'GFDL-NIV (v1 or later)',
+        "(GFDL-NIV \(v2 or later\)|GNU GFDL, Version 2 or later|GFDL-2\+|GFDL \(2,\))":
+            'GFDL-NIV (v2 or later)',
+        "(GFDL-NIV \(v3 or later\)|GNU GFDL, Version 3 or later|GFDL-3\+|GFDL \(3,\))":
+            'GFDL-NIV (v3 or later)',
+        "(GFDL \(v1\)|GFDL-1)": 'GFDL (v1)',
+        "(GFDL \(v2\)|GFDL-2)": 'GFDL (v2)',
+        "(GFDL \(v3\)|GFDL-3)": 'GFDL (v3)',
+        "(GFDL \(v1.2 or later\)|GNU GFDL, Version 1.2 or later|GFDL-1.2\+|GFDL \(1.2,\)|GNU Free Documentation License.*1.2.*)":
+            'GFDL (v1 or later)',
+        "(GFDL \(v1 or later\)|GNU GFDL, Version 1 or later|GFDL-1\+|GFDL \(1,\))":
+            'GFDL (v1 or later)',
+        "(GFDL \(v2 or later\)|GNU GFDL, Version 2 or later|GFDL-2\+|GFDL \(2,\))":
+            'GFDL (v2 or later)',
+        "(GFDL \(v3 or later\)|GNU GFDL, Version 3 or later|GFDL-3\+|GFDL \(3,\))":
+            'GFDL (v3 or later)',
+        "(GPL \(v1\)|GPL-1|GNU General Public License version 1)": 'GPL (v1)',
+        "(GPL \(v2\)|GPL-2|GNU General Public License version 2)": 'GPL (v2)',
+        "(GPL \(v3\)|GPL-3|GNU General Public License version 3)": 'GPL (v3)',
+        "(GPL \(v1 or later\)|GNU GPL, Version 2 or later|GNU General Public License version 1 or later|GNU General Public License version 1, or any later version|GPL-1\+|GPL \(1\,\)|GPL v1 or above|GNU General Public License, either version 1 or.*any newer version|GNU General Public License \(GPL\)\, version 1\, or.*at your option any later version)":
+            'GPL (v1 or later)',
+        "(GPL \(v2 or later\)|GNU GPL, Version 2 or later|GNU General Public License version 2 or later|GNU General Public License version 2, or any later version|GPL-2\+|GPL \(2\,\)|GPL v2 or above|GNU General Public License, either version 2 or.*any newer version|GNU General Public License \(GPL\)\, version 2\, or.*at your option any later version)":
+            'GPL (v2 or later)',
+        "(GPL \(v3 or later\)|GNU GPL, Version 3 or later|GNU General Public License version 3 or later|GNU General Public License version 3, or any later version|GPL-3\+|GPL \(3\,\)|GPL v3 or above|GNU General Public License, either version 3 or.*any newer version|GNU General Public License \(GPL\)\, version 3\, or.*at your option any later version)":
+            'GPL (v3 or later)',
+        "(LGPL \(v2 or later\)|LGP \(2\)|LGPL \(2,\)|GNU LESSER GENERAL PUBLIC LICENSE.*Version 2)":
+            'LGPL (v2 or later)',
+        "(LGPL \(v2.1 or later\)|LGPL \(v2.1\)|LGPL \(2.1,\)|GNU LESSER GENERAL PUBLIC LICENSE.*Version 2.1)":
+            'LGPL (v2.1 or later)',
+        "(LGPL \(v3.0 or later\)|LGPL \(v3.0\)|LGPL \(3,\)|GNU LESSER GENERAL PUBLIC LICENSE.*Version 3)":
+            'LGPL (v3.0 or later)',
+        "(LDP GENERAL PUBLIC LICENSE|LDP General Public License)": "LDPL",
+        "(MIT|M.I.T|MIT/X11 \(BSD like\))": 'MIT/X11 (BSD like)',
+        "(MIT License \(Expat\)|EXPAT)": 'EXPAT',
+        "Apache": 'Apache',
+        "CC-BY": 'Creative Commons Attribution',
+        "(CC0|Creative Commons Zero)": 'CC0',
+        "(CDDL|Common Development and Distribution)": 'CCDL',
+        "(CPL|IBM Common Public License)": "CPL",
+        "(EFL|Eiffel Forum License)": 'EFL',
+        "(Artistic|Artistic-1)": 'Artistic',
+        "ISC": 'ISC',
+        "WTFPL": "WTFPL",
+        "(MPL \(v2.0\)|Mozilla Public License 2.0)": "MPL (v2.0)",
+        "(MPL \(v1.0\)|Mozilla Public License 1.0)": "MPL (v1.0)",
+        "(MPL \(v1.1\)|Mozilla Public License 1.1)": "MPL (v1.1)",
+        "Python License": "Python",
+        "QPL": 'QPL',
+        "Zope Public License": 'Zope',
+    }
+
+    generic_licenses = {
+        "GPL": "GPL",
+        "BSD": "BSD",
+        "Public Domain": "Public Domain",
+        "(\*No copyright\* UNKNOWN|\*No copyright\* Public domain)": "Copy-left",
+        "Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.": "Copy-left",
+        "You may freely.*binary or source.*": "Copy-left",
+        "Public Domain|Copyright\: public-domain": 'Public Domain',
+        "Read the file copyright in the main directory of this package for copyright information.": "Parent-license",
+
+    }
+
+    string = string.replace('\n', ' ').strip()
+    matched = []
+    for k, v in licenses.items():
+        if re.search(k, string):
+            matched.append(v)
+
+    if len(matched) == 0:
+        for k, v in generic_licenses.items():
+            if re.search(k, string):
+                matched.append(v)
+
+    if len(matched) == 0:
+        return ([], True)
+
+    return ([x for x in set(matched)], False)
+
+
+def parse_manifest(name_f, dump_f, dump_reuse, download=True):
+    """
+    Iterate over manifest of '<PKG> <VER>' and fetch the files
+    via 'pull-lp-source'
+    """
+
+    if not os.path.exists(name_f):
+        raise Exception("No such file %s" % name_f)
+
+    pkgs = []
+    pkgs_names = []
+    with codecs.open(name_f, 'r', encoding='utf-8') as f:
+        for meta in f.readlines():
+            (pkg, version) = meta.split()
+            pkgs.append((pkg, version))
+            pkgs_names.append(pkg)
+
+    LOG.info("Found %s packages" % len(pkgs))
+
+    # Populate system licenses
+    licenses = {'summary': [],
+                'system_licenses': system_licenses,
+                'pkg_non_standard_licenses': {},
+                'pkg_standard_licenses': {},
+               }
+    for license in system_licenses:
+        licenses['pkg_standard_licenses'][license] = []
+
+    # Move the directory
+    current_d = os.getcwd()
+    existing_paths = []
+    my_path = None
+    if dump_reuse:
+        os.chdir(dump_reuse)
+        my_path = dump_reuse
+        # Populate the existing
+        for root, dirs, _ in os.walk(dump_reuse, topdown=True):
+            for dir_n in dirs:
+                existing_paths.append(dir_n)
+    else:
+        tmp_d = tempfile.mkdtemp(prefix="source.", dir=current_d)
+        os.chdir(tmp_d)
+        my_path = dump_reuse
+
+    # we'll strip this out later, but this makes the licenses easy
+    licenses['tmp_path'] = my_path
+
+    def is_existing(pkg):
+        """Determine if pkg and version have been downloaded already"""
+        for p in existing_paths:
+            if pkg in p:
+                LOG.info("Already downloaded source for %s" % pkg)
+                return True
+        return False
+
+    # Download the packages
+    lp_cmd = "pull-lp-source"
+    for pkg_meta in pkgs:
+        (pkg, version) = pkg_meta
+        cmd = [lp_cmd, pkg, version]
+
+        if not is_existing(pkg) and download:
+            LOG.info("Fetching %s %s" % (pkg, version))
+            (out, _err) = subp(cmd, rcs=[0, 1])
+
+    # Now process them
+    for root, dirs, _  in os.walk(os.getcwd(), topdown=True):
+        for name in dirs:
+            name_d = "%s" % os.path.join(root, name)
+
+            if re.search(r'.*(patches|\.pc|packages|tests|debian\-example)',
+                         name_d) or \
+               re.search(r'.*debian\/(patches|\.pc|packages|tests).*',
+                         name_d):
+                continue
+
+            control = None
+            copyrights = []
+            for sr, sd, sf in os.walk(name_d):
+                for sfn in sf:
+                    candidate_f = os.path.join(sr, sfn)
+
+                    if re.search(r'.*(.git.*|.bzr.*|.py|.sh|.c|.h|.patch|CVS)$',
+                                 candidate_f) or \
+                       re.search(r'.*\/licenses\/.*', candidate_f):
+                       continue
+                    elif re.match('.*\/control$', candidate_f):
+                        control = candidate_f
+                    elif re.match('.*(copyright.*|LICENSE.*|WHENCE|COPYING.*|copying.*|license.*)',
+                                  candidate_f):
+                        copyrights.append(candidate_f)
+
+            sub_p = []
+            sub_b = []
+            sub_a = []
+            src_p = None
+
+            if not control:
+                continue
+
+            with codecs.open(control, 'r', encoding='utf-8') as f:
+                for line in f.readlines():
+                    if re.match('^Source:.*', line):
+                        src_p = line.split(':')[-1].strip()
+                    if re.match('^Package:.*', line):
+                        _pkg = line.split(':')[-1].strip()
+                        if _pkg in pkgs_names:
+                            sub_p.append(_pkg)
+                        else:
+                            sub_b.append(_pkg)
+                        sub_a.append(_pkg)
+
+            if src_p not in licenses:
+                licenses[src_p] = {'licenses': {}, 'standard_licenses': {}}
+
+            for copyright in copyrights:
+                cmd = ["licensecheck", "--lines=500", copyright]
+                (out, _err) =  subp(cmd)
+
+                out = str(out) #, encoding='utf-8')
+                cc = (out.strip()).split(': ')[-1]
+                ccn = copyright
+                _found, _unknown = _stripper(cc)
+
+                if _unknown:
+                    with codecs.open(copyright, 'r', encoding='utf-8') as f:
+                        _found, _unknown = _stripper(f.read())
+
+                if _unknown:
+                    _found = ["UNKNOWN"]
+
+                for lic in _found:
+                    sys_license, sys_path = _normalize_license(lic)
+                    if my_path is not None:
+                    	short_name = lic.replace(my_path, '')
+                    else:
+                        short_name = lic
+
+                    if not sys_license and not sys_path:
+                        if ccn not in licenses[src_p]['licenses']:
+                            licenses[src_p]['licenses'][ccn] = []
+                        licenses[src_p]['licenses'][ccn].append(short_name)
+                        licenses[src_p]['licenses'][ccn] = [
+                            x for x in set(licenses[src_p]['licenses'][ccn])]
+
+                        if src_p not in licenses['pkg_non_standard_licenses']:
+                            licenses['pkg_non_standard_licenses'][src_p] = {}
+
+                        for k, v in licenses[src_p]['licenses'].items():
+                            licenses['pkg_non_standard_licenses'][src_p][k] = v
+
+                    else:
+                        if ccn not in licenses[src_p]['standard_licenses']:
+                            licenses[src_p]['standard_licenses'][ccn] = []
+                        licenses[src_p]['standard_licenses'][ccn].append(
+                             sys_license)
+                        licenses[src_p]['standard_licenses'][ccn] = [
+                            x for x in set(licenses[src_p]['standard_licenses'][ccn])]
+
+                        licenses['pkg_standard_licenses'][sys_license].extend(sub_p)
+                        licenses['pkg_standard_licenses'][sys_license] = \
+                            sorted([x for x in set(\
+                                    licenses['pkg_standard_licenses'][sys_license]
+                                  )])
+
+            licenses[src_p]['pkgs_installed'] = sub_p
+            licenses[src_p]['pkgs_built_from_source'] = sub_a
+
+            if len(sub_b) > 0:
+                licenses[src_p]['pkgs_not_installed'] = sub_b
+
+    os.chdir(current_d)
+    if '.json' not in dump_f:
+        dump_f += ".json"
+
+    with codecs.open(dump_f, 'w', encoding='utf-8') as f:
+        f.write(json.dumps(licenses, indent=4))
+
+    return licenses
+
+
+def license_html(licenses, manifest, dump_f, version, subversion):
+    """
+    This generates a standard HTML file with the list of licenseses,
+    the text and the package name
+    """
+    bad_path = licenses['tmp_path']
+
+    text = """
+<!DOCTYPE html>
+<html>
+<head>
+<title>License information for Ubuntu Server %s</title>
+</head>
+
+<body>
+<h1>License information for Ubuntu Server %s for %s</h1>
+<h3>Report generated on %s</h3>
+
+<p>Ubuntu is covered by the following polices</p>
+<ul>
+    <li><p><a href="http://www.canonical.com/intellectual-property-rights-policy";>http://www.canonical.com/intellectual-property-rights-policy<a/></li>
+    <li><a href="http://www.ubuntu.com/legal";>http://www.ubuntu.com/legal</a></li>
+    <li>Open Source licenses as disclosed below</li>
+</ul>
+
+<p><b>Disclaimer:</b> The author(s) of this tool make no representation or warranty as to the accuracy or completeness of this list or the information it represents, and we expressly disclaim any implied warranties to the fullest extent permissible at law. We accept no liability for any damage or loss arising form your use or reliance on the list. Any and all uses of this list is subject to these terms.</p>
+
+<p>This report was generated using tool which relies on the meta-data for each file. The user of this report is responsible for verifying the accuracy of this list.</p>
+
+<p>This report is only valid for the packages and the versions listed. Since this report is generated from source, it may contain licenses not found in the final packaged version. Again, it is up to the users to verify the veracity of the information.</p>
+
+<h1>Package list</h1>
+<p>This document discloses the license information for the following packages and version</p>
+
+<ul>
+""" % (version, version, subversion, time.strftime("%d %b %Y"))
+
+    # Copy in the manifest
+    LOG.info("Adding manifest to HTML")
+    with codecs.open(manifest, 'r', encoding='utf-8') as f:
+        for line in f.readlines():
+            text += "   <li>%s</li>" % line.strip()
+    text += "\n</ul>\n"
+    text += """
+<hr>
+<h1>Standard System Licenses</h1>
+<p>These are the standard licenses, which use Debian standard system licenses.</p>
+
+"""
+    LOG.info("Processing standard licenses")
+    for std_license in licenses['pkg_standard_licenses']:
+        pkgs = licenses['pkg_standard_licenses'][std_license]
+        npkgs = len(pkgs)
+        if npkgs == 0:
+            LOG.info("   Skipping %s (no pkgs)" % std_license)
+            continue
+
+        LOG.info("   Adding %s" % std_license)
+        LOG.info("       Packages licensed %s" % npkgs)
+        license_f = "%s/%s" % (common_license_d, std_license)
+        license_txt = None
+        with codecs.open(license_f, 'r', encoding='utf-8') as f:
+            license_txt = f.read()
+        LOG.info("       Read %s" % license_f)
+
+        text += """
+    <h2>License: %s</h2>
+    <h3>The following packages are covered under this license</h3>
+    <ul>
+""" % std_license
+
+        for pkg in pkgs:
+            text += "        <li>%s</li>\n" % pkg.strip()
+
+        text += """
+    </ul>
+    <h3>License Text:</h3>
+    <pre>
+%s
+    </pre>
+""" % license_txt
+
+    text += """
+<hr>
+<h1>Non-standard Licenses</h1>
+<p>These license are free and open licenses, but are either modified,
+or are licenses that allow modification to their terms.</p>
+"""
+
+    for pkg in licenses['pkg_non_standard_licenses']:
+        text += "      <h2>Package: %s</h2>" % pkg
+        LOG.info("Adding licenses for %s" % pkg)
+        pkg_license = licenses['pkg_non_standard_licenses'][pkg]
+        for nstd_l in pkg_license:
+            license_txt = None
+            LOG.info("  Adding %s as text" % nstd_l)
+
+            try:
+                with codecs.open(nstd_l, 'r', encoding='utf-8') as f:
+                    license_txt = f.read()
+            except:
+                continue
+
+            text += """
+<h3>License(s): %s"</h3>
+<pre>
+%s
+</pre>""" % (nstd_l.replace("%s/" % bad_path, ''), license_txt)
+
+    text += """
+</body>
+</html>
+"""
+
+    # Write the output html
+    if ".html" not in dump_f:
+        dump_f += ".html"
+    with codecs.open(dump_f, 'w', encoding='utf-8') as f:
+        f.write(text)
+
+
+if __name__ == "__main__":
+
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--file',
+            required=True,
+            default=False,
+            help="File to read manifest from")
+    parser.add_argument('--out',
+            required=True,
+            default=False,
+            help="Place to dump the output")
+    parser.add_argument('--reuse',
+            required=False,
+            default=None,
+            help="Reuse existing downloads")
+    parser.add_argument('--no_download',
+            action="store_false",
+            required=False,
+            default=True,
+            help="Don't download, use with --reuse")
+    parser.add_argument('--version',
+            action="store",
+            required=False,
+            default="12.04",
+            help="Version of Ubuntu")
+    parser.add_argument("--subversion",
+            action="store",
+            required=True,
+            help="Derivative information")
+
+
+    opts = parser.parse_args()
+    licenses = parse_manifest(opts.file, opts.out, opts.reuse,
+                              opts.no_download)
+    license_html(licenses, opts.file, opts.out, opts.version,
+                 opts.subversion)

=== added file 'mk-image-mb-loader'
--- mk-image-mb-loader	1970-01-01 00:00:00 +0000
+++ mk-image-mb-loader	2016-03-22 02:54:49 +0000
@@ -0,0 +1,95 @@
+#!/bin/bash
+# vi: ts=4 noexpandtab
+
+TEMP_D=""
+
+error() { echo "$@" 1>&2; }
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} output
+   Create a multiboot image that will multiboot to a instances installed
+   /boot/grub/core.img
+EOF
+}
+
+bad_Usage() { Usage 1>&2; fail "$@"; }
+cleanup() {
+	[ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+
+short_opts="h"
+long_opts="help"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+cfg_in=""
+modules="biosdisk tar memdisk configfile part_msdos ext2 multiboot test serial echo terminal chain sleep minicmd"
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-h|--help) Usage; exit 0;;
+		   --config) cfg_in=${next}; shift;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+[ $# -eq 1 ] || bad_Usage "must supply output"
+output=${1}
+
+TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/.${0##*/}.XXXXXX") ||
+	fail "failed to make tempd"
+
+trap cleanup EXIT
+
+cfg="${TEMP_D}/my.cfg"
+if [ -n "${cfg_in}" ]; then
+	cp "${cfg_in}" "${cfg}" || fail "failed to copy ${cfg_in}"
+else
+	cat > "${cfg}" <<"EOF"
+serial --unit=0 --speed=9600
+terminal_input console serial
+terminal_output console serial
+
+set cimg=/boot/grub/core.img
+for r in "(hd0,1)" "(hd0)"; do
+   set root=$r
+   if [ -s $cimg ]; then
+      echo "multibooting $r$cimg"
+      multiboot $cimg
+      boot
+   fi
+   echo "no core.img found on $r"
+   sleep 1
+done
+
+echo "failed to find a core.img to multiboot to"
+for r in "(hd0,1)" "(hd0)"; do
+  set root=$r
+  echo "attempting chainload from ($root)"
+  if chainloader +1; then
+    boot
+  fi
+  echo "failed"
+done
+exit
+EOF
+	[ $? -eq 0 ] || fail "failed to write config"
+fi
+
+memdisk_dir="${TEMP_D}/md"
+memdisk="${TEMP_D}/md.tar"
+mkdir -p "${memdisk_dir}/boot/grub" &&
+	cp "${cfg}" "${memdisk_dir}/boot/grub/grub.cfg" &&
+	tar -C "${memdisk_dir}" -cf "${memdisk}" boot ||
+	fail "failed to make memdisk"
+
+grub-mkimage --output="${output}" \
+	--memdisk="${memdisk}" --prefix='(memdisk)/boot/grub' \
+	-O i386-pc ${modules} ||
+	fail "failed to create image ${output}"
+
+error "wrote to ${output}"

=== added file 'mk-nocloud-bootdisk'
--- mk-nocloud-bootdisk	1970-01-01 00:00:00 +0000
+++ mk-nocloud-bootdisk	2016-03-22 02:54:49 +0000
@@ -0,0 +1,144 @@
+#!/bin/sh
+# vi: ts=4 noexpandtab
+#
+#    Copyright (C) 2010 Canonical Ltd.
+#
+#    Authors: Scott Moser <smoser@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+TEMP_D=""
+
+error() { echo "$@" 1>&2; }
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} output.img
+   Create a multiboot floppy image that can boot a cloudimg disk image
+
+   The output.iso file can then be booted with
+      kvm -fda output.img -boot a -drive cloudimg-image.img...
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+cleanup() {
+	[ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+
+getsize() {
+	local f="$1" size=""
+	size=$(ls -l "${f}" 2>/dev/null | awk '{print $5}') &&
+		[ -n "${size}" ] && _RET=${size} && return 0
+}
+checksize() {
+	getsize "$1" || return 1
+	[ "${_RET}" "$2" "$3" ]
+}
+
+mk_grub_rescue() {
+	local output=${1}
+	local bdir="${TEMP_D}/bdir"
+	local err="${TEMP_D}/err"
+	local modules="configfile"
+    modules="biosdisk tar memdisk configfile part_msdos ext2 multiboot test serial echo terminal chain sleep minicmd search linux"
+	mkdir "${bdir}" &&
+		mkdir -p "${bdir}/boot/grub" &&
+		cat > "${bdir}/boot/grub/grub.cfg" <<EOF
+serial --unit=0 --speed=9600
+terminal_input console serial
+terminal_output console serial
+
+set default=0
+set timeout=5
+
+set menu_color_normal=white/black
+set menu_color_highlight=black/light-gray
+
+menuentry 'cloud-image with random ubuntu password' --class gnu-linux --class gnu --class os {
+	set gfxpayload=keep
+	search --no-floppy --label cloudimg-rootf --set
+	linux	/vmlinuz "ro init=/usr/lib/cloud-init/uncloud-init root=LABEL=cloudimg-rootfs ds=nocloud-net ubuntu-pass=random"
+	if [ -f /initrd.img ]; then
+		initrd	/initrd.img
+	fi
+}
+
+menuentry 'cloud-image with ubuntu:ubuntu' --class gnu-linux --class gnu --class os {
+	set gfxpayload=keep
+	search --no-floppy --label cloudimg-rootf --set
+	linux	/vmlinuz "ro init=/usr/lib/cloud-init/uncloud-init root=LABEL=cloudimg-rootfs ds=nocloud-net ubuntu-pass=ubuntu"
+	if [ -f /initrd.img ]; then
+		initrd	/initrd.img
+	fi
+}
+
+menuentry 'cloud-image seeded from a url [must be edited]' --class gnu-linux --class gnu --class os {
+	set gfxpayload=keep
+	search --no-floppy --label cloudimg-rootf --set
+	linux	/vmlinuz "ro root=LABEL=cloudimg-rootfs ds=nocloud-net;s=http://example.com/demo-";
+	if [ -f /initrd.img ]; then
+		initrd	/initrd.img
+	fi
+}
+
+EOF
+		[ $? -eq 0 ] || return
+		grub-mkrescue --output="${output}" \
+			${modules:+"--modules=${modules}"} "${bdir}" > "${err}" 2>&1 ||
+			{ cat "${err}" 1>&2; return 1; }
+}
+
+short_opts="h"
+long_opts="help"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+mode="grub-rescue-floppy"
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-h|--help) Usage; exit 0;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+[ $# -eq 1 ] || bad_Usage "must supply only output image"
+
+TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/.${0##*/}.XXXXXX") ||
+	fail "failed to make tempd"
+trap cleanup EXIT
+
+output=${1}
+
+case "${mode}" in
+	grub-rescue-floppy)
+		mk_grub_rescue "${output}" ||
+			fail "failed to make rescue floppy"
+		checksize "${output}" -lt $((2880*1024)) ||
+			fail "output of mk_rescue was to large for floppy"
+		size=${_RET}
+		truncate --size 2880K "${output}" ||
+			fail "failed to pad ${output} to 2880K"
+		echo "created ${mode} image in ${output} (payload $size)"
+		;;
+	grub-rescue-cdrom)
+		mk_grub_rescue "${output}" ||
+			fail "failed to make rescue cdrom"
+		echo "created ${mode} image in ${output}"
+		;;
+esac
+
+[ $? -eq 0 ] || fail "failed to create image"

=== added file 'mount-image-callback'
--- mount-image-callback	1970-01-01 00:00:00 +0000
+++ mount-image-callback	2016-03-22 02:54:49 +0000
@@ -0,0 +1,280 @@
+#!/bin/bash
+# mount-image-callback copied from from cloud-utils
+
+VERBOSITY=0
+TEMP_D=""
+UMOUNT=""
+QEMU_DISCONNECT=""
+
+error() { echo "$@" 1>&2; }
+
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [ options ] file cmd [ args ]
+
+   mount a file to a temporary mount point and then
+   invoke the provided cmd with args
+
+   the temporary mountpoint will be put in an a environment variable
+   named MOUNTPOINT.
+
+   if any of the arguments are the literal string '_MOUNTPOINT_', then
+   they will be replaced with the mount point. Example:
+      ${0##*/} my.img chroot _MOUNTPOINT_ /bin/sh
+
+   options:
+    -v | --verbose             increase verbosity
+         --read-only           use read-only mount.
+    -p | --proc                bind mount /proc
+    -s | --sys                 bind mount /sys
+    -d | --dev                 bind mount /dev
+         --system-mounts       bind mount /sys, /proc, /dev
+         --system-resolvconf   copy host's resolvconf into /etc/resolvconf
+EOF
+}
+
+# umount_r(mp) : unmount any filesystems under r
+#  this is useful to unmount a chroot that had sys, proc ... mounted
+umount_r() {
+	local p
+	for p in "$@"; do
+		[ -n "$p" ] || continue
+		tac /proc/mounts | sh -c '
+			p=$1
+			while read s mp t opt a b ; do
+				[ "${mp}" = "${p}" -o "${mp#${p}/}" != "${mp}" ] ||
+					continue
+				umount "$mp" || exit 1
+			done
+			exit 0' umount_r "${p%/}"
+		[ $? -eq 0 ] || return
+	done
+}
+
+bad_Usage() { Usage 1>&2; [ $# -eq 0 ] || error "$@"; exit 1; }
+cleanup() {
+	if [ -n "$UMOUNT" ]; then
+		umount_r "$UMOUNT" ||
+			error "WARNING: unmounting filesystems failed!"
+	fi
+	if [ -n "$QEMU_DISCONNECT" ]; then
+		local out=""
+		out=$(qemu-nbd --disconnect "$QEMU_DISCONNECT" 2>&1) || {
+			error "warning: failed: qemu-nbd --disconnect $QEMU_DISCONNECT"
+			error "$out"
+		}
+	fi
+	[ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] ||
+		rm --one-file-system -Rf "${TEMP_D}" ||
+		error "removal of temp dir failed!"
+}
+
+debug() {
+	local level="$1"; shift;
+	[ "${level}" -gt "${VERBOSITY}" ] && return
+	error "${@}"
+}
+
+mount_callback_umount() {
+	local img_in="$1" dev="" out="" mp="" ret="" img="" ro=""
+	local opts="" bmounts="" system_resolvconf=false
+
+	short_opts="dhpsv"
+	long_opts="dev,help,proc,read-only,sys,system-mounts,system-resolvconf,verbose"
+	getopt_out=$(getopt --name "${0##*/}" \
+		--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+		eval set -- "${getopt_out}" ||
+		{ bad_Usage; return 1; }
+
+	while [ $# -ne 0 ]; do
+		cur=${1}; next=${2};
+		case "$cur" in
+			-d|--dev) bmounts="${bmounts:+${bmounts} /dev}";;
+			-h|--help) Usage ; exit 0;;
+			-p|--proc) bmounts="${bmounts:+${bmounts} /proc}";;
+			-s|--sys) bmounts="${bmounts:+${bmounts} /sys}";;
+			   --system-mounts) bmounts="/dev /proc /sys";;
+			   --system-resolvconf) system_resolvconf=true;;
+			-v|--verbose) VERBOSITY=$((${VERBOSITY}+1));;
+			   --opts) opts="${opts} $next"; shift;;
+			   --read-only) ro="ro";;
+			--) shift; break;;
+		esac
+		shift;
+	done
+
+	[ $# -ge 2 ] || { bad_Usage "must provide image and cmd"; return 1; }
+
+	[ -n "$ro" ] && $system_resolvconf && {
+		error "--read-only is incompatible with system-resolvconf";
+		return 1;
+	}
+
+	img_in="$1"
+	shift 1
+
+	img=$(readlink -f "$img_in") ||
+		{ error "failed to get full path to $img_in"; return 1; }
+
+	[ "$(id -u)" = "0" ] || 
+		{ error "sorry, must be root"; return 1; }
+
+	TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX") ||
+		{ error "failed to make tempdir"; return 1; }
+	trap cleanup EXIT
+
+	mp="${TEMP_D}/mp"
+
+	mkdir "$mp" || return
+
+	local cmd="" arg="" found=false
+	cmd=( )
+	for arg in "$@"; do
+		if [ "${arg}" = "_MOUNTPOINT_" ]; then
+			debug 1 "replaced string _MOUNTPOINT_ in arguments arg ${#cmd[@]}"
+			arg=$mp
+		fi
+		cmd[${#cmd[@]}]="$arg"
+	done
+
+	if [ "${cmd[0]##*/}" = "bash" -o "${cmd[0]##*/}" = "sh" ] &&
+	   [ ${#cmd[@]} -eq 0 ]; then
+		debug 1 "invoking shell ${cmd[0]}"
+		error "MOUNTPOINT=$mp"
+	fi
+
+	local hasqemu=false
+	command -v "qemu-nbd" >/dev/null 2>&1 && hasqemu=true
+
+	if out=$(set -f; mount -o loop${ro:+,$ro} $opts \
+	         "$img" "$mp" 2>&1); then
+		debug 1 "mounted simple filesystem image '$img_in'"
+		UMOUNT="$mp"
+	else
+		if ! $hasqemu; then
+			error "simple mount of '$img_in' failed."
+			error "if this not a raw image, or it is partitioned"
+			error "you must have qemu-nbd (apt-get install qemu-utils)"
+			error "mount failed with: $out"
+			return 1
+		fi
+	fi
+
+	if [ -z "$UMOUNT" ]; then
+		if [ ! -e /sys/block/nbd0 ] && ! grep -q nbd /proc/modules; then
+			debug 1 "trying to load nbd module"
+			modprobe nbd >/dev/null 2>&1
+			udevadm settle >/dev/null 2>&1
+		fi
+		[ -e /sys/block/nbd0 ] || {
+			error "no nbd kernel support, but simple mount failed"
+			return 1;
+		}
+
+		local f nbd=""
+		for f in /sys/block/nbd*; do
+			[ -d "$f" -a ! -f "$f/pid" ] && nbd=${f##*/} && break
+		done
+		if [ -z "$nbd" ]; then
+			error "failed to find an nbd device"
+			return 1;
+		fi
+		nbd="/dev/$nbd"
+
+		if ! qemu-nbd --connect "$nbd" "$img"; then
+			error "failed to qemu-nbd connect $img to $nbd"
+			return 1
+		fi
+		QEMU_DISCONNECT="$nbd"
+
+		local pfile="/sys/block/${nbd#/dev/}/pid"
+		if [ ! -f "$pfile" ]; then
+			debug 1 "waiting on pidfile for $nbd in $pfile"
+			local i=0
+			while [ ! -f "$pfile" ] && i=$(($i+1)); do
+				if [ $i -eq 200 ]; then
+					error "giving up on pidfile $pfile for $nbd"
+					return 1
+				fi
+				sleep .1
+				debug 2 "."
+			done
+		fi
+
+		debug 1 "connected $img_in to $nbd. now udev-settling"
+		udevadm settle >/dev/null 2>&1
+
+		local mdev="$nbd"
+		if [ -b "${nbd}p1" ]; then
+			mdev="${nbd}p1"
+		fi
+		if ( set -f; mount ${ro:+-o ${ro}} $opts "$mdev" "$mp" ) &&
+			UMOUNT="$mp"; then
+			debug 1 "mounted $mdev via qemu-nbd $nbd"
+		else
+			local pid="" pfile="/sys/block/${nbd#/dev/}/pid"
+			{ read pid < "$pfile" ; } >/dev/null 2>&1
+			[ -n "$pid" -a ! -d "/proc/$pid" ] ||
+				error "qemu-nbd process seems to have died. was '$pid'"
+
+			qemu-nbd --disconnect "$nbd" && QEMU_DISCONNECT=""
+			error "failed to mount $mdev"
+			return 1
+		fi
+
+	fi
+
+	local bindmp=""
+	for bindmp in $bmounts; do
+		[ -d "$mp${bindmp}" ] || mkdir "$mp${bindmp}" ||
+			{ error "failed mkdir $bindmp in mount"; return 1; }
+		mount --bind "$bindmp" "$mp/${bindmp}" ||
+			{ error "failed bind mount '$bindmp'"; return 1; }
+	done
+
+	if ${system_resolvconf}; then
+		local rcf="$mp/etc/resolv.conf"
+		debug 1 "replacing /etc/resolvconf"
+		if [ -e "$rcf" -o -L "$rcf" ]; then
+			local trcf="$rcf.${0##*/}.$$"
+			rm -f "$trcf" &&
+				mv "$rcf" "$trcf" && ORIG_RESOLVCONF="$trcf" ||
+				{ error "failed mv $rcf"; return 1; }
+		fi
+		cp "/etc/resolv.conf" "$rcf" ||
+			{ error "failed copy /etc/resolv.conf"; return 1; }
+	fi
+
+	debug 1 "invoking: MOUNTPOINT=$mp" "${cmd[@]}"
+	MOUNTPOINT="$mp" "${cmd[@]}"
+	ret=$?
+
+	if ${system_resolvconf}; then
+		local rcf="$mp/etc/resolv.conf"
+		cmp --quiet "/etc/resolv.conf" "$rcf" >/dev/null ||
+			error "WARN: /etc/resolv.conf changed in image!"
+		rm "$rcf" &&
+			{ [ -z "$ORIG_RESOLVCONF" ] || mv "$ORIG_RESOLVCONF" "$rcf"; } ||
+			{ error "failed to restore /etc/resolv.conf"; return 1; }
+	fi
+
+	debug 1 "cmd returned $ret. unmounting $mp"
+	umount_r "$mp" || { error "failed umount $img"; return 1; }
+	UMOUNT=""
+	rmdir "$mp"
+
+	if [ -n "$QEMU_DISCONNECT" ]; then
+		local out=""
+		out=$(qemu-nbd --disconnect "$QEMU_DISCONNECT" 2>&1) &&
+			QEMU_DISCONNECT="" || {
+				error "failed to disconnect $QEMU_DISCONNECT";
+				error "$out"
+				return 1;
+		}
+	fi
+	return $ret
+}
+
+mount_callback_umount "$@"
+
+# vi: ts=4 noexpandtab

=== added directory 'ovf'
=== added file 'ovf/VMDKstream.py'
--- ovf/VMDKstream.py	1970-01-01 00:00:00 +0000
+++ ovf/VMDKstream.py	2016-03-22 02:54:49 +0000
@@ -0,0 +1,315 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+# Copyright (C) 2011 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+#
+# First cut module to convert raw disk images into stream-optimized VMDK files
+#
+# See the "Specification Document" referenced in Wikipedia for more details:
+#
+# http://en.wikipedia.org/wiki/VMDK
+#
+# Divergence from spec noted below
+#
+# The stream-optimized format is required for importing images via the vSphere
+# SOAP API
+
+import struct
+import sys
+import os
+import math
+import string
+import zlib
+
+class VMDKStreamException(Exception):
+    def __init__(self, msg):
+        self.msg = msg
+    def __str__(self):
+        return self.msg
+
+# Header Constants
+MAGIC_NUMBER = 0x564D444B # 'V' 'M' 'D' 'K'
+
+# Marker Constants
+MARKER_EOS = 0 # end of stream
+MARKER_GT = 1 # grain table
+MARKER_GD = 2 # grain directory
+MARKER_FOOTER = 3 # footer (repeat of header with final info)
+
+# Other Constants
+SECTOR_SIZE = 512
+
+# Descriptor Template
+image_descriptor_template='''# Description file created by VMDK stream converter
+version=1
+# Believe this is random
+CID=7e5b80a7
+# Indicates no parent
+parentCID=ffffffff
+createType="streamOptimized"
+
+# Extent description
+RDONLY #SECTORS# SPARSE "call-me-stream.vmdk"
+
+# The Disk Data Base
+#DDB
+
+ddb.adapterType = "lsilogic"
+ddb.geometry.cylinders = "#CYLINDERS#"
+ddb.geometry.heads = "255"
+ddb.geometry.sectors = "63"
+ddb.toolsVersion = "2147483647"
+ddb.longContentID = "8f15b3d0009d9a3f456ff7b28d324d2a"
+ddb.virtualHWVersion = "7"'''
+
+
+def create_sparse_header(inFileSectors, descriptorSize,
+                         gdOffset = 0xFFFFFFFFFFFFFFFF):
+    # While theoretically variable we set these based on current VMWare
+    # convention
+    grainSize = 128
+    numGTEsPerGT = 512
+    overHead = 128
+    formatVersion = 3 # NOTE: Conflicts with VMWare docs - determined by trial/error
+
+    descriptorOffset = 1
+
+    # The following are always fixed in the "stream-optimized" format we are
+    # creating
+    compressAlgorithm = 1
+    flags = 0x30001
+    rgdOffset = 0
+
+    # We are building from scratch so an unclean shutdown is not possible
+    uncleanShutdown = 0
+
+    # Build the struct
+    header_list = [ MAGIC_NUMBER, formatVersion, flags, inFileSectors,
+                    grainSize, descriptorOffset, descriptorSize, numGTEsPerGT,
+                    rgdOffset, gdOffset, overHead, uncleanShutdown,
+                    '\n', ' ', '\r', '\n', compressAlgorithm ]
+    for i in range(433):
+	header_list.append(0)
+    header_struct = "=IIIQQQQIQQQBccccH433B"
+    return struct.pack(header_struct, *header_list)
+
+def create_marker(numSectors, size, marker_type):
+    marker_list = [ numSectors, size, marker_type ]
+    for i in range(496):
+	marker_list.append(0)
+    marker_struct = "=QII496B"
+    return struct.pack(marker_struct, *marker_list)
+
+def create_grain_marker(location, size):
+    # The grain marker is special in that the data follows immediately after it
+    # without a pad
+    return struct.pack("=QI", location, size)
+
+def divro(num, den):
+    # Divide always rounding up and returning an integer
+    # Is there some nicer way to do this?
+    return int(math.ceil((1.0*num)/(1.0*den)))
+
+def pad_to_sector(stringlen):
+    # create a pad that, when concated onto a string of stringlen
+    # makes it an integer number of sectors
+    # return pad and length of input_string + pad in sectors
+    pad = ""
+    if stringlen % SECTOR_SIZE:
+        # This does need padding
+        for i in range(SECTOR_SIZE - (stringlen % SECTOR_SIZE)):
+            pad += '\0'
+    finallen = (stringlen + len(pad))/SECTOR_SIZE
+    return pad, finallen
+
+def sector_pointer(file_object):
+    # return file point in sectors
+    # raise an exception if not sector aligned
+    file_location = file_object.tell()
+    if file_location % SECTOR_SIZE:
+        raise VMDKStreamException("Asked for a sector pointer on a file whose r/w pointer is not sector aligned")
+    else:
+        return file_location / SECTOR_SIZE
+
+
+def write_grain_table(outfile, grain_table, gtes_per_gt = 512):
+    # Write grain_table to outfile including header
+    # return the sector on which the table starts
+
+    zero_grain_table = [ ]
+    for i in range(gtes_per_gt):
+        zero_grain_table.append(0)
+
+    if grain_table == zero_grain_table:
+        # We don't need to write this and can put zeros in the directory
+        return 0
+    else:
+        grain_table_marker = create_marker(numSectors = (gtes_per_gt * 4) / SECTOR_SIZE,
+                                           size = 0, marker_type = MARKER_GT)
+        outfile.write(grain_table_marker)
+        table_location = sector_pointer(outfile)
+        outfile.write(struct.pack("%dI" % gtes_per_gt, *grain_table))
+        return table_location
+
+def debug_print(message):
+    #print message
+    pass
+
+def convert_to_stream(infilename, outfilename):
+    debug_print("DEBUG: opening %s to write to %s" % (infilename, outfilename))
+
+    infileSize = os.path.getsize(infilename)
+    infileSectors = divro(infileSize, 512)
+    debug_print("DEBUG: input file is (%s) bytes - (%s) sectors long" % (infileSize, infileSectors))
+
+    # Fixed by convention
+    # TODO: Make variable here and in header fuction
+    grainSectors=128
+    totalGrains=divro(infileSectors, grainSectors)
+    debug_print("DEBUG: total grains will be (%s)" % (totalGrains))
+
+    # Fixed by convention
+    # TODO: Make variable here and in header fuction
+    numGTEsPerGT = 512
+    totalGrainTables=divro(totalGrains, numGTEsPerGT)
+    debug_print("DEBUG: total Grain Tables needed will be (%s)" % (totalGrainTables))
+
+    grainDirectorySectors=divro(totalGrainTables*4, SECTOR_SIZE)
+    debug_print("DEBUG: sectors in Grain Directory will be (%s)" % (grainDirectorySectors))
+
+    grainDirectoryEntries=grainDirectorySectors*128
+    debug_print("DEBUG: Number of entries in Grain Directory - (%s)" % (grainDirectoryEntries))
+
+    infileCylinders=divro(infileSectors, (63*255))
+    debug_print("DEBUG: Cylinders (%s)" % infileCylinders)
+
+    # Populate descriptor
+    tmpl = image_descriptor_template
+    tmpl = string.replace(tmpl, "#SECTORS#", str(infileSectors))
+    tmpl = string.replace(tmpl, "#CYLINDERS#", str(infileCylinders))
+    image_descriptor = tmpl
+
+    image_descriptor_pad, desc_sectors = pad_to_sector(len(image_descriptor))
+    debug_print("DEBUG: Descriptor takes up (%s) sectors" % desc_sectors)
+    image_descriptor += image_descriptor_pad
+
+    image_header = create_sparse_header(inFileSectors = infileSectors,
+                                        descriptorSize = desc_sectors)
+
+    outfile = open(outfilename, "wb")
+    outfile.write(image_header)
+    outfile.write(image_descriptor)
+
+    # Fixed by convention
+    # TODO: Make variable here and in header function
+    overHead = 128
+
+    # Pad the output file to fill the overHead
+    for i in range((overHead-sector_pointer(outfile)) * SECTOR_SIZE):
+        outfile.write('\0')
+
+    # grainDirectory - list of integers representing the global level 0 grain
+    # directory
+    grainDirectory = [ ]
+
+    # currentGrainTable - list that can grow to numGTEsPerGT integers
+    # representing the active grain table
+    currentGrainTable = [ ]
+
+    # For slightly more efficient comparison
+    grainSize = grainSectors * SECTOR_SIZE
+    zeroChunk = ""
+    for i in range(grainSize):
+        zeroChunk += '\0'
+
+    # We are ready to start reading
+    infile = open(infilename, "rb")
+
+    try:
+        inputSectorPointer = sector_pointer(infile)
+        inChunk = infile.read(grainSize)
+        while inChunk != "":
+            if inChunk == zeroChunk:
+                # All zeros - no need to create a grain - just mark zero in GTE
+                currentGrainTable.append(0)
+            else:
+                # Create a compressed grain
+                currentGrainTable.append(sector_pointer(outfile))
+		compChunk = zlib.compress(inChunk)
+                grain_marker = create_grain_marker(inputSectorPointer,
+                                                   len(compChunk))
+		grainPad, writeSectors = pad_to_sector(len(compChunk) + len(grain_marker))
+		outfile.write(grain_marker)
+		outfile.write(compChunk)
+		outfile.write(grainPad)
+
+            if len(currentGrainTable) == numGTEsPerGT:
+                # Table is full
+                table_location =  write_grain_table(outfile, currentGrainTable,
+                                                    gtes_per_gt = numGTEsPerGT)
+                # function does zero check so we don't have to
+                grainDirectory.append(table_location)
+                currentGrainTable = [ ]
+            # do not update pointer unless we read a full grain last time
+            # incomplete grain read indicates EOF and may result in non-sector
+            # alignment
+            if len(inChunk) == grainSize:
+                inputSectorPointer = sector_pointer(infile)
+            # read the next chunk
+            inChunk = infile.read(grainSize)
+    finally:
+        # Write out the final grain table if needed
+        if len(currentGrainTable):
+            debug_print("Partial grain table present - padding and adding it to dir")
+            for i in range(numGTEsPerGT-len(currentGrainTable)):
+                currentGrainTable.append(0)
+            table_location = write_grain_table(outfile, currentGrainTable,
+                                               gtes_per_gt = numGTEsPerGT)
+            grainDirectory.append(table_location)
+        else:
+            debug_print("Current grain table is empty so we need not write it out")
+
+        # pad out grain directory then write it
+        for i in range(grainDirectoryEntries - totalGrainTables):
+            grainDirectory.append(0)
+        grain_directory_marker = create_marker(grainDirectorySectors, 0,
+                                               MARKER_GD)
+        outfile.write(grain_directory_marker)
+        gdLocation = sector_pointer(outfile)
+        grainDirectoryStruct = "%dI" % grainDirectoryEntries
+        debug_print("Grain directory length (%d)" % (len(grainDirectory)))
+        debug_print("Grain directory: ")
+        debug_print(grainDirectory)
+        outfile.write(struct.pack(grainDirectoryStruct, *grainDirectory))
+
+        # footer marker
+        outfile.write(create_marker(1, 0, MARKER_FOOTER))
+
+        # footer
+        footer = create_sparse_header(inFileSectors = infileSectors,
+                                      descriptorSize = desc_sectors,
+                                      gdOffset = gdLocation)
+        outfile.write(footer)
+
+        # EOS marker
+        outfile.write(create_marker(0, 0, MARKER_EOS))
+        outfile.close()
+        infile.close()
+
+if __name__ == '__main__':
+    convert_to_stream(sys.argv[1], sys.argv[2])

=== added file 'ovf/armel2qemu'
--- ovf/armel2qemu	1970-01-01 00:00:00 +0000
+++ ovf/armel2qemu	2016-03-22 02:54:49 +0000
@@ -0,0 +1,332 @@
+#!/bin/bash
+cmd_args=$*
+base_d=$(dirname $(readlink -f "${0}"))
+
+
+# General functions
+Usage() {
+    cat <<EOF
+${0##*/} - Create QEMU or hardware capable ARMEL images
+
+Useage:
+    --type [raw|qcow2]) Image format type
+    --mlo)              MLO firmware for ARM hardware
+    --uboot)            u-boot binary
+    --rootfs)           Image containing root file system to put into new image
+    --disk)             Name of final image
+    --label)            Rootfs label
+
+    Example: ${0##*/} --type qcow2 --mlo MLO -uboot u-boot.bin --rootfs mfs.img --disk new.img
+
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+debug() { error "$(date -R):" "$@"; }
+
+error() { echo -e "$@" 1>&2; }
+
+do_done() {
+    # done on exit or fail
+
+    # Unmount file-systems
+    [ -z "${rootfs_dm}" ]        || { umount "${rootfs_dm}" 2> /dev/null; }
+    [ -z "${bootfs_dm}" ]        || { umount "${bootfs_dm}" 2> /dev/null; }
+    [ -z "${copy_rootfs_dm}" ]   || { umount "${copy_rootfs_dm}" 2> /dev/null; }
+
+    # Clean up the device mappings.
+    # Due to bugginess in kpartx on lucid, dmsetup is being used first to remove devices
+    #     and then fallback to kpartx just in case.
+    [ -z "${copy_rootfs_loop}" ] || {
+        local loop_dev=$(echo $copy_rootfs_loop | awk -F\/ '{print$NF}')
+        find /dev/mapper -iname "${loop_dev}*" | xargs -n1  -I DEVICE dmsetup remove DEVICE ||
+            kpartx -d "${copy_rootfs_loop}" ||
+                echo "Failed to remove device mapper devices for ${copy_rootfs_loop}"
+        losetup -d "${copy_rootfs_loop}";
+    }
+
+    [ -z "${loop}" ] || {
+        local loop_dev=$(echo ${loop} | awk -F\/ '{print$NF}')
+        find /dev/mapper -iname "${loop_dev}*" | xargs -n1  -I DEVICE dmsetup remove DEVICE ||
+            kpartx -d "${loop}" ||
+                echo "Failed to remove device mapper devices for ${loop}"
+        losetup -d "${loop}" ||
+            echo "Failed to remove loop device ${loop}"
+    }
+
+    # Clean up temporary directories
+    [ -z "${TEMPDIR}"   ] || rm -rf "${TEMPDIR}"
+    [ -z "${mp_rootfs}" ] || rm -rf "${mp_rootfs}"
+    [ -z "${mp_uboot}"  ] ||  rm -rf "${mp_uboot}"
+}
+
+fail() {
+    [ $# -eq 0 ] || {
+        error "$(date -R): $@";
+        do_done
+        exit 1;
+    }
+}
+
+check_prog() {
+    which $1 > /dev/null >&1 ||
+        fail "Sorry, you need to have $1 installed"
+}
+
+need_file() {
+   fail "Unable to find required file $@"
+}
+
+short_opts="h"
+long_opts="disk:,rootfs:,mlo:,uboot:,type:,label:"
+getopt_out=$(getopt --name "${0##*/}" \
+    --options "${short_opts}" --long "${long_opts}" -- "$@") &&
+    eval set -- "${getopt_out}" ||
+    bad_Usage
+
+# Basic control variables that are required
+img=""              # Base working image
+mlo_firmware=""     # MLO firmware file
+uboot_firmware=""   # u-boot firmware
+stuff_img=""        # Rootfs to stuff into image
+img_type=""         # Image format type
+
+while [ $# -ne 0 ]; do
+    case "${1}" in
+        --disk)   img="${2}.raw";         shift;;
+        --rootfs) stuff_img="${2}";       shift;;
+        --mlo)    mlo_firmware="${2}";    shift;;
+        --uboot)  uboot_firmware="${2}";  shift;;
+        --type)   img_type="${2}";        shift;;
+        --label)  img_label="${2}";       shift;;
+        -h)     Usage; exit 0;;
+        --)     shift; break;;
+    esac
+    shift
+done
+
+[ -n "${mlo_firmware}" ]   || need_file "${mlo_firmware} (identified as MLO firmware)"
+[ -n "${uboot_firmware}" ] || need_file "${uboot_firmware} (identified as u-boot firmware)"
+[ -n "${stuff_img}" ]      || need_file "${stuff_img} (identified as root file system)"
+[ -n "${img}" ]            || fail "--disk <NAME> is required"
+[ -n "${img_type}" ]       || fail "--type <[raw|qcow2]> is required"
+
+[ "${img_type}" = "qcow2" -o "${img_type}" = "raw" ] ||
+    fail "Valid types are raw or qcow2."
+
+# Clean up the image name
+final_img="${img//.raw/}"
+working_stuff_img=""
+mp_uboot=$(mktemp -d)
+mp_rootfs=""
+copy_rootfs_dm=""
+copy_rootfs_loop=""
+bootfs_dm=""
+rootfs_dm=""
+loop=""
+rootfs_dm=""
+rootfs_label=""
+TEMPDIR=${TEMPDIR:-$(mktemp -d )}
+uimage="${TEMPDIR}/uImage"
+bootscr="${TEMPDIR}/boot.scr"
+uinitrd="${TEMPDIR}/uInitrd"
+kernel="${TEMPDIR}/vmlinuz"
+initrd="${TEMPDIR}/initrd"
+
+debug "IMAGE PARAMETERS: "
+debug "   Image with rootfs: ${stuff_img}"
+debug "        MLO Firmware: ${mlo_firmware}"
+debug "     u-boot Firmware: ${uboot_firmware}"
+debug "          Image Type: ${img_type}"
+debug "         Final Image: ${final_img}"
+
+
+# Support multiple formats
+convert_image() {
+  file_name="${TEMPDIR}/$(echo $stuff_img | awk -F\/ '{print$NF}')"
+  if [ "$( file ${stuff_img}  | awk '/Qemu Image/ {print$NF}' )" = "2" ]; then
+      debug "Converting ${stuff_img} to ${file_name}.raw "
+      qemu-img convert -O raw ${stuff_img} "${file_name}.raw" ||
+        fail "Unable to convert disk image"
+      working_stuff_img="${file_name}.raw"
+  elif [ "$( file ${stuff_img}  | awk '/VMware/ {print$2}' )" = "VMware4" ]; then
+      debug "Converting ${stuff_img} to ${file_name}.raw "
+      vboxmanage clonehd --format RAW ${stuff_img} "${file_name}.raw" ||
+        fail "Unable to convert disk image"
+      working_stuff_img="${file_name}.raw"
+  else
+      working_stuff_img="${stuff_img}"
+  fi
+}
+
+# Make the boot files
+mk_boot_files() {
+
+## DON'T CHANGE THESE VALUES! IT WON'T WORK!
+	cat << END >> ${TEMPDIR}/boot.cmd
+setenv dvimode 1280x720MR-16@60
+setenv vram 12MB
+setenv bootcmd 'fatload mmc 0:1 0x80300000 uImage; fatload mmc 0:1 0x81600000 uInitrd; bootm 0x80300000 0x81600000'
+setenv bootargs console=ttyO2 omapfb.mode=dvi root=LABEL=${rootfs_label:-cloudimg-rootfs} rw fixrtc
+boot
+END
+
+    debug "Starting to build boot images"
+    debug "Making kernel image"
+	mkimage -A arm -O linux -T kernel -C none -a 0x80300000 -e 0x80300000 -n "Linux" -d "${kernel}" "${uimage}" ||
+        fail "Failed to create uImage"
+
+    debug "Making initrd image"
+	mkimage -A arm -O linux -T ramdisk -C none -a 0x81600000 -e 0x81600000 -n "Initrd" -d "${initrd}" "${uinitrd}" ||
+	fail "Failed to create uInitrd"
+
+    debug "Making boot.cmd image"
+	mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Ubuntu" -d "${TEMPDIR}/boot.cmd" "${bootscr}" ||
+        fail "Failed to create boot.scr"
+
+    [ -e "${uimage}" ]  || fail "Failed to find ${uimage}"
+    [ -e "${uinitrd}" ] || fail "Failed to find ${uinitrd}"
+    [ -e "${bootscr}" ] || fail "Failed to find ${bootscr}"
+
+    debug "Finished making boot images"
+}
+
+# build the disk
+mk_disk() {
+    debug "Creating disk image...may take a while"
+    [ -e "${img}" ] || {
+            dd if=/dev/zero of=${img} bs=1M count=2120
+            debug "Created ${img}"
+         } || fail "Destination disk image already exists, bailing"
+
+sfdisk --no-reread --force -uM -H255 -S63 ${img} <<END_DISK
+0,64,c,*
+,
+END_DISK
+
+	loop_raw="$(kpartx -v -a ${img} )" || fail "Failed to add image via kpartx"
+    debug "Setup raw destination disk"
+    echo -e "${loop_raw}"
+
+
+    sfdisk -l ${img}
+
+    #Extract information about loop
+	loop="$(echo -e ${loop_raw} |  head -n1 | awk '{print$8}')" ||
+		fail "Unable to determine loop device"
+	bootfs_dm="/dev/mapper${loop///dev/}p1"
+	rootfs_dm="/dev/mapper${loop///dev/}p2"
+
+    debug "Boot partition setup on ${bootfs_dm}"
+    debug "Root partition setup on ${rootfs_dm}"
+}
+
+copy_or_fail() {
+    file_base="$(echo $1 | awk -F\/ '{print$NF}')"
+    debug "Copying ${file_base}"
+    cp $1 $2 || fail "failed to copy ${1} to ${2}"
+    [ -e "${2}" ] || fail "${file_base} is not found on destination file system"
+}
+
+create_boot_fs() {
+    # boot fs must be 32-bit vFAT
+	mkfs.msdos -F32 -v "${bootfs_dm}" 2> /dev/null ||
+        fail "Failed to create boot file system"
+
+    [ -e "${mp_uboot}" -o -z  "${bootfs_dm}" ] && mount "${bootfs_dm}" "${mp_uboot}" ||
+        fail "Unable to mount uboot partition"
+
+    copy_or_fail "${mlo_firmware}" "${mp_uboot}/MLO"
+    copy_or_fail "${uboot_firmware}" "${mp_uboot}/u-boot.bin"
+    copy_or_fail "${uimage}" "${mp_uboot}/uImage"
+    copy_or_fail "${uinitrd}" "${mp_uboot}/uInitrd"
+    copy_or_fail "${bootscr}" "${mp_uboot}/boot.scr"
+    sync
+
+    debug "Contents of u-boot device"
+    ls -lh1 "${mp_uboot}"
+}
+
+stuff_image() {
+   [ -e "${working_stuff_img}" ] ||
+        fail "Unable to find the working copy of root file system image"
+
+   # Set up image for extacting kernel and initrd
+   mp_rootfs=$(mktemp -d) ||
+        fail "Unable to create temp mont point for rootfs"
+   copy_root_raw=$(kpartx -a -v "${working_stuff_img}" ) ||
+        fail "Unable to map rootfs"
+
+   debug "Setup Source FS:"
+   echo -e "${copy_root_raw}"
+
+   # Determine devices of rootfs image and mount
+   copy_rootfs_loop=$(echo ${copy_root_raw} | head -n 1 | awk '{print$8}' ) ||
+        fail "Unable to determine copy_rootfs_loop"
+   # Assume that the last partition has the root file system
+   copy_rootfs_dm=$(echo ${copy_root_raw} | tail -n1 | awk '{print"/dev/mapper/"$3}' ) ||
+        fail "Unable to determine copy_rootfs_dm"
+
+   debug "Source rootfs loop devices is ${copy_rootfs_loop}"
+   debug "Source rootfs device mapper is ${copy_rootfs_dm}"
+
+   [ -n "${img_label}" ] &&
+       rootfs_label=${img_label} ||
+       {
+            rootfs_label=$(tune2fs -l ${copy_rootfs_dm} | awk '/Filesystem volume name/ {print$NF}') ||
+            fail "Unable to determine copy rootfs id"
+       }
+
+   [ -n "${rootfs_label}" ] ||
+        fail "root file system lacks a label, this is fatal"
+
+   mount "${copy_rootfs_dm}" "${mp_rootfs}" ||
+    	fail "Failed to mount copy_rootfs"
+
+   # Extract the kernel and intrd after mounting
+   [ -d "${mp_rootfs}/boot" ] || fail "Unable to find boot directory within image"
+   cp -a "${mp_rootfs}/boot/" "${TEMPDIR}" ||
+        fail "Unable to copy boot directory to ${TEMPDIR}"
+
+   # Get the most recent kernel and initrd name
+   kernel=$(find ${TEMPDIR}/ -iname "vmlinuz*" | sort -rn | head -n1 )
+   initrd=$(find ${TEMPDIR}/ -iname "initrd*"  | sort -rn | head -n1 )
+
+   [ -e "${kernel}" ] || fail "Did not find any kernel images"
+   [ -e "${initrd}" ] || fail "Did not find any initrd images"
+
+   debug "Using ${kernel} as kernel image"
+   debug "Using ${initrd} as initrd image"
+
+   # Copy the image
+   debug "Copying source root file system to image"
+   dd if="${copy_rootfs_dm}" of="${rootfs_dm}" && debug "Finished copying rootfile system" ||
+        error "Potential problem copying rootfs image into parition"
+
+}
+
+finalize_img() {
+    if [ "${img_type}" = "qcow2" ]; then
+            debug "Converting ${img} to QCOW2 format"
+            qemu-img convert -c -O qcow2 ${img} ${final_img} && rm "${img}" ||
+                fail "Failed to convert image to qcow format"
+    else
+        mv "${img}" "${final_img}" ||
+            fail "Unable to write ${final} from ${img}"
+    fi
+
+   [ -e "${final_img}" ] && debug "Final image emitted to ${final_img}" ||
+        fail "Final image ${final} is missing; FATAL"
+}
+
+#do the work
+check_prog kpartx
+check_prog mkimage
+convert_image
+mk_disk
+stuff_image
+mk_boot_files
+create_boot_fs
+finalize_img
+do_done
+

=== added file 'ovf/armhf2qemu'
--- ovf/armhf2qemu	1970-01-01 00:00:00 +0000
+++ ovf/armhf2qemu	2016-03-22 02:54:49 +0000
@@ -0,0 +1,339 @@
+#!/bin/bash
+
+cmd_args=$*
+base_d=$(dirname $(readlink -f "${0}"))
+
+
+# General functions
+Usage() {
+    cat <<EOF
+${0##*/} - Create QEMU or hardware capable ARMHF images
+
+Useage:
+    --type [raw|qcow2]) Image format type
+    --mlo)              MLO firmware for ARM hardware
+    --uboot)            u-boot binary
+    --rootfs)           Image containing root file system to put into new image
+    --disk)             Name of final image
+    --label)            Label name of rootfs image
+
+    Example: ${0##*/} --type qcow2 --mlo MLO -uboot u-boot.bin --rootfs mfs.img --disk new.img
+
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+debug() { error "$(date -R):" "$@"; }
+
+error() { echo -e "$@" 1>&2; }
+
+do_done() {
+    # done on exit or fail
+
+    # Unmount file-systems
+    [ -z "${rootfs_dm}" ]        || { umount "${rootfs_dm}" 2> /dev/null; }
+    [ -z "${bootfs_dm}" ]        || { umount "${bootfs_dm}" 2> /dev/null; }
+    [ -z "${copy_rootfs_dm}" ]   || { umount "${copy_rootfs_dm}" 2> /dev/null; }
+
+    # Clean up the device mappings.
+    # Due to bugginess in kpartx on lucid, dmsetup is being used first to remove devices
+    #     and then fallback to kpartx just in case.
+    [ -z "${copy_rootfs_loop}" ] || {
+        local loop_dev=$(echo $copy_rootfs_loop | awk -F\/ '{print$NF}')
+        find /dev/mapper -iname "${loop_dev}*" | xargs -n1  -I DEVICE dmsetup remove DEVICE ||
+            kpartx -d "${copy_rootfs_loop}" ||
+                echo "Failed to remove device mapper devices for ${copy_rootfs_loop}"
+        losetup -d "${copy_rootfs_loop}";
+    }
+
+    [ -z "${loop}" ] || {
+        local loop_dev=$(echo ${loop} | awk -F\/ '{print$NF}')
+        find /dev/mapper -iname "${loop_dev}*" | xargs -n1  -I DEVICE dmsetup remove DEVICE ||
+            kpartx -d "${loop}" ||
+                echo "Failed to remove device mapper devices for ${loop}"
+        losetup -d "${loop}" ||
+            echo "Failed to remove loop device ${loop}"
+    }
+
+    # Clean up temporary directories
+    [ -z "${TEMPDIR}"   ] || rm -rf "${TEMPDIR}"
+    [ -z "${mp_rootfs}" ] || rm -rf "${mp_rootfs}"
+    [ -z "${mp_uboot}"  ] ||  rm -rf "${mp_uboot}"
+}
+
+fail() {
+    [ $# -eq 0 ] || {
+        error "$(date -R): $@";
+        do_done
+        exit 1;
+    }
+}
+
+check_prog() {
+    which $1 > /dev/null >&1 ||
+        fail "Sorry, you need to have $1 installed"
+}
+
+need_file() {
+   fail "Unable to find required file $@"
+}
+
+short_opts="h"
+long_opts="disk:,rootfs:,mlo:,uboot:,type:,label:"
+getopt_out=$(getopt --name "${0##*/}" \
+    --options "${short_opts}" --long "${long_opts}" -- "$@") &&
+    eval set -- "${getopt_out}" ||
+    bad_Usage
+
+# Basic control variables that are required
+img=""              # Base working image
+mlo_firmware=""     # MLO firmware file
+uboot_firmware=""   # u-boot firmware
+stuff_img=""        # Rootfs to stuff into image
+img_type=""         # Image format type
+
+while [ $# -ne 0 ]; do
+    case "${1}" in
+        --disk)   img="${2}.raw";         shift;;
+        --rootfs) stuff_img="${2}";       shift;;
+        --mlo)    mlo_firmware="${2}";    shift;;
+        --uboot)  uboot_firmware="${2}";  shift;;
+        --type)   img_type="${2}";        shift;;
+        --boot_fs) boot_fs="${2}";        shift;;
+        --label)  img_label="${2}";       shift;;
+        -h)     Usage; exit 0;;
+        --)     shift; break;;
+    esac
+    shift
+done
+
+[ -n "${mlo_firmware}" ]   || need_file "${mlo_firmware} (identified as MLO firmware)"
+[ -n "${uboot_firmware}" ] || need_file "${uboot_firmware} (identified as u-boot firmware)"
+[ -n "${stuff_img}" ]      || need_file "${stuff_img} (identified as root file system)"
+[ -n "${img}" ]            || fail "--disk <NAME> is required"
+[ -n "${img_type}" ]       || fail "--type <[raw|qcow2]> is required"
+
+[ "${img_type}" = "qcow2" -o "${img_type}" = "raw" ] ||
+    fail "Valid types are raw or qcow2."
+
+# Clean up the image name
+final_img="${img//.raw/}"
+working_stuff_img=""
+mp_uboot=$(mktemp -d)
+mp_rootfs=""
+copy_rootfs_dm=""
+copy_rootfs_loop=""
+bootfs_dm=""
+rootfs_dm=""
+loop=""
+rootfs_dm=""
+rootfs_label=""
+TEMPDIR=${TEMPDIR:-$(mktemp -d )}
+uimage="${TEMPDIR}/uImage"
+bootscr="${TEMPDIR}/boot.scr"
+uinitrd="${TEMPDIR}/uInitrd"
+kernel="${TEMPDIR}/vmlinuz"
+initrd="${TEMPDIR}/initrd"
+
+debug "IMAGE PARAMETERS: "
+debug "   Image with rootfs: ${stuff_img}"
+debug "        MLO Firmware: ${mlo_firmware}"
+debug "     u-boot Firmware: ${uboot_firmware}"
+debug "          Image Type: ${img_type}"
+debug "         Final Image: ${final_img}"
+
+
+# Support multiple formats
+convert_image() {
+  file_name="${TEMPDIR}/$(echo $stuff_img | awk -F\/ '{print$NF}')"
+  if [ "$( file ${stuff_img}  | awk '/Qemu Image/ {print$NF}' )" = "2" ]; then
+      debug "Converting ${stuff_img} to ${file_name}.raw "
+      qemu-img convert -O raw ${stuff_img} "${file_name}.raw" ||
+        fail "Unable to convert disk image"
+      working_stuff_img="${file_name}.raw"
+  elif [ "$( file ${stuff_img}  | awk '/VMware/ {print$2}' )" = "VMware4" ]; then
+      debug "Converting ${stuff_img} to ${file_name}.raw "
+      vboxmanage clonehd --format RAW ${stuff_img} "${file_name}.raw" ||
+        fail "Unable to convert disk image"
+      working_stuff_img="${file_name}.raw"
+  else
+      working_stuff_img="${stuff_img}"
+  fi
+}
+
+# Make the boot files
+mk_boot_files() {
+
+## DON'T CHANGE THESE VALUES! IT WON'T WORK!
+	cat << END >> ${TEMPDIR}/boot.cmd
+fatload mmc 0:1 0x80000000 uImage
+fatload mmc 0:1 0x81600000 uInitrd
+setenv bootargs root=LABEL=${rootfs_label:-cloudimg-rootfs} ro quiet splash
+bootm 0x80000000 0x81600000
+END
+
+    debug "Starting to build boot images"
+    debug "Making kernel image"
+	mkimage -A arm -O linux -T kernel -C none -a 0x80300000 -e 0x80300000 -n "Linux" -d "${kernel}" "${uimage}" ||
+        fail "Failed to create uImage"
+
+    debug "Making initrd image"
+	mkimage -A arm -O linux -T ramdisk -C none -a 0x81600000 -e 0x81600000 -n "Initrd" -d "${initrd}" "${uinitrd}" ||
+	fail "Failed to create uInitrd"
+
+    debug "Making boot.cmd image"
+	mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Ubuntu" -d "${TEMPDIR}/boot.cmd" "${bootscr}" ||
+        fail "Failed to create boot.scr"
+
+    [ -e "${uimage}" ]  || fail "Failed to find ${uimage}"
+    [ -e "${uinitrd}" ] || fail "Failed to find ${uinitrd}"
+    [ -e "${bootscr}" ] || fail "Failed to find ${bootscr}"
+
+    debug "Finished making boot images"
+}
+
+# build the disk
+mk_disk() {
+    debug "Creating disk image...may take a while"
+    [ -e "${img}" ] || {
+            dd if=/dev/zero of=${img} bs=1M count=2120
+            debug "Created ${img}"
+         } || fail "Destination disk image already exists, bailing"
+
+	part_type="c"
+	[[ "${boot_fs}" =~ "ext" ]] && part_type="83"
+
+sfdisk --no-reread --force -uM -H255 -S63 ${img} <<END_DISK
+0,64,${part_type},*
+,
+END_DISK
+
+	loop_raw="$(kpartx -v -a ${img} )" || fail "Failed to add image via kpartx"
+    debug "Setup raw destination disk"
+    echo -e "${loop_raw}"
+
+
+    sfdisk -l ${img}
+
+    #Extract information about loop
+	loop="$(echo -e ${loop_raw} |  head -n1 | awk '{print$8}')" ||
+		fail "Unable to determine loop device"
+	bootfs_dm="/dev/mapper${loop///dev/}p1"
+	rootfs_dm="/dev/mapper${loop///dev/}p2"
+
+    debug "Boot partition setup on ${bootfs_dm}"
+    debug "Root partition setup on ${rootfs_dm}"
+}
+
+copy_or_fail() {
+    file_base="$(echo $1 | awk -F\/ '{print$NF}')"
+    debug "Copying ${file_base}"
+    cp $1 $2 || fail "failed to copy ${1} to ${2}"
+    [ -e "${2}" ] || fail "${file_base} is not found on destination file system"
+}
+
+create_boot_fs() {
+    # boot fs must be 32-bit vFAT
+	mkfs.msdos -F32 -v "${bootfs_dm}" 2> /dev/null ||
+        fail "Failed to create boot file system"
+
+    [ -e "${mp_uboot}" -o -z  "${bootfs_dm}" ] && mount "${bootfs_dm}" "${mp_uboot}" ||
+        fail "Unable to mount uboot partition"
+
+    copy_or_fail "${mlo_firmware}" "${mp_uboot}/MLO"
+    copy_or_fail "${uboot_firmware}" "${mp_uboot}/u-boot.bin"
+    copy_or_fail "${uimage}" "${mp_uboot}/uImage"
+    copy_or_fail "${uinitrd}" "${mp_uboot}/uInitrd"
+    copy_or_fail "${bootscr}" "${mp_uboot}/boot.scr"
+    sync
+
+    debug "Contents of u-boot device"
+    ls -lh1 "${mp_uboot}"
+}
+
+stuff_image() {
+   [ -e "${working_stuff_img}" ] ||
+        fail "Unable to find the working copy of root file system image"
+
+   # Set up image for extacting kernel and initrd
+   mp_rootfs=$(mktemp -d) ||
+        fail "Unable to create temp mont point for rootfs"
+   copy_root_raw=$(kpartx -a -v "${working_stuff_img}" ) ||
+        fail "Unable to map rootfs"
+
+   debug "Setup Source FS:"
+   echo -e "${copy_root_raw}"
+
+   # Determine devices of rootfs image and mount
+   copy_rootfs_loop=$(echo ${copy_root_raw} | head -n 1 | awk '{print$8}' ) ||
+        fail "Unable to determine copy_rootfs_loop"
+   # Assume that the last partition has the root file system
+   copy_rootfs_dm=$(echo ${copy_root_raw} | tail -n1 | awk '{print"/dev/mapper/"$3}' ) ||
+        fail "Unable to determine copy_rootfs_dm"
+
+   debug "Source rootfs loop devices is ${copy_rootfs_loop}"
+   debug "Source rootfs device mapper is ${copy_rootfs_dm}"
+
+   debug "Checking root file system label of ${copy_rootfs_dm}"
+   sleep 10
+
+   [ -n "${img_label}" ] &&
+       rootfs_label=${img_label} ||
+       {
+            rootfs_label=$(tune2fs -l ${copy_rootfs_dm} | awk '/Filesystem volume name/ {print$NF}') ||
+            fail "Unable to determine copy rootfs id"
+       }
+
+   [ -n "${rootfs_label}" ] ||
+        fail "root file system lacks a label, this is fatal"
+
+   mount "${copy_rootfs_dm}" "${mp_rootfs}" ||
+    	fail "Failed to mount copy_rootfs"
+
+   # Extract the kernel and intrd after mounting
+   [ -d "${mp_rootfs}/boot" ] || fail "Unable to find boot directory within image"
+   cp -a "${mp_rootfs}/boot/" "${TEMPDIR}" ||
+        fail "Unable to copy boot directory to ${TEMPDIR}"
+
+   # Get the most recent kernel and initrd name
+   kernel=$(find ${TEMPDIR}/ -iname "vmlinuz*" | sort -rn | head -n1 )
+   initrd=$(find ${TEMPDIR}/ -iname "initrd*"  | sort -rn | head -n1 )
+
+   [ -e "${kernel}" ] || fail "Did not find any kernel images"
+   [ -e "${initrd}" ] || fail "Did not find any initrd images"
+
+   debug "Using ${kernel} as kernel image"
+   debug "Using ${initrd} as initrd image"
+
+   # Copy the image
+   debug "Copying source root file system to image"
+   dd if="${copy_rootfs_dm}" of="${rootfs_dm}" && debug "Finished copying rootfile system" ||
+        error "Potential problem copying rootfs image into parition"
+
+}
+
+finalize_img() {
+    if [ "${img_type}" = "qcow2" ]; then
+            debug "Converting ${img} to QCOW2 format"
+            qemu-img convert -c -O qcow2 ${img} ${final_img} && rm "${img}" ||
+                fail "Failed to convert image to qcow format"
+    else
+        mv "${img}" "${final_img}" ||
+            fail "Unable to write ${final} from ${img}"
+    fi
+
+   [ -e "${final_img}" ] && debug "Final image emitted to ${final_img}" ||
+        fail "Final image ${final} is missing; FATAL"
+}
+
+#do the work
+check_prog kpartx
+check_prog mkimage
+convert_image
+mk_disk
+stuff_image
+mk_boot_files
+create_boot_fs
+finalize_img
+do_done
+

=== added directory 'ovf/conf'
=== added file 'ovf/conf/natty-server.conf'
--- ovf/conf/natty-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/natty-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,5 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: '11.04 (Natty Narwhal) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 11.04 (Natty Narwhal) Server'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/oneiric-server.conf'
--- ovf/conf/oneiric-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/oneiric-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,5 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: '11.10 (Oneiric Ocelot) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 11.10 (Oneiric Ocelot) Server'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/precise-server-amd64.conf'
--- ovf/conf/precise-server-amd64.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/precise-server-amd64.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 12.04 LTS (Precise Pangolin) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 12.04 LTS (Precise Pangolin) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntu64Guest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux (64 bit)'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 12.04 LTS amd64'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/precise-server.conf'
--- ovf/conf/precise-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/precise-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 12.04 LTS (Precise Pangolin) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 12.04 LTS (Precise Pangolin) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntuGuest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 12.04 LTS i386'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/quantal-server.conf'
--- ovf/conf/quantal-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/quantal-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,5 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: '12.10 (Quantal Quetzal) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 12.10 (Quantal Quetzal) Server'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/raring-server.conf'
--- ovf/conf/raring-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/raring-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,5 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: '13.04 (Raring Ringtail) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 13.04 (Raring Ringtail) Server'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/saucy-server.conf'
--- ovf/conf/saucy-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/saucy-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,5 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: '13.10 (Saucy Salamander) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 13.10 (Saucy Salamander) Server'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/trusty-server-amd64.conf'
--- ovf/conf/trusty-server-amd64.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/trusty-server-amd64.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 14.04-LTS (Trusty Tahr) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 14.04-LTS (Trusty Tahr) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntu64Guest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux (64 bit)'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 14.04 LTS amd64'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/trusty-server-hwe-amd64.conf'
--- ovf/conf/trusty-server-hwe-amd64.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/trusty-server-hwe-amd64.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 14.04-LTS (Trusty Tahr HWE Enablement) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 14.04-LTS (Trusty Tahr HWE Enablement) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntu64Guest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux (64 bit)'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 14.04 LTS HWE amd64'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/trusty-server-hwe.conf'
--- ovf/conf/trusty-server-hwe.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/trusty-server-hwe.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 14.04-LTS (Trusty Tahr HWE Enablement) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 14.04-LTS (Trusty Tahr Enablement) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntuGuest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 14.04 LTS HWE i386'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/trusty-server.conf'
--- ovf/conf/trusty-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/trusty-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 14.04-LTS (Trusty Tahr) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 14.04-LTS (Trusty Tahr) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntuGuest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 14.04 LTS i386'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/ubuntu-ova-v1-vmdk.tmpl'
--- ovf/conf/ubuntu-ova-v1-vmdk.tmpl	1970-01-01 00:00:00 +0000
+++ ovf/conf/ubuntu-ova-v1-vmdk.tmpl	2016-03-22 02:54:49 +0000
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1"; xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common"; xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"; xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"; xmlns:vmw="http://www.vmware.com/schema/ovf"; xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <References>
+    <File ovf:href="@@NAME@@-disk1.vmdk" ovf:id="file1" ovf:size="@@VMDK_FILE_SIZE@@"/>
+  </References>
+  <DiskSection>
+    <Info>Virtual disk information</Info>
+    <Disk ovf:capacity="@@VMDK_CAPACITY@@" ovf:capacityAllocationUnits="byte" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"; ovf:populatedSize="0"/>
+  </DiskSection>
+  <NetworkSection>
+    <Info>The list of logical networks</Info>
+    <Network ovf:name="VM Network">
+      <Description>The VM Network network</Description>
+    </Network>
+  </NetworkSection>
+  <VirtualSystem ovf:id="@@NAME@@">
+    <Info>A virtual machine</Info>
+    <Name>@@NAME@@</Name>
+    <OperatingSystemSection ovf:id="100" vmw:osType="other3xLinux64Guest">
+      <Info>The kind of installed guest operating system</Info>
+    </OperatingSystemSection>
+
+    <ProductSection ovf:required="false">
+      <Info>Cloud-Init customization</Info>
+      <Product>Ubuntu @@VERSION@@ Server (@@DATE@@)</Product>
+      <Property ovf:key="instance-id" ovf:type="string" ovf:userConfigurable="true" ovf:value="id-ovf">
+          <Label>A Unique Instance ID for this instance</Label>
+          <Description>Specifies the instance id.  This is required and used to determine if the machine should take "first boot" actions</Description>
+      </Property>
+      <Property ovf:key="hostname" ovf:type="string" ovf:userConfigurable="true" ovf:value="ubuntuguest">
+          <Description>Specifies the hostname for the appliance</Description>
+      </Property>
+      <Property ovf:key="seedfrom" ovf:type="string" ovf:userConfigurable="true">
+          <Label>Url to seed instance data from</Label>
+          <Description>This field is optional, but indicates that the instance should 'seed' user-data and meta-data from the given url.  If set to 'http://tinyurl.com/sm-' is given, meta-data will be pulled from http://tinyurl.com/sm-meta-data and user-data from http://tinyurl.com/sm-user-data.  Leave this empty if you do not want to seed from a url.</Description>
+      </Property>
+      <Property ovf:key="public-keys" ovf:type="string" ovf:userConfigurable="true" ovf:value="">
+          <Label>ssh public keys</Label>
+          <Description>This field is optional, but indicates that the instance should populate the default user's 'authorized_keys' with this value</Description>
+      </Property>
+      <Property ovf:key="user-data" ovf:type="string" ovf:userConfigurable="true" ovf:value="">
+          <Label>Encoded user-data</Label>
+          <Description>In order to fit into a xml attribute, this value is base64 encoded . It will be decoded, and then processed normally as user-data.</Description>
+          <!--  The following represents '#!/bin/sh\necho "hi world"'
+          ovf:value="IyEvYmluL3NoCmVjaG8gImhpIHdvcmxkIgo="
+        -->
+      </Property>
+      <Property ovf:key="password" ovf:type="string" ovf:userConfigurable="true" ovf:value="">
+          <Label>Default User's password</Label>
+          <Description>If set, the default user's password will be set to this value to allow password based login.  The password will be good for only a single login.  If set to the string 'RANDOM' then a random password will be generated, and written to the console.</Description>
+      </Property>
+    </ProductSection>
+
+    <VirtualHardwareSection ovf:transport="iso">
+      <Info>Virtual hardware requirements</Info>
+      <System>
+        <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+        <vssd:InstanceID>0</vssd:InstanceID>
+        <vssd:VirtualSystemIdentifier>@@NAME@@</vssd:VirtualSystemIdentifier>
+        <vssd:VirtualSystemType>vmx-10</vssd:VirtualSystemType>
+      </System>
+      <Item>
+        <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+        <rasd:Description>Number of Virtual CPUs</rasd:Description>
+        <rasd:ElementName>@@NUM_CPUS@@ virtual CPU(s)</rasd:ElementName>
+        <rasd:InstanceID>1</rasd:InstanceID>
+        <rasd:ResourceType>3</rasd:ResourceType>
+        <rasd:VirtualQuantity>@@NUM_CPUS@@</rasd:VirtualQuantity>
+      </Item>
+      <Item>
+        <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+        <rasd:Description>Memory Size</rasd:Description>
+        <rasd:ElementName>@@MEM_SIZE@@MB of memory</rasd:ElementName>
+        <rasd:InstanceID>2</rasd:InstanceID>
+        <rasd:ResourceType>4</rasd:ResourceType>
+        <rasd:VirtualQuantity>@@MEM_SIZE@@</rasd:VirtualQuantity>
+      </Item>
+      <Item>
+        <rasd:Address>0</rasd:Address>
+        <rasd:Description>SCSI Controller</rasd:Description>
+        <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+        <rasd:InstanceID>3</rasd:InstanceID>
+        <rasd:ResourceSubType>VirtualSCSI</rasd:ResourceSubType>
+        <rasd:ResourceType>6</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:Address>1</rasd:Address>
+        <rasd:Description>IDE Controller</rasd:Description>
+        <rasd:ElementName>VirtualIDEController 1</rasd:ElementName>
+        <rasd:InstanceID>4</rasd:InstanceID>
+        <rasd:ResourceType>5</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:Address>0</rasd:Address>
+        <rasd:Description>IDE Controller</rasd:Description>
+        <rasd:ElementName>VirtualIDEController 0</rasd:ElementName>
+        <rasd:InstanceID>5</rasd:InstanceID>
+        <rasd:ResourceType>5</rasd:ResourceType>
+      </Item>
+      <Item ovf:required="false">
+        <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+        <rasd:ElementName>VirtualVideoCard</rasd:ElementName>
+        <rasd:InstanceID>6</rasd:InstanceID>
+        <rasd:ResourceType>24</rasd:ResourceType>
+        <vmw:Config ovf:required="false" vmw:key="enable3DSupport" vmw:value="false"/>
+        <vmw:Config ovf:required="false" vmw:key="enableMPTSupport" vmw:value="false"/>
+        <vmw:Config ovf:required="false" vmw:key="use3dRenderer" vmw:value="automatic"/>
+        <vmw:Config ovf:required="false" vmw:key="useAutoDetect" vmw:value="false"/>
+        <vmw:Config ovf:required="false" vmw:key="videoRamSizeInKB" vmw:value="4096"/>
+      </Item>
+      <Item ovf:required="false">
+        <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+        <rasd:ElementName>VirtualVMCIDevice</rasd:ElementName>
+        <rasd:InstanceID>7</rasd:InstanceID>
+        <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType>
+        <rasd:ResourceType>1</rasd:ResourceType>
+        <vmw:Config ovf:required="false" vmw:key="allowUnrestrictedCommunication" vmw:value="false"/>
+      </Item>
+      <Item ovf:required="false">
+        <rasd:AddressOnParent>0</rasd:AddressOnParent>
+        <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+        <rasd:ElementName>CD-ROM 1</rasd:ElementName>
+        <rasd:InstanceID>8</rasd:InstanceID>
+        <rasd:Parent>4</rasd:Parent>
+        <rasd:ResourceSubType>vmware.cdrom.remotepassthrough</rasd:ResourceSubType>
+        <rasd:ResourceType>15</rasd:ResourceType>
+        <vmw:Config ovf:required="false" vmw:key="backing.exclusive" vmw:value="false"/>
+      </Item>
+      <Item>
+        <rasd:AddressOnParent>0</rasd:AddressOnParent>
+        <rasd:ElementName>Hard Disk 1</rasd:ElementName>
+        <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>
+        <rasd:InstanceID>9</rasd:InstanceID>
+        <rasd:Parent>3</rasd:Parent>
+        <rasd:ResourceType>17</rasd:ResourceType>
+        <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/>
+      </Item>
+      <Item ovf:required="false">
+        <rasd:AddressOnParent>0</rasd:AddressOnParent>
+        <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+        <rasd:Description>Floppy Drive</rasd:Description>
+        <rasd:ElementName>Floppy 1</rasd:ElementName>
+        <rasd:InstanceID>10</rasd:InstanceID>
+        <rasd:ResourceSubType>vmware.floppy.remotedevice</rasd:ResourceSubType>
+        <rasd:ResourceType>14</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:AddressOnParent>7</rasd:AddressOnParent>
+        <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+        <rasd:Connection>VM Network</rasd:Connection>
+        <rasd:Description>VmxNet3 ethernet adapter on &quot;VM Network&quot;</rasd:Description>
+        <rasd:ElementName>Ethernet 1</rasd:ElementName>
+        <rasd:InstanceID>11</rasd:InstanceID>
+        <rasd:ResourceSubType>VmxNet3</rasd:ResourceSubType>
+        <rasd:ResourceType>10</rasd:ResourceType>
+        <vmw:Config ovf:required="false" vmw:key="wakeOnLanEnabled" vmw:value="true"/>
+      </Item>
+      <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="false"/>
+      <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/>
+      <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="bios"/>
+      <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/>
+      <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/>
+      <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="false"/>
+      <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="false"/>
+      <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="preset"/>
+      <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="preset"/>
+      <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/>
+      <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="preset"/>
+      <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/>
+      <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/>
+      <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/>
+      <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/>
+      <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="false"/>
+      <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/>
+    </VirtualHardwareSection>
+  </VirtualSystem>
+</Envelope>

=== added file 'ovf/conf/ubuntu-ovf-v1-img.tmpl'
--- ovf/conf/ubuntu-ovf-v1-img.tmpl	1970-01-01 00:00:00 +0000
+++ ovf/conf/ubuntu-ovf-v1-img.tmpl	2016-03-22 02:54:49 +0000
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1"; xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common"; xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"; xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"; xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <References>
+    <File ovf:href="$FILE_DISK_HREF" ovf:id="file1" ovf:size="$FILE_DISK_SIZE" />
+  </References>
+  <DiskSection>
+    <Info>Virtual disk information</Info>
+    <Disk ovf:capacity="$DISK_CAPACITY" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://wiki.qemu.org/download/qcow2-spec.html"/>
+  </DiskSection>
+  <NetworkSection>
+    <Info>The list of logical networks</Info>
+    <Network ovf:name="bridged">
+      <Description>The bridged network</Description>
+    </Network>
+  </NetworkSection>
+  <VirtualSystem ovf:id="vm">
+    <Info>A virtual machine</Info>
+    <Name>$VIRTUAL_SYSTEM_NAME</Name>
+    <OperatingSystemSection ovf:id="93">
+      <Info>$VIRTUAL_SYSTEM_OS_INFO</Info>
+    </OperatingSystemSection>
+    <ProductSection>
+      <Info>Cloud-Init customization</Info>
+      <Product>$VIRTUAL_SYSTEM_OS_INFO</Product>
+      <Property ovf:key="instance-id" ovf:type="string" ovf:userConfigurable="true" ovf:value="id-ovf">
+          <Label>A Unique Instance ID for this instance</Label>
+          <Description>Specifies the instance id.  This is required and used to determine if the machine should take "first boot" actions</Description>
+      </Property>
+      <Property ovf:key="hostname" ovf:type="string" ovf:userConfigurable="true" ovf:value="ubuntuguest">
+          <Description>Specifies the hostname for the appliance</Description>
+      </Property>
+      <Property ovf:key="seedfrom" ovf:type="string" ovf:userConfigurable="true"> 
+          <Label>Url to seed instance data from</Label>
+          <Description>This field is optional, but indicates that the instance should 'seed' user-data and meta-data from the given url.  If set to 'http://tinyurl.com/sm-' is given, meta-data will be pulled from http://tinyurl.com/sm-meta-data and user-data from http://tinyurl.com/sm-user-data.  Leave this empty if you do not want to seed from a url.</Description>
+      </Property>
+      <Property ovf:key="public-keys" ovf:type="string" ovf:userConfigurable="true" ovf:value="">
+          <Label>ssh public keys</Label>
+          <Description>This field is optional, but indicates that the instance should populate the default user's 'authorized_keys' with this value</Description>
+      </Property>
+      <Property ovf:key="user-data" ovf:type="string" ovf:userConfigurable="true" ovf:value="">
+          <Label>Encoded user-data</Label>
+          <Description>In order to fit into a xml attribute, this value is base64 encoded . It will be decoded, and then processed normally as user-data.</Description>
+          <!--  The following represents '#!/bin/sh\necho "hi world"'
+          ovf:value="IyEvYmluL3NoCmVjaG8gImhpIHdvcmxkIgo="
+        -->
+      </Property>
+      <Property ovf:key="password" ovf:type="string" ovf:userConfigurable="true" ovf:value="">
+          <Label>Default User's password</Label>
+          <Description>If set, the default user's password will be set to this value to allow password based login.  The password will be good for only a single login.  If set to the string 'RANDOM' then a random password will be generated, and written to the console.</Description>
+      </Property>
+    </ProductSection>
+    <VirtualHardwareSection ovf:transport="iso">
+      <Info>Virtual hardware requirements</Info>
+      <System>
+        <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+        <vssd:InstanceID>0</vssd:InstanceID>
+        <vssd:VirtualSystemIdentifier>$VIRTUAL_SYSTEM_IDENTIFIER</vssd:VirtualSystemIdentifier>
+        <vssd:VirtualSystemType>$VIRTUAL_SYSTEM_TYPES</vssd:VirtualSystemType>
+      </System>
+      <Item>
+        <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+        <rasd:Description>Number of Virtual CPUs</rasd:Description>
+        <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+        <rasd:InstanceID>1</rasd:InstanceID>
+        <rasd:ResourceType>3</rasd:ResourceType>
+        <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+      </Item>
+      <Item>
+        <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+        <rasd:Description>Memory Size</rasd:Description>
+        <rasd:ElementName>256MB of memory</rasd:ElementName>
+        <rasd:InstanceID>2</rasd:InstanceID>
+        <rasd:ResourceType>4</rasd:ResourceType>
+        <rasd:VirtualQuantity>256</rasd:VirtualQuantity>
+      </Item>
+      <Item ovf:required="false">
+        <rasd:Address>0</rasd:Address>
+        <rasd:Description>USB Controller</rasd:Description>
+        <rasd:ElementName>usb</rasd:ElementName>
+        <rasd:InstanceID>3</rasd:InstanceID>
+        <rasd:ResourceType>23</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:Address>0</rasd:Address>
+        <rasd:Description>SCSI Controller</rasd:Description>
+        <rasd:ElementName>scsiController0</rasd:ElementName>
+        <rasd:InstanceID>4</rasd:InstanceID>
+        <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+        <rasd:ResourceType>6</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:Address>1</rasd:Address>
+        <rasd:Description>IDE Controller</rasd:Description>
+        <rasd:ElementName>ideController1</rasd:ElementName>
+        <rasd:InstanceID>5</rasd:InstanceID>
+        <rasd:ResourceType>5</rasd:ResourceType>
+      </Item>
+      <Item ovf:required="false">
+        <rasd:AddressOnParent>0</rasd:AddressOnParent>
+        <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+        <rasd:ElementName>cdrom1</rasd:ElementName>
+        <rasd:InstanceID>6</rasd:InstanceID>
+        <rasd:Parent>5</rasd:Parent>
+        <rasd:ResourceType>15</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:AddressOnParent>0</rasd:AddressOnParent>
+        <rasd:ElementName>disk1</rasd:ElementName>
+        <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>
+        <rasd:InstanceID>7</rasd:InstanceID>
+        <rasd:Parent>4</rasd:Parent>
+        <rasd:ResourceType>17</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:AddressOnParent>2</rasd:AddressOnParent>
+        <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+        <rasd:Connection>bridged</rasd:Connection>
+        <rasd:Description>ethernet adapter on &quot;bridged&quot;</rasd:Description>
+        <rasd:ElementName>ethernet0</rasd:ElementName>
+        <rasd:InstanceID>8</rasd:InstanceID>
+        <rasd:ResourceSubType>E1000</rasd:ResourceSubType>
+        <rasd:ResourceType>10</rasd:ResourceType>
+      </Item>
+    </VirtualHardwareSection>
+    <AnnotationSection ovf:required="false">
+      <Info>$ANNOTATION_INFO</Info>
+      <Annotation>$ANNOTATION</Annotation>
+    </AnnotationSection>
+  </VirtualSystem>
+</Envelope>

=== added file 'ovf/conf/ubuntu-ovf-v1-vmdk.tmpl'
--- ovf/conf/ubuntu-ovf-v1-vmdk.tmpl	1970-01-01 00:00:00 +0000
+++ ovf/conf/ubuntu-ovf-v1-vmdk.tmpl	2016-03-22 02:54:49 +0000
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1"; xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common"; xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"; xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"; xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <References>
+    <File ovf:href="$FILE_DISK_HREF" ovf:id="file1" ovf:size="$FILE_DISK_SIZE" />
+  </References>
+  <DiskSection>
+    <Info>Virtual disk information</Info>
+    <Disk ovf:capacity="$DISK_CAPACITY" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="$DISK_FORMAT_URI"/>
+  </DiskSection>
+  <NetworkSection>
+    <Info>The list of logical networks</Info>
+    <Network ovf:name="bridged">
+      <Description>The bridged network</Description>
+    </Network>
+  </NetworkSection>
+  <VirtualSystem ovf:id="vm">
+    <Info>A virtual machine</Info>
+    <Name>$VIRTUAL_SYSTEM_NAME</Name>
+    <OperatingSystemSection ovf:id="93">
+      <Info>$VIRTUAL_SYSTEM_OS_INFO</Info>
+    </OperatingSystemSection>
+    <ProductSection>
+      <Info>Cloud-Init customization</Info>
+      <Product>$VIRTUAL_SYSTEM_OS_INFO</Product>
+      <Property ovf:key="instance-id" ovf:type="string" ovf:userConfigurable="true" ovf:value="id-ovf">
+          <Label>A Unique Instance ID for this instance</Label>
+          <Description>Specifies the instance id.  This is required and used to determine if the machine should take "first boot" actions</Description>
+      </Property>
+      <Property ovf:key="hostname" ovf:type="string" ovf:userConfigurable="true" ovf:value="ubuntuguest">
+          <Description>Specifies the hostname for the appliance</Description>
+      </Property>
+      <Property ovf:key="seedfrom" ovf:type="string" ovf:userConfigurable="true"> 
+          <Label>Url to seed instance data from</Label>
+          <Description>This field is optional, but indicates that the instance should 'seed' user-data and meta-data from the given url.  If set to 'http://tinyurl.com/sm-' is given, meta-data will be pulled from http://tinyurl.com/sm-meta-data and user-data from http://tinyurl.com/sm-user-data.  Leave this empty if you do not want to seed from a url.</Description>
+      </Property>
+      <Property ovf:key="public-keys" ovf:type="string" ovf:userConfigurable="true" ovf:value="">
+          <Label>ssh public keys</Label>
+          <Description>This field is optional, but indicates that the instance should populate the default user's 'authorized_keys' with this value</Description>
+      </Property>
+      <Property ovf:key="user-data" ovf:type="string" ovf:userConfigurable="true" ovf:value="">
+          <Label>Encoded user-data</Label>
+          <Description>In order to fit into a xml attribute, this value is base64 encoded . It will be decoded, and then processed normally as user-data.</Description>
+          <!--  The following represents '#!/bin/sh\necho "hi world"'
+          ovf:value="IyEvYmluL3NoCmVjaG8gImhpIHdvcmxkIgo="
+        -->
+      </Property>
+      <Property ovf:key="password" ovf:type="string" ovf:userConfigurable="true" ovf:value="">
+          <Label>Default User's password</Label>
+          <Description>If set, the default user's password will be set to this value to allow password based login.  The password will be good for only a single login.  If set to the string 'RANDOM' then a random password will be generated, and written to the console.</Description>
+      </Property>
+    </ProductSection>
+    <VirtualHardwareSection ovf:transport="iso">
+      <Info>Virtual hardware requirements</Info>
+      <System>
+        <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+        <vssd:InstanceID>0</vssd:InstanceID>
+        <vssd:VirtualSystemIdentifier>$VIRTUAL_SYSTEM_IDENTIFIER</vssd:VirtualSystemIdentifier>
+        <vssd:VirtualSystemType>$VIRTUAL_SYSTEM_TYPES</vssd:VirtualSystemType>
+      </System>
+      <Item>
+        <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+        <rasd:Description>Number of Virtual CPUs</rasd:Description>
+        <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+        <rasd:InstanceID>1</rasd:InstanceID>
+        <rasd:ResourceType>3</rasd:ResourceType>
+        <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+      </Item>
+      <Item>
+        <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+        <rasd:Description>Memory Size</rasd:Description>
+        <rasd:ElementName>256MB of memory</rasd:ElementName>
+        <rasd:InstanceID>2</rasd:InstanceID>
+        <rasd:ResourceType>4</rasd:ResourceType>
+        <rasd:VirtualQuantity>256</rasd:VirtualQuantity>
+      </Item>
+      <Item ovf:required="false">
+        <rasd:Address>0</rasd:Address>
+        <rasd:Description>USB Controller</rasd:Description>
+        <rasd:ElementName>usb</rasd:ElementName>
+        <rasd:InstanceID>3</rasd:InstanceID>
+        <rasd:ResourceType>23</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:Address>0</rasd:Address>
+        <rasd:Description>SCSI Controller</rasd:Description>
+        <rasd:ElementName>scsiController0</rasd:ElementName>
+        <rasd:InstanceID>4</rasd:InstanceID>
+        <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+        <rasd:ResourceType>6</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:Address>1</rasd:Address>
+        <rasd:Description>IDE Controller</rasd:Description>
+        <rasd:ElementName>ideController1</rasd:ElementName>
+        <rasd:InstanceID>5</rasd:InstanceID>
+        <rasd:ResourceType>5</rasd:ResourceType>
+      </Item>
+      <Item ovf:required="false">
+        <rasd:AddressOnParent>0</rasd:AddressOnParent>
+        <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+        <rasd:ElementName>cdrom1</rasd:ElementName>
+        <rasd:InstanceID>6</rasd:InstanceID>
+        <rasd:Parent>5</rasd:Parent>
+        <rasd:ResourceType>15</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:AddressOnParent>0</rasd:AddressOnParent>
+        <rasd:ElementName>disk1</rasd:ElementName>
+        <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>
+        <rasd:InstanceID>7</rasd:InstanceID>
+        <rasd:Parent>4</rasd:Parent>
+        <rasd:ResourceType>17</rasd:ResourceType>
+      </Item>
+      <Item>
+        <rasd:AddressOnParent>2</rasd:AddressOnParent>
+        <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+        <rasd:Connection>bridged</rasd:Connection>
+        <rasd:Description>ethernet adapter on &quot;bridged&quot;</rasd:Description>
+        <rasd:ElementName>ethernet0</rasd:ElementName>
+        <rasd:InstanceID>8</rasd:InstanceID>
+        <rasd:ResourceSubType>E1000</rasd:ResourceSubType>
+        <rasd:ResourceType>10</rasd:ResourceType>
+      </Item>
+    </VirtualHardwareSection>
+    <AnnotationSection ovf:required="false">
+      <Info>$ANNOTATION_INFO</Info>
+      <Annotation>$ANNOTATION</Annotation>
+    </AnnotationSection>
+  </VirtualSystem>
+</Envelope>

=== added file 'ovf/conf/ubuntu-ovf-vcloud-vmdk.tmpl'
--- ovf/conf/ubuntu-ovf-vcloud-vmdk.tmpl	1970-01-01 00:00:00 +0000
+++ ovf/conf/ubuntu-ovf-vcloud-vmdk.tmpl	2016-03-22 02:54:49 +0000
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Generated by VMware ovftool 3.5.0 (build-1274719), UTC time: 2014-04-02T22:31:12.252589Z-->
+<ovf:Envelope vmw:buildId="build-1274719" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"; xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData"; xmlns:vcloud="http://www.vmware.com/vcloud/v1.5"; xmlns:vmw="http://www.vmware.com/schema/ovf"; xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://www.vmware.com/schema/ovf http://www.vmware.com/schema/ovf http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://www.vmware.com/vcloud/v1.5 http://10.2.74.5/api/v1.5/schema/master.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd";>
+    <ovf:References>
+        <ovf:File ovf:href="$FILE_DISK_HREF" ovf:id="file1" ovf:size="$FILE_DISK_SIZE" />
+    </ovf:References>
+    <ovf:DiskSection>
+        <ovf:Info>Virtual disk information</ovf:Info>
+        <ovf:Disk ovf:capacity="$DISK_CAPACITY" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized"; ovf:populatedSize=""/>
+    </ovf:DiskSection>
+    <ovf:VirtualSystem ovf:id="vm">
+        <ovf:Info>A virtual machine</ovf:Info>
+        <ovf:Name>$VIRTUAL_SYSTEM_OS_INFO</ovf:Name>
+        <ovf:OperatingSystemSection ovf:id="94" vmw:osType="$VIRTUAL_SYSTEM_GUEST">
+            <ovf:Info>$VIRTUAL_SYSTEM_OS_INFO</ovf:Info>
+            <ovf:Description>$VIRTUAL_SYSTEM_DESC</ovf:Description>
+        </ovf:OperatingSystemSection>
+        <ovf:VirtualHardwareSection ovf:transport="iso">
+            <ovf:Info>Virtual hardware requirements</ovf:Info>
+            <ovf:System>
+                <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+                <vssd:InstanceID>0</vssd:InstanceID>
+                <vssd:VirtualSystemIdentifier>$VIRTUAL_SYSTEM_OS_INFO</vssd:VirtualSystemIdentifier>
+                <vssd:VirtualSystemType>vmx-09</vssd:VirtualSystemType>
+            </ovf:System>
+            <ovf:Item>
+                <rasd:Address>0</rasd:Address>
+                <rasd:Description>SCSI Controller</rasd:Description>
+                <rasd:ElementName>SCSI Controller 0</rasd:ElementName>
+                <rasd:InstanceID>2</rasd:InstanceID>
+                <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+                <rasd:ResourceType>6</rasd:ResourceType>
+                <vmw:Config ovf:required="false" vmw:key="slotInfo.pciSlotNumber" vmw:value="16"/>
+            </ovf:Item>
+            <ovf:Item>
+                <rasd:AddressOnParent>0</rasd:AddressOnParent>
+                <rasd:Description>Hard disk</rasd:Description>
+                <rasd:ElementName>Hard disk 1</rasd:ElementName>
+                <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>
+                <rasd:InstanceID>2000</rasd:InstanceID>
+                <rasd:Parent>2</rasd:Parent>
+                <rasd:ResourceType>17</rasd:ResourceType>
+                <vmw:Config ovf:required="false" vmw:key="backing.writeThrough" vmw:value="false"/>
+            </ovf:Item>
+            <ovf:Item>
+                <rasd:Address>1</rasd:Address>
+                <rasd:Description>IDE Controller</rasd:Description>
+                <rasd:ElementName>IDE Controller 1</rasd:ElementName>
+                <rasd:InstanceID>3</rasd:InstanceID>
+                <rasd:ResourceType>5</rasd:ResourceType>
+            </ovf:Item>
+            <ovf:Item>
+                <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+                <rasd:Description>Number of Virtual CPUs</rasd:Description>
+                <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+                <rasd:InstanceID>4</rasd:InstanceID>
+                <rasd:Reservation>0</rasd:Reservation>
+                <rasd:ResourceType>3</rasd:ResourceType>
+                <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+                <rasd:Weight>1000</rasd:Weight>
+                <vmw:CoresPerSocket ovf:required="false">1</vmw:CoresPerSocket>
+            </ovf:Item>
+            <ovf:Item>
+                <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+                <rasd:Description>Memory Size</rasd:Description>
+                <rasd:ElementName>1024 MB of memory</rasd:ElementName>
+                <rasd:InstanceID>5</rasd:InstanceID>
+                <rasd:Reservation>1024</rasd:Reservation>
+                <rasd:ResourceType>4</rasd:ResourceType>
+                <rasd:VirtualQuantity>1024</rasd:VirtualQuantity>
+                <rasd:Weight>10240</rasd:Weight>
+            </ovf:Item>
+            <ovf:Item>
+                <rasd:Address>1</rasd:Address>
+                <rasd:Description>IDE Controller</rasd:Description>
+                <rasd:ElementName>IDE 1</rasd:ElementName>
+                <rasd:InstanceID>100</rasd:InstanceID>
+                <rasd:ResourceType>5</rasd:ResourceType>
+            </ovf:Item>
+            <ovf:Item>
+                <rasd:AddressOnParent>0</rasd:AddressOnParent>
+                <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+                <rasd:Description>CD/DVD Drive</rasd:Description>
+                <rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
+                <rasd:HostResource/>
+                <rasd:InstanceID>3002</rasd:InstanceID>
+                <rasd:Parent>100</rasd:Parent>
+                <rasd:ResourceType>15</rasd:ResourceType>
+            </ovf:Item>
+            <vmw:Config ovf:required="false" vmw:key="cpuHotAddEnabled" vmw:value="true"/>
+            <vmw:Config ovf:required="false" vmw:key="cpuHotRemoveEnabled" vmw:value="false"/>
+            <vmw:Config ovf:required="false" vmw:key="firmware" vmw:value="bios"/>
+            <vmw:Config ovf:required="false" vmw:key="virtualICH7MPresent" vmw:value="false"/>
+            <vmw:Config ovf:required="false" vmw:key="virtualSMCPresent" vmw:value="false"/>
+            <vmw:Config ovf:required="false" vmw:key="memoryHotAddEnabled" vmw:value="true"/>
+            <vmw:Config ovf:required="false" vmw:key="nestedHVEnabled" vmw:value="true"/>
+            <vmw:Config ovf:required="false" vmw:key="powerOpInfo.powerOffType" vmw:value="soft"/>
+            <vmw:Config ovf:required="false" vmw:key="powerOpInfo.resetType" vmw:value="soft"/>
+            <vmw:Config ovf:required="false" vmw:key="powerOpInfo.standbyAction" vmw:value="checkpoint"/>
+            <vmw:Config ovf:required="false" vmw:key="powerOpInfo.suspendType" vmw:value="hard"/>
+            <vmw:Config ovf:required="false" vmw:key="tools.afterPowerOn" vmw:value="true"/>
+            <vmw:Config ovf:required="false" vmw:key="tools.afterResume" vmw:value="true"/>
+            <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestShutdown" vmw:value="true"/>
+            <vmw:Config ovf:required="false" vmw:key="tools.beforeGuestStandby" vmw:value="true"/>
+            <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="true"/>
+            <vmw:Config ovf:required="false" vmw:key="tools.toolsUpgradePolicy" vmw:value="manual"/>
+        </ovf:VirtualHardwareSection>
+        <vcloud:GuestCustomizationSection ovf:required="false">
+            <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
+            <vcloud:Enabled>true</vcloud:Enabled>
+            <vcloud:ChangeSid>false</vcloud:ChangeSid>
+            <vcloud:JoinDomainEnabled>false</vcloud:JoinDomainEnabled>
+            <vcloud:UseOrgSettings>false</vcloud:UseOrgSettings>
+            <vcloud:AdminPasswordEnabled>true</vcloud:AdminPasswordEnabled>
+            <vcloud:AdminPasswordAuto>true</vcloud:AdminPasswordAuto>
+            <vcloud:ResetPasswordRequired>true</vcloud:ResetPasswordRequired>
+        </vcloud:GuestCustomizationSection>
+    </ovf:VirtualSystem>
+</ovf:Envelope>

=== added file 'ovf/conf/utopic-server-amd64.conf'
--- ovf/conf/utopic-server-amd64.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/utopic-server-amd64.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 14.10 (Utopic Unicorn) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 14.10 (Utopic Unicorn) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntu64Guest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux (64 bit)'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 14.10 amd64'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/utopic-server.conf'
--- ovf/conf/utopic-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/utopic-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 14.10 (Utopic Unicorn) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 14.10 (Utopic Unicorn) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntuGuest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 14.10 i386'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/vivid-server-amd64.conf'
--- ovf/conf/vivid-server-amd64.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/vivid-server-amd64.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 15.04 (Vivid Vervet) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 15.04 (Vivid Vervet) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntu64Guest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux (64 bit)'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 15.04 amd64'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/vivid-server.conf'
--- ovf/conf/vivid-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/vivid-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 15.04 (Vivid Vervet) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 15.04 (Vivid Vervet) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntuGuest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 15.04 i386'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/wily-server-amd64.conf'
--- ovf/conf/wily-server-amd64.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/wily-server-amd64.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 15.10 (Wily Werewolf) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 15.10 (Wily Werewolf) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntu64Guest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux (64 bit)'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 15.10 amd64'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/wily-server.conf'
--- ovf/conf/wily-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/wily-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 15.10 (Wily Werewolf) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 15.10 (Wily Werewolf) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntuGuest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 15.10 i386'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/xenial-server-amd64.conf'
--- ovf/conf/xenial-server-amd64.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/xenial-server-amd64.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 16.04-LTS (Xenial Xerus) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 16.04-LTS (Xenial Xerus) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntu64Guest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux (64 bit)'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 16.04 LTS amd64'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/conf/xenial-server.conf'
--- ovf/conf/xenial-server.conf	1970-01-01 00:00:00 +0000
+++ ovf/conf/xenial-server.conf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,8 @@
+VIRTUAL_SYSTEM_NAME: 'Ubuntu'
+VIRTUAL_SYSTEM_OS_INFO: 'Ubuntu 16.04-LTS (Xenial Xerus) Server'
+VIRTUAL_SYSTEM_IDENTIFIER: 'Ubuntu 16.04-LTS (Xenial Xerus) Server'
+VIRTUAL_SYSTEM_GUEST: 'ubuntuGuest'
+VIRTUAL_SYSTEM_DESC: 'Ubuntu Linux'
+VIRTUAL_SYSTEM_VM_NAME: 'Ubuntu Server 16.04 LTS i386'
+ANNOTATION_INFO: For more information, see http://ubuntu.com
+ANNOTATION: This is Ubuntu Server.

=== added file 'ovf/diskimg2ova'
--- ovf/diskimg2ova	1970-01-01 00:00:00 +0000
+++ ovf/diskimg2ova	2016-03-22 02:54:49 +0000
@@ -0,0 +1,162 @@
+#!/bin/bash
+#
+# Use VMware's open-vmdk tools to create an OVA image
+# This is a little hacky, but qemu and even virtualbox cannot
+# produce a proper vmware-portable OVA. 
+#
+error() { echo "$@" 1>&2; }
+debug() { error "$(date -R):" "$@"; }
+cleanup() {
+    [ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+    cat <<EOF
+Usage: ${0##*/} partition-image output-dir
+   build ovf from partition-image into output-dir
+ options:
+    --template TEMPLATE  use template TEMPLATE for creating .ovf
+    --prefix   PREFIX    name files in output-dir prefixed with PREFIX
+    --size     SIZE      make the disk image size SIZE
+    --disk     DISK      use partitioned image DISK
+    --out      OUT       use directory for output
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+# fullpath(file)
+fp() {
+    case "$1" in
+        /*) _RET=${1};;
+        *) _RET="${2:-${PWD}}/${1}";;
+    esac
+    return 0
+}
+
+short_opts="h"
+long_opts="help,config:,prefix:,size:,template:,disk:,out:,version:"
+getopt_out=$(getopt --name "${0##*/}" \
+    --options "${short_opts}" --long "${long_opts}" -- "$@") &&
+    eval set -- "${getopt_out}" ||
+    bad_Usage
+
+# Set some pathing
+my_dir="$(readlink -f $(dirname ${0}))"
+conf=""
+tmpl="${my_dir}/conf/ubuntu-ova-v1-vmdk.tmpl"
+pref="sample"
+size="10"
+
+while [ $# -ne 0 ]; do
+    cur=${1}; next=${2};
+    case "$cur" in
+        -h|--help) Usage; exit 0;;
+           --config)     conf=${next}; shift;;
+           --template)   tmpl=${next}; shift;;
+           --prefix)     prefix=${next}; shift;;
+           --size)       size=${next}; shift;;
+           --disk)       disk=${next}; shift;;
+           --out)        out_d=${next}; shift;;
+           --version)    version=${next}; shift;;
+        --) shift; break;;
+    esac
+    shift;
+done
+
+[ ! -f "${tmpl}" ] && fail "did not find ${tmpl}"
+
+trap cleanup EXIT
+TEMP_D=$(mktemp -d)
+cd ${TEMP_D}
+
+debug "Working in ${TEMP_D}"
+name="${prefix}"
+vmdk_base_f="${name}-disk1.vmdk"
+vmdk_f="${TEMP_D}/${vmdk_base_f}"
+work_disk_f="${TEMP_D}/${name}.raw"
+final_ova="${out_d}/${name}.ova"
+
+# Converting the disk to the write format
+debug "converting ${work_disk_f} to"
+debug "           ${vmdk_f}"
+debug "    please be patient...this takes a bit"
+
+# Resize the disk
+debug "creating transitional copy"
+cp -au "${disk}" "${vmdk_f}.raw" ||
+    fail "failed to create transitional image"
+
+debug "resizing disk"
+qemu-img resize \
+    "${vmdk_f}.raw" "${size}G" ||
+    fail "failed to rewize transitional disk"
+
+debug "converting disk to vmdk...this will take a while"
+python2.7 ${my_dir}/VMDKstream.py \
+    "${vmdk_f}.raw" "${vmdk_f}" ||
+    fail "failed to convert disk to VMDK"
+
+# Get the information that we need out of it
+debug "getting file size information"
+vmdk_size=$(du -b "${vmdk_f}" | cut -f1) ||
+    fail "failed to get vmdk_size for ${vmdk_f}"
+vmdk_capacity=$(qemu-img info "${vmdk_f}" \
+        | awk '-F[( ]' '$1 ~ /virtual/ && $NF ~ /bytes)/ {print$(NF-1)}') ||
+    fail "failed to get vmdk capacity for ${vmdk_f}"
+
+debug "generating sha1 for ${vmdk_f}"
+vmdk_sha1=$(sha1sum ${vmdk_f} | cut -d' ' -f1) ||
+    fail "failed to get vmdk SHA1"
+
+ovf="${TEMP_D}/${prefix}.ovf"
+cp "${tmpl}" "${ovf}" ||
+    fail "failed placement of OVF to ${ovf}"
+
+serial_stamp=$(date +%Y%m%d)
+sed -i "${ovf}" \
+    -e "s/@@NAME@@/$name/g" \
+    -e "s/@@VMDK_FILE_SIZE@@/$vmdk_size/g" \
+    -e "s/@@VMDK_CAPACITY@@/$vmdk_capacity/g" \
+    -e "s/@@NUM_CPUS@@/2/g" \
+    -e "s/@@VERSION@@/$version/g" \
+    -e "s/@@DATE@@/$serial_stamp/g" \
+    -e "s/@@MEM_SIZE@@/1024/g" ||
+        fail "failed to populate OVF values"
+
+debug "generating sha1 for ${TEMP_D}/${prefix}.ovf"
+ovf_sha1=$(sha1sum ${ovf} | cut -d' ' -f1) ||
+    fail "failed to get ${ovf} SHA1"
+
+manifest="${TEMP_D}/${prefix}.mf"
+cat > "${manifest}" <<EOF
+SHA1(${vmdk_base_f})= ${vmdk_sha1}
+SHA1(${prefix}.ovf)= ${ovf_sha1}
+EOF
+
+debug "OVA information:"
+cat <<EOM
+OVA information:
+    Name:       ${name}
+    Size:       ${vmdk_size}
+    Capacity:   ${vmdk_capacity}
+    VMDK Name:  ${vmdk_f}
+    VMDK SHA1:  ${vmdk_sha1}
+    OVF NAME:   ${ovf}
+    OVF SHA1:   ${ovf_sha1}
+    File Name:  ${final_ova}
+EOM
+
+debug "packing OVA to ${final_ova}"
+tar -C ${TEMP_D} \
+    -cf ${final_ova} \
+    ${prefix}.ovf \
+    ${prefix}.mf \
+    $(basename ${vmdk_f}) ||
+        fail "failed to create the OVA image"
+
+debug "OVA members are:"
+tar -tf ${final_ova}
+
+debug "wrote ${final_ova} to ${out_d}"
+
+# vi: ts=4 noexpandtab

=== added file 'ovf/diskimg2ovf'
--- ovf/diskimg2ovf	1970-01-01 00:00:00 +0000
+++ ovf/diskimg2ovf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,103 @@
+#!/bin/bash
+
+error() { echo "$@" 1>&2; }
+debug() { error "$(date -R):" "$@"; }
+cleanup() {
+	[ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} partition-image output-dir
+   build ovf from partition-image into output-dir
+ options:
+    --config   CONFIG    use config CONFIG
+    --template TEMPLATE  use template TEMPLATE for creating .ovf
+    --prefix   PREFIX    name files in output-dir prefixed with PREFIX
+    --size 	   SIZE      make the disk image size SIZE
+    --disk     DISK      use partitioned image DISK
+    --out      OUT       use directory for output
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+# fullpath(file)
+fp() {
+	case "$1" in
+		/*) _RET=${1};;
+		*) _RET="${2:-${PWD}}/${1}";;
+	esac
+	return 0
+}
+
+base_d=$(dirname $(readlink -f "${0}"))
+conf_d="${base_d}/conf"
+
+short_opts="h"
+long_opts="help,config:,prefix:,size:,template:,disk:,out:"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+conf=""
+tmpl=""
+pref="sample"
+size=""
+
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-h|--help) Usage; exit 0;;
+		   --config) conf=${next}; shift;;
+		   --template) tmpl=${next}; shift;;
+		   --prefix) prefix=${next}; shift;;
+		   --size) size=${next}; shift;;
+		   --disk) disk=${next}; shift;;
+		   --out)  out_d=${next}; shift;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+out_d="${out_d:-$2}"
+out_ovf="${out_d}/${prefix}.ovf"
+
+[ ! -e "${conf}" -a -f "${conf_d}/${conf}" ] && conf="${conf_d}/${conf}"
+[ ! -e "${tmpl}" -a -f "${conf_d}/${tmpl}" ] && tmpl="${conf_d}/${tmpl}"
+
+[ -n "${conf}" ] || bad_Usage "must give conf"
+[ -f "${conf}" ] || bad_Usage "conf not a file: ${conf}"
+[ -n "${tmpl}" ] || bad_Usage "must give template"
+[ -f "${tmpl}" ] || bad_Usage "template not a file: ${tmpl}"
+
+
+fp "${conf}" ; conf_fp=${_RET}
+fp "${tmpl}" ; tmpl_fp=${_RET}
+
+[ -d "${out_d}" ] || mkdir -p "${out_d}" || fail "${out_d}: not a dir"
+
+PATH="${PATH}:${base_d}"
+
+# Determine virtual disk size
+disk_type="$(qemu-img info ${out_d}/${disk} | awk '/file format/ {print tolower($NF)}')"
+[ "${disk_type}" = "qcow2" ] && {
+        capacity="$(qemu-img info ${out_d}/${disk} | awk '-F(' '/virtual size/ {print$2}' | awk '{print$1}')" ||
+        fail "unable to determine qcow2 image capacity"
+}
+
+[ "${disk_type}" = "vmdk" ] && {
+        capacity="$(vboxmanage showhdinfo ${out_d}/${disk} |  awk '/Logical size:/ {print$3}')" &&
+        capacity=$((capacity * 1024 * 1024)) ||
+        fail "unable to determine vmdk image capacity"
+}
+
+[ -z "${capacity}" ] && fail "invalid (null) capacity detected for images"
+
+export DISK_CAPACITY=${capacity}
+
+( cd "${out_d}" &&
+  write-ovf "${conf_fp}" "${tmpl_fp}" "${disk}" > "${out_ovf}" ) ||
+	fail "failed write-ovf ${conf} ${tmpl} ${disk} > ${out_ovf}"
+
+debug "wrote to ${out_ovf}"
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2disk'
--- ovf/part2disk	1970-01-01 00:00:00 +0000
+++ ovf/part2disk	2016-03-22 02:54:49 +0000
@@ -0,0 +1,232 @@
+#!/bin/bash
+#    part2disk - wrap a partition image in a disk image
+#
+#    Copyright (C) 2010 Canonical Ltd.
+#
+#    Authors: Scott Moser <smoser@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEF_CYLINDER_SIZE=16065
+DEF_SECTOR_SIZE=512
+DEBUG=0
+base_d=$(dirname $(readlink -f "${0}"))
+PATH="${PATH}:${base_d}"
+error() { echo "$@" 1>&2; }
+debug() {
+	[ "${DEBUG}" -ge "${1:-0}" ] && shift || return 0;
+	error "$@";
+}
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [options] partition-image disk-image
+
+   create disk image 'disk-image' with 'partition-image' in a partition
+   inside it.
+
+   options:
+      -b | --bootcode F write "bootcode" from file 'F' to the at the beginning
+                        of the disk
+      -c | --cylinder-size C
+                        size of cylinders for the disk in 512 byte units
+                        default is ${DEF_CYLINDER_SIZE}
+      -G | --grub       install grub to disk image mbr
+      -s | --size  S    create the disk image of size 'S'.
+                        default is large enough to fit partition-image
+      -v | --verbose    increase verbosity
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+human2bytes() {
+   # converts size suitable for input to resize2fs to bytes
+   # s:512 byte sectors, K:kilobytes, M:megabytes, G:gigabytes
+   # none: block size of the image
+   local input=${1} defunit=${2:-1024}
+   local unit count;
+   case "$input" in
+      *s) count=${input%s}; unit=512;;
+      *K) count=${input%K}; unit=1024;;
+      *M) count=${input%M}; unit=$((1024*1024));;
+      *G) count=${input%G}; unit=$((1024*1024*1024));;
+      *)  count=${input}  ; unit=${2:-1024};;
+   esac
+   _RET=$((${count}*${unit}))
+}
+
+short_opts="b:c:Ghs:v"
+long_opts="bootcode:,grub,help,cylinder-size:,size:,verbose"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+csize=${DEF_CYLINDER_SIZE}
+ssize=${DEF_SECTOR_SIZE}
+size_in=""
+bootcode=""
+grub_ptnum=1
+grub=0
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-b|--boot-code) bootcode="$2"; shift;;
+		-c|--cylinder-size) csize=$2; shift;;
+		-G|--grub) grub=1;;
+		-h|--help) Usage; exit 0;;
+		-s|--size) size_in=$2; shift;;
+		-v|--verbose) DEBUG=$((${DEBUG}+1));;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+rootfs_dm=""
+loop_raw=""
+loop_dev=""
+clean_loops() {
+	debug 1 "Cleaning up loops"
+
+    [ -z "${rootfs_dm}" ] || {
+        find /dev/mapper -iname "${loop_dev///dev\//}*" | \
+			xargs -n1  -I DEVICE dmsetup remove DEVICE ||
+            	kpartx -d "${rootfs_dm}" ||
+                	echo "Failed to remove device mapper devices for ${copy_rootfs_loop}"
+        losetup -d "${loop_dev}";
+		unset loop_raw
+    }
+
+	[ -z "${loop_dev}" ] &&
+		losetup -d "${loop_dev}"
+
+}
+
+[ $# -eq 2 ] || bad_Usage "must supply partition image and output file"
+
+pimg=${1}
+dimg=${2}
+
+{ [ ${grub} -eq 0 ] || phelper=$(command -v part2disk-grubhelper); } ||
+	fail "no part2disk-grubhelper in PATH"
+
+[ -f "${pimg}" -o -b "${pimg}" ] || fail "${pimg}: not a file or block device"
+
+if [ -b "${pimg}" ]; then
+	kname=$(readlink -f "${pimg}") &&
+		pimg_s=$(awk '$4 == kn { print $3 * 1024 }' \
+		             "kn=${kname##*/}" /proc/partitions) &&
+		[ -n "${pimg_s}" ] ||
+		fail "failed to read size of ${pimg} from /proc/partitions"
+else
+	pimg_s=$(stat --format "%s" "${pimg}") ||
+		fail "failed to get size of ${pimg}"
+fi
+
+if [ -n "${size_in}" ]; then
+	human2bytes "${size_in}" 1 || fail "failed to convert ${size_in} to bytes"
+	size=${_RET}
+	cylinders=$((${size}/(${csize}*${ssize})))
+else
+	# no size specified, get enough cylinders to fit part_img
+	# get 1 full cylinder + any remainder
+	cylinders=$((${pimg_s}/(${csize}*${ssize}) + 1))
+	[ "${pimg_s}" = "$((${csize}*${ssize}))" ] || cylinders=$((${cylinders}+1))
+	size=$((${cylinders}*${ssize}*${csize}))
+fi
+
+debug 1 "using ${cylinders} cylinders of ${csize} * ${ssize} = $((${cylinders}*${ssize}*${csize})) bytes"
+
+if [ ! -b ${dimg} ]; then
+	dd if=/dev/zero of=${dimg} bs=1 count=0 seek=${size} ||
+		fail "Failed to create spare file"
+	stat ${dimg}
+fi
+
+if [ -n "${bootcode}" ]; then
+	boot_size=$(stat --format="%s" "${bootcode}")
+	[ ${boot_size} > 1048999 ] && fail "Bootcode file is too big!"
+
+	[ -f "${bootcode}" ] || fail "${bootcode}: not a file"
+	debug 1 "writing bootcode from ${bootcode}"
+	zcat --force "${bootcode}" | dd of="${dimg}" 2>/dev/null ||
+		fail "failed to write from ${bootcode}"
+fi
+
+# Use parted for the creation of the partition table for a couple of reasons.
+# The biggest is that parted allows for the easy creation of an aligned
+# partition table. The other reason is that parted understands how to create
+# GPT tables. So in the future, we can easily switch to a dual UEFI/GRUB
+# image
+parted_cmd="parted ${dimg} --script --"
+
+# Create the partition table
+${parted_cmd} mklabel msdos ||
+	fail "Failed to create MSDOS partition table"
+
+# Create the primary partition
+${parted_cmd} mkpart primary 1 -1 ||
+	fail "Failed to create primary partition entry"
+
+# Make the first partition bootable
+${parted_cmd} set 1 B ||
+	fail "Failed to set primary partition bootable"
+
+# Print the table
+${parted_cmd} print
+
+# Check the alignment
+${parted_cmd} align-check opt 1 ||
+	fail "Resultant partition is not properly aligned"
+
+if [ ! -b "${dimg}" ]; then
+	# Set the trap to make sure exit doesn't hose the system
+	trap clean_loops EXIT
+
+	# Setup the loop to work with
+	loop_raw="$(kpartx -v -a ${dimg} )" ||
+		fail "Failed to add image via kpartx"
+	loop_dev="$(echo -e ${loop_raw} |  head -n1 | awk '{print($(NF-1))}')" ||
+		fail "Unable to determine loop device"
+	rootfs_dm="/dev/mapper${loop_dev///dev/}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "${rootfs_dm} is not a block device"
+
+else
+	udevadm settle
+	blockdev --rereadpt ${dimg}
+	udevadm settle
+
+	[ -b "${dimg}1" ] && rootfs_dm="${dimg}1"
+	[ -b "${dimg}p1" ] && rootfs_dm="${dimg}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "No partition to work with"
+fi
+
+# Now copy the source image
+dd if="${pimg}" of="${rootfs_dm}" &&
+	debug 1 "Copied partition to disk" ||
+	fail    "Failed to copy the partition into disk"
+
+clean_loops
+trap - EXIT
+
+if [ ${grub} -ne 0 ]; then
+	debug 1 "invoking part2disk-grubhelper ${dimg}"
+	sudo "${phelper}" "${dimg}" ||
+		fail "part2disk-grubhelper ${dimg} failed"
+fi
+
+error "wrote to ${dimg}"
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2disk-gpt.amd64'
--- ovf/part2disk-gpt.amd64	1970-01-01 00:00:00 +0000
+++ ovf/part2disk-gpt.amd64	2016-03-22 02:54:49 +0000
@@ -0,0 +1,221 @@
+#!/bin/bash
+#    part2disk-gpt - wrap a partition image in a partition setup
+#        suitable for use with BIOS/GPT and UEFI installation wtih
+#        an EFI ESP and GPT boot partition.
+#
+#    Copyright (C) 2010-2013 Canonical Ltd.
+#
+#    Authors: Scott Moser <smoser@xxxxxxxxxxxxx>
+#             Ben Howard <ben.howard@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEF_CYLINDER_SIZE=16065
+DEF_SECTOR_SIZE=512
+DEBUG=0
+EXTEND_BYTES=113246209	#108MB, covers the UEFI extensions
+base_d=$(dirname $(readlink -f "${0}"))
+PATH="${PATH}:${base_d}"
+error() { echo "$@" 1>&2; }
+debug() {
+	[ "${DEBUG}" -ge "${1:-0}" ] && shift || return 0;
+	error "$@";
+}
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [options] partition-image disk-image
+
+   create disk image 'disk-image' with 'partition-image' in a partition
+   inside it.
+
+   options:
+      -c | --cylinder-size C
+                        size of cylinders for the disk in 512 byte units
+                        default is ${DEF_CYLINDER_SIZE}
+      -s | --size  S    create the disk image of size 'S'.
+                        default is large enough to fit partition-image
+      -v | --verbose    increase verbosity
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+human2bytes() {
+   # converts size suitable for input to resize2fs to bytes
+   # s:512 byte sectors, K:kilobytes, M:megabytes, G:gigabytes
+   # none: block size of the image
+   local input=${1} defunit=${2:-1024}
+   local unit count;
+   case "$input" in
+      *s) count=${input%s}; unit=512;;
+      *K) count=${input%K}; unit=1024;;
+      *M) count=${input%M}; unit=$((1024*1024));;
+      *G) count=${input%G}; unit=$((1024*1024*1024));;
+      *)  count=${input}  ; unit=${2:-1024};;
+   esac
+   _RET=$((${count}*${unit}))
+}
+
+short_opts="c:Ghs:v"
+long_opts="help,cylinder-size:,size:,verbose"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+csize=${DEF_CYLINDER_SIZE}
+ssize=${DEF_SECTOR_SIZE}
+size_in=""
+
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-c|--cylinder-size) csize=$2; shift;;
+		-h|--help) Usage; exit 0;;
+		-s|--size) size_in=$2; shift;;
+		-v|--verbose) DEBUG=$((${DEBUG}+1));;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+rootfs_dm=""
+loop_raw=""
+loop_dev=""
+clean_loops() {
+	debug 1 "Cleaning up loops"
+
+    [ -z "${rootfs_dm}" ] || {
+        find /dev/mapper -iname "${loop_dev///dev\//}*" | \
+			xargs -n1  -I DEVICE dmsetup remove DEVICE ||
+            	kpartx -d "${rootfs_dm}" ||
+                	echo "Failed to remove device mapper devices for ${copy_rootfs_loop}"
+        losetup -d "${loop_dev}";
+		unset loop_raw
+    }
+
+	[ -z "${loop_dev}" ] &&
+		losetup -d "${loop_dev}"
+
+}
+
+[ $# -eq 2 ] || bad_Usage "must supply partition image and output file"
+
+pimg=${1}
+dimg=${2}
+
+phelper=$(command -v part2disk-grubhelper.uefi) ||
+	fail "no part2disk-grubhelper-uefi in PATH"
+
+[ -f "${pimg}" -o -b "${pimg}" ] || fail "${pimg}: not a file or block device"
+
+if [ -b "${pimg}" ]; then
+	kname=$(readlink -f "${pimg}") &&
+		pimg_s=$(awk '$4 == kn { print $3 * 1024 }' \
+		             "kn=${kname##*/}" /proc/partitions) &&
+		[ -n "${pimg_s}" ] ||
+		fail "failed to read size of ${pimg} from /proc/partitions"
+else
+	pimg_s=$(stat --format "%s" "${pimg}") ||
+		fail "failed to get size of ${pimg}"
+fi
+
+if [ -n "${size_in}" ]; then
+	human2bytes "${size_in}" 1 || fail "failed to convert ${size_in} to bytes"
+	size=$((${_RET} + ${EXTEND_BYTES})) # size is return + space need for boot parts
+	cylinders=$((${size}/(${csize}*${ssize})))
+else
+	# no size specified, get enough cylinders to fit part_img
+	# get 1 full cylinder + any remainder
+	pimg_se=$((${pimg_s} + ${EXTEND_BYTES})) # size is image size + space needed for boot parts
+	cylinders=$((${pimg_se}/(${csize}*${ssize}) + 1))
+	[ "${pimg_se}" = "$((${csize}*${ssize}))" ] || cylinders=$((${cylinders}+1))
+	size=$((${cylinders}*${ssize}*${csize}))
+fi
+
+debug 1 "using ${cylinders} cylinders of ${csize} * ${ssize} = $((${cylinders}*${ssize}*${csize})) bytes"
+
+if [ ! -b ${dimg} ]; then
+	dd if=/dev/zero of=${dimg} bs=1 count=0 seek=${size} ||
+		fail "Failed to create spare file"
+	stat ${dimg}
+fi
+
+### GPT magic:
+# GPT allows for you have to non-contigious partition numbers, i.e 2 and be
+# phyically location before 1. Since we really like root being on partition 1
+# we are going create three partition entries
+#	14: is the GRUB_BIOS location, where Grub will shove its bits
+#	15: is the EFI system partition
+#	 1: is the traditional root FS
+#
+# This means that we have to create things a little backwards, but oh well
+#
+# Because of Virtio minor limitations, the max device minor is 15.
+
+# Creates the GPT partition table
+sgdisk ${dimg} \
+	--new=14::+4M \
+	--new=15::+106M \
+	--new=1:: ||
+	fail "Failed to create GPT partitions"
+
+sgdisk ${dimg} \
+	-t 14:ef02 \
+	-t 15:ef00 ||
+	fail "Failed to type partitions properly"
+
+parted ${dimg} --script -- print
+
+#
+####
+
+if [ ! -b "${dimg}" ]; then
+	# Set the trap to make sure exit doesn't hose the system
+	trap clean_loops EXIT
+
+	# Setup the loop to work with
+	loop_raw="$(kpartx -v -a ${dimg} )" ||
+		fail "Failed to add image via kpartx"
+	loop_dev="$(echo -e ${loop_raw} |  head -n1 | awk '{print($(NF-1))}')" ||
+		fail "Unable to determine loop device"
+	rootfs_dm="/dev/mapper${loop_dev///dev/}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "${rootfs_dm} is not a block device"
+
+else
+	udevadm settle
+	blockdev --rereadpt ${dimg}
+	udevadm settle
+
+	[ -b "${dimg}1" ] && rootfs_dm="${dimg}1"
+	[ -b "${dimg}p1" ] && rootfs_dm="${dimg}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "No partition to work with"
+fi
+
+# Now copy the source image
+dd if="${pimg}" of="${rootfs_dm}" &&
+	debug 1 "Copied partition to disk" ||
+	fail    "Failed to copy the partition into disk"
+
+clean_loops
+trap - EXIT
+
+debug 1 "invoking part2disk-grubhelper-uefi ${dimg}"
+sudo "${phelper}" "${dimg}" ||
+	fail "part2disk-grubhelper-uefi ${dimg} failed"
+
+error "wrote to ${dimg}"
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2disk-gpt.arm64'
--- ovf/part2disk-gpt.arm64	1970-01-01 00:00:00 +0000
+++ ovf/part2disk-gpt.arm64	2016-03-22 02:54:49 +0000
@@ -0,0 +1,214 @@
+#!/bin/bash
+#    part2disk-gpt.ppc64el - wrap a partition image in a partition
+#        setup suitable for use with GPT on ppc64el.
+#
+#    Copyright (C) 2010-2014 Canonical Ltd.
+#
+#    Authors: Scott Moser <smoser@xxxxxxxxxxxxx>
+#             Ben Howard <ben.howard@xxxxxxxxxxxxx>
+#             Robert Jennings <robert.jennings@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEF_CYLINDER_SIZE=16065
+DEF_SECTOR_SIZE=512
+DEBUG=0
+base_d=$(dirname $(readlink -f "${0}"))
+PATH="${PATH}:${base_d}"
+error() { echo "$@" 1>&2; }
+debug() {
+	[ "${DEBUG}" -ge "${1:-0}" ] && shift || return 0;
+	error "$@";
+}
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [options] partition-image disk-image
+
+   create disk image 'disk-image' with 'partition-image' in a partition
+   inside it.
+
+   options:
+      -c | --cylinder-size C
+                        size of cylinders for the disk in 512 byte units
+                        default is ${DEF_CYLINDER_SIZE}
+      -s | --size  S    create the disk image of size 'S'.
+                        default is large enough to fit partition-image
+      -v | --verbose    increase verbosity
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+human2bytes() {
+   # converts size suitable for input to resize2fs to bytes
+   # s:512 byte sectors, K:kilobytes, M:megabytes, G:gigabytes
+   # none: block size of the image
+   local input=${1} defunit=${2:-1024}
+   local unit count;
+   case "$input" in
+      *s) count=${input%s}; unit=512;;
+      *K) count=${input%K}; unit=1024;;
+      *M) count=${input%M}; unit=$((1024*1024));;
+      *G) count=${input%G}; unit=$((1024*1024*1024));;
+      *)  count=${input}  ; unit=${2:-1024};;
+   esac
+   _RET=$((${count}*${unit}))
+}
+
+short_opts="c:Ghs:v"
+long_opts="help,cylinder-size:,size:,verbose"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+csize=${DEF_CYLINDER_SIZE}
+ssize=${DEF_SECTOR_SIZE}
+size_in=""
+
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-c|--cylinder-size) csize=$2; shift;;
+		-h|--help) Usage; exit 0;;
+		-s|--size) size_in=$2; shift;;
+		-v|--verbose) DEBUG=$((${DEBUG}+1)); set -x;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+rootfs_dm=""
+loop_raw=""
+loop_dev=""
+clean_loops() {
+	debug 1 "Cleaning up loops"
+
+    [ -z "${rootfs_dm}" ] || {
+        find /dev/mapper -iname "${loop_dev///dev\//}*" | \
+			xargs -n1  -I DEVICE dmsetup remove DEVICE ||
+            	kpartx -d "${rootfs_dm}" ||
+                	echo "Failed to remove device mapper devices for ${copy_rootfs_loop}"
+        losetup -d "${loop_dev}";
+		unset loop_raw
+    }
+
+	[ -z "${loop_dev}" ] &&
+		losetup -d "${loop_dev}"
+
+}
+
+[ $# -eq 2 ] || bad_Usage "must supply partition image and output file"
+
+pimg=${1}
+dimg=${2}
+
+phelper=$(command -v part2disk-grubhelper.arm64) ||
+	fail "no `basename ${phelper}` in PATH"
+
+[ -f "${pimg}" -o -b "${pimg}" ] || fail "${pimg}: not a file or block device"
+
+if [ -b "${pimg}" ]; then
+	kname=$(readlink -f "${pimg}") &&
+		pimg_s=$(awk '$4 == kn { print $3 * 1024 }' \
+		             "kn=${kname##*/}" /proc/partitions) &&
+		[ -n "${pimg_s}" ] ||
+		fail "failed to read size of ${pimg} from /proc/partitions"
+else
+	pimg_s=$(stat --format "%s" "${pimg}") ||
+		fail "failed to get size of ${pimg}"
+fi
+
+if [ -n "${size_in}" ]; then
+	human2bytes "${size_in}" 1 || fail "failed to convert ${size_in} to bytes"
+	# XXX Add 94M for UEFI partition
+	size=$((${_RET}+98566144))
+	cylinders=$((${size}/(${csize}*${ssize})))
+else
+	# no size specified, get enough cylinders to fit part_img
+	# get 1 full cylinder + any remainder
+	cylinders=$((${pimg_s}/(${csize}*${ssize}) + 1))
+	[ "${pimg_s}" = "$((${csize}*${ssize}))" ] || cylinders=$((${cylinders}+1))
+	# XXX Add 94M for UEFI partition
+	size=$((${cylinders}*${ssize}*${csize}+98566144))
+fi
+
+debug 1 "using ${cylinders} cylinders of ${csize} * ${ssize} = $((${cylinders}*${ssize}*${csize})) bytes"
+
+if [ ! -b ${dimg} ]; then
+	dd if=/dev/zero of=${dimg} bs=1 count=0 seek=${size} ||
+		fail "Failed to create spare file"
+	stat ${dimg}
+fi
+
+### GPT magic:
+# Creates the GPT partition table with two partition entries
+#	 2: is the UEFI partition, where Grub will shove its bits
+#	 1: is the traditional root FS
+sgdisk ${dimg} \
+	--zap-all \
+
+sgdisk ${dimg} \
+	--new=15:0:204800 \
+	--typecode=15:ef00 \
+	--new=1: \
+	--print ||
+	fail "Failed to create GPT partitions"
+
+#
+####
+
+if [ ! -b "${dimg}" ]; then
+	# Set the trap to make sure exit doesn't hose the system
+	trap clean_loops EXIT
+
+	# Setup the loop to work with
+	loop_raw="$(kpartx -v -a ${dimg} )" ||
+		fail "Failed to add image via kpartx"
+	loop_dev="$(echo -e ${loop_raw} |  head -n1 | awk '{print($(NF-1))}')" ||
+		fail "Unable to determine loop device"
+	rootfs_dm="/dev/mapper${loop_dev///dev/}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "${rootfs_dm} is not a block device"
+
+else
+	udevadm settle
+	blockdev --rereadpt ${dimg}
+	udevadm settle
+
+	[ -b "${dimg}1" ] && rootfs_dm="${dimg}1"
+	[ -b "${dimg}p1" ] && rootfs_dm="${dimg}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "No partition to work with"
+fi
+
+# Now copy the source image
+dd if="${pimg}" of="${rootfs_dm}" &&
+	debug 1 "Copied partition to disk" ||
+	fail    "Failed to copy the partition into disk"
+
+sync
+blkid -o udev -p "${rootfs_dm}"
+clean_loops
+
+trap - EXIT
+
+if [ -n "${phelper}" ] ; then
+    debug 1 "invoking `basename ${phelper}` ${dimg}"
+    sudo "${phelper}" "${dimg}" ||
+    	fail "`basename ${phelper}` ${dimg} failed"
+fi
+
+error "wrote to ${dimg}"
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2disk-gpt.ppc64el'
--- ovf/part2disk-gpt.ppc64el	1970-01-01 00:00:00 +0000
+++ ovf/part2disk-gpt.ppc64el	2016-03-22 02:54:49 +0000
@@ -0,0 +1,211 @@
+#!/bin/bash
+#    part2disk-gpt.ppc64el - wrap a partition image in a partition
+#        setup suitable for use with GPT on ppc64el.
+#
+#    Copyright (C) 2010-2014 Canonical Ltd.
+#
+#    Authors: Scott Moser <smoser@xxxxxxxxxxxxx>
+#             Ben Howard <ben.howard@xxxxxxxxxxxxx>
+#             Robert Jennings <robert.jennings@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEF_CYLINDER_SIZE=16065
+DEF_SECTOR_SIZE=512
+DEBUG=0
+base_d=$(dirname $(readlink -f "${0}"))
+PATH="${PATH}:${base_d}"
+error() { echo "$@" 1>&2; }
+debug() {
+	[ "${DEBUG}" -ge "${1:-0}" ] && shift || return 0;
+	error "$@";
+}
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [options] partition-image disk-image
+
+   create disk image 'disk-image' with 'partition-image' in a partition
+   inside it.
+
+   options:
+      -c | --cylinder-size C
+                        size of cylinders for the disk in 512 byte units
+                        default is ${DEF_CYLINDER_SIZE}
+      -s | --size  S    create the disk image of size 'S'.
+                        default is large enough to fit partition-image
+      -v | --verbose    increase verbosity
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+human2bytes() {
+   # converts size suitable for input to resize2fs to bytes
+   # s:512 byte sectors, K:kilobytes, M:megabytes, G:gigabytes
+   # none: block size of the image
+   local input=${1} defunit=${2:-1024}
+   local unit count;
+   case "$input" in
+      *s) count=${input%s}; unit=512;;
+      *K) count=${input%K}; unit=1024;;
+      *M) count=${input%M}; unit=$((1024*1024));;
+      *G) count=${input%G}; unit=$((1024*1024*1024));;
+      *)  count=${input}  ; unit=${2:-1024};;
+   esac
+   _RET=$((${count}*${unit}))
+}
+
+short_opts="c:Ghs:v"
+long_opts="help,cylinder-size:,size:,verbose"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+csize=${DEF_CYLINDER_SIZE}
+ssize=${DEF_SECTOR_SIZE}
+size_in=""
+
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-c|--cylinder-size) csize=$2; shift;;
+		-h|--help) Usage; exit 0;;
+		-s|--size) size_in=$2; shift;;
+		-v|--verbose) DEBUG=$((${DEBUG}+1)); set -x;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+rootfs_dm=""
+loop_raw=""
+loop_dev=""
+clean_loops() {
+	debug 1 "Cleaning up loops"
+
+    [ -z "${rootfs_dm}" ] || {
+        find /dev/mapper -iname "${loop_dev///dev\//}*" | \
+			xargs -n1  -I DEVICE dmsetup remove DEVICE ||
+            	kpartx -d "${rootfs_dm}" ||
+                	echo "Failed to remove device mapper devices for ${copy_rootfs_loop}"
+        losetup -d "${loop_dev}";
+		unset loop_raw
+    }
+
+	[ -z "${loop_dev}" ] &&
+		losetup -d "${loop_dev}"
+
+}
+
+[ $# -eq 2 ] || bad_Usage "must supply partition image and output file"
+
+pimg=${1}
+dimg=${2}
+
+phelper=$(command -v part2disk-grubhelper.ppc64el) ||
+	fail "no `basename ${phelper}` in PATH"
+
+[ -f "${pimg}" -o -b "${pimg}" ] || fail "${pimg}: not a file or block device"
+
+if [ -b "${pimg}" ]; then
+	kname=$(readlink -f "${pimg}") &&
+		pimg_s=$(awk '$4 == kn { print $3 * 1024 }' \
+		             "kn=${kname##*/}" /proc/partitions) &&
+		[ -n "${pimg_s}" ] ||
+		fail "failed to read size of ${pimg} from /proc/partitions"
+else
+	pimg_s=$(stat --format "%s" "${pimg}") ||
+		fail "failed to get size of ${pimg}"
+fi
+
+if [ -n "${size_in}" ]; then
+	human2bytes "${size_in}" 1 || fail "failed to convert ${size_in} to bytes"
+	# XXX Add 8M for PReP partition
+	size=$((${_RET}+8388608))
+	cylinders=$((${size}/(${csize}*${ssize})))
+else
+	# no size specified, get enough cylinders to fit part_img
+	# get 1 full cylinder + any remainder
+	cylinders=$((${pimg_s}/(${csize}*${ssize}) + 1))
+	[ "${pimg_s}" = "$((${csize}*${ssize}))" ] || cylinders=$((${cylinders}+1))
+	# XXX Add 8M for PReP partition
+	size=$((${cylinders}*${ssize}*${csize}+8388608))
+fi
+
+debug 1 "using ${cylinders} cylinders of ${csize} * ${ssize} = $((${cylinders}*${ssize}*${csize})) bytes"
+
+if [ ! -b ${dimg} ]; then
+	dd if=/dev/zero of=${dimg} bs=1 count=0 seek=${size} ||
+		fail "Failed to create spare file"
+	stat ${dimg}
+fi
+
+### GPT magic:
+# Creates the GPT partition table with two partition entries
+#	 2: is the PReP partition, where Grub will shove its bits
+#	 1: is the traditional root FS
+sgdisk ${dimg} \
+	--new=2::+8M \
+	--new=1: ||
+	fail "Failed to create GPT partitions"
+
+sgdisk ${dimg} -t 2:4100 ||
+	fail "Failed to type partitions properly"
+
+parted ${dimg} --script -- print
+
+#
+###3
+
+if [ ! -b "${dimg}" ]; then
+	# Set the trap to make sure exit doesn't hose the system
+	trap clean_loops EXIT
+
+	# Setup the loop to work with
+	loop_raw="$(kpartx -v -a ${dimg} )" ||
+		fail "Failed to add image via kpartx"
+	loop_dev="$(echo -e ${loop_raw} |  head -n1 | awk '{print($(NF-1))}')" ||
+		fail "Unable to determine loop device"
+	rootfs_dm="/dev/mapper${loop_dev///dev/}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "${rootfs_dm} is not a block device"
+
+else
+	udevadm settle
+	blockdev --rereadpt ${dimg}
+	udevadm settle
+
+	[ -b "${dimg}1" ] && rootfs_dm="${dimg}1"
+	[ -b "${dimg}p1" ] && rootfs_dm="${dimg}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "No partition to work with"
+fi
+
+# Now copy the source image
+dd if="${pimg}" of="${rootfs_dm}" &&
+	debug 1 "Copied partition to disk" ||
+	fail    "Failed to copy the partition into disk"
+
+clean_loops
+trap - EXIT
+
+if [ -n "${phelper}" ] ; then
+    debug 1 "invoking `basename ${phelper}` ${dimg}"
+    sudo "${phelper}" "${dimg}" ||
+    	fail "`basename ${phelper}` ${dimg} failed"
+fi
+
+error "wrote to ${dimg}"
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2disk-grubhelper'
--- ovf/part2disk-grubhelper	1970-01-01 00:00:00 +0000
+++ ovf/part2disk-grubhelper	2016-03-22 02:54:49 +0000
@@ -0,0 +1,152 @@
+#!/bin/sh
+#    part2disk-grubhelper - helper for part2disk for installing grub on mbr
+#
+#    Copyright (C) 2010 Canonical Ltd.
+#
+#    Authors: Scott Moser <smoser@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEBUG=0
+LO_DEV=""
+KPARTX_DEV=""
+UMOUNTS=""
+TEMP_D=""
+
+error() { echo "$@" 1>&2; }
+debug() {
+	[ "${DEBUG}" -ge "${1:-0}" ] && shift || return 0;
+	error "$@";
+}
+cleanup() {
+	if [ -n "${UMOUNTS}" ]; then
+		for d in ${UMOUNTS}; do
+			umount "${d}"
+		done
+	fi
+
+	[ -z "${part_dev}" ] || { zerofree ${part_dev}; sync; }
+	[ -z "${KPARTX_DEV}" ] || kpartx -d "${KPARTX_DEV}"
+	[ -z "${LO_DEV}" ] || losetup -d "${LO_DEV}"
+	[ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [options] disk-image
+
+   install grub in the mbr of 'disk-image'.
+   number of the root partition
+
+   options:
+      -r | --root       the partition number for the root partition in image
+                        default to '1'
+      -v | --verbose    increase verbosity
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+short_opts="hr:v"
+long_opts="help,root:,verbose"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+root_ptnum=1
+img=""
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-r|--root) root_ptnum=${2}; shift;;
+		-h|--help) Usage; exit 0;;
+		-v|--verbose) DEBUG=$((${DEBUG}+1));;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+[ $# -eq 1 ] || bad_Usage "must supply disk image"
+
+img=${1}
+
+[ "$(id -u)" = "0" ] || fail "sorry, must be root"
+
+imgf=$(readlink -f "${img}") || fail "failed to get full path to ${img}"
+
+TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX") ||
+	fail "failed to make tempd"
+trap cleanup EXIT
+
+# losetup ${dimg}
+LO_DEV=$(losetup --find --show "${imgf}") || fail "failed to losetup ${imgf}"
+kpartx -a "${LO_DEV}" && KPARTX_DEV="${LO_DEV}" ||
+	fail "failed: kpartx -a ${LO_DEV}"
+
+bn_lodev="${LO_DEV##*/}"
+part_dev="/dev/mapper/${bn_lodev}p${root_ptnum}"
+
+mp="${TEMP_D}/mnt"
+mkdir "${mp}" || fail "failed to make ${mp}"
+UMOUNTS=""
+
+# mount root partition partition
+mount -o ro "${part_dev}" "${mp}" &&
+	UMOUNTS="${mp} ${UMOUNTS}" || fail "failed to mount ${part_dev}"
+
+# mount tmpfs over its /tmp
+mount -t tmpfs none "${mp}/tmp" &&
+	UMOUNTS="${mp}/tmp ${UMOUNTS}" || fail "failed to mount tmpfs"
+
+# copy device (/dev/loopX) to chroot/tmp/loopX
+cp -a "${LO_DEV}" "${mp}/tmp/" ||
+	fail "failed to copy ${bn_lodev} to ${mp}/tmp"
+
+# write devices.map with (hd0) /tmp/loop0
+echo "(hd0) /tmp/${bn_lodev##*/}" > "${mp}/tmp/device.map"
+
+grub_setup="grub-setup"
+grub_opts="--skip-fs-probe --device-map=/tmp/device.map"
+
+if [ -e "${mp}/usr/sbin/grub-bios-setup" ]; then
+		# Grub 2.00 introduced on 12.10 is a bit more picky about the environment
+		# So we need to set things up a bit more
+
+        grub_setup="grub-bios-setup"
+        grub_opts="--boot-image=i386-pc/boot.img --core-image=i386-pc/core.img ${grub_opts}"
+
+        mount -o remount,rw "${mp}" ||
+                fail "failed to remount ${mp} read-write"
+
+        mount --bind /dev "${mp}/dev" &&
+                UMOUNTS="${mp}/dev ${UMOUNTS}" ||
+                fail "failed to mount dev under ${mp}"
+
+        mount proc-live -t proc "${mp}/proc" &&
+                UMOUNTS="${mp}/proc ${UMOUNTS}" ||
+                fail "failed to mount proc under ${mp}"
+
+		# Needed for Trusty
+		chroot "${mp}" grub-install /dev/${bn_lodev}
+        grub_opts="${grub_opts} /dev/${bn_lodev}"
+
+else
+		# Options for 12.04 and earlier
+        grub_opts="--root-device=(hd0,${root_ptnum}) ${grub_opts} /tmp/${bn_lodev##*/}"
+fi
+
+chroot "${mp}" ${grub_setup} ${grub_opts}
+
+exit
+
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2disk-grubhelper.arm64'
--- ovf/part2disk-grubhelper.arm64	1970-01-01 00:00:00 +0000
+++ ovf/part2disk-grubhelper.arm64	2016-03-22 02:54:49 +0000
@@ -0,0 +1,348 @@
+#!/bin/bash -x
+#    part2disk-grubhelper.arm64 - helper for part2disk*.arm64 for
+#		configuring a disk image for PReP boot with grub2
+#
+#    Copyright (C) 2010-2014 Canonical Ltd.
+#
+#    Authors: Ben Howard <ben.howard@xxxxxxxxxxxxx>
+#             Robert Jennings <robert.jennings@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEBUG=0
+LO_DEV=""
+KPARTX_DEV=""
+UMOUNTS=""
+TEMP_D=""
+
+my_dir=$(dirname $(readlink -f "${0}"))
+parent_dir=$(dirname ${my_dir})
+. ${parent_dir}/functions/common
+
+error() { echo "$@" 1>&2; }
+debug() {
+	error "$@";
+}
+
+mp=""
+part_dev=""
+error_set=0
+cleanup() {
+	if [ -z "${mp}" ]; then
+		if [ -f "${mp}/usr/sbin/policy-rc.d" ]; then
+			rm "${mp}/usr/sbin/policy-rc.d";
+		fi
+	fi
+
+	if [ -n "${UMOUNTS}" ]; then
+		for d in ${UMOUNTS}; do
+			umount "${d}"
+		done
+	fi
+
+	[ -z "${part_dev}" ] || { zerofree ${part_dev}; sync; }
+	[ -z "${KPARTX_DEV}" ] || kpartx -d "${KPARTX_DEV}"
+	[ -z "${LO_DEV}" ] || losetup -d "${LO_DEV}"
+	[ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+
+}
+fail() { [ $# -eq 0 ] || error "$@"; error_set=1; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [options] disk-image
+
+   install grub in the mbr of 'disk-image'.
+   number of the root partition
+
+   options:
+      -r | --root     the partition number for the root partition in image
+                      default to '1'
+      -p | --efi     the partition number for the PReP boot partition in image
+                      default to '2'
+      -v | --verbose  increase verbosity
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+short_opts="hr:p:v"
+long_opts="help,root:,efi:,verbose"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+root_ptnum=1
+uefi_ptnum=15
+img=""
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-r|--root) root_ptnum=${2}; shift;;
+		-p|--efi) uefi_ptnum=${2}; shift;;
+		-h|--help) Usage; exit 0;;
+		-v|--verbose) DEBUG=$((${DEBUG}+1)); set -x;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+[ $# -eq 1 ] || bad_Usage "must supply disk image"
+
+img=${1}
+
+[ "$(id -u)" -eq 0 ] || fail "sorry, must be root"
+
+imgf=$(readlink -f "${img}") || fail "failed to get full path to ${img}"
+
+TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX") ||
+	fail "failed to make tempd"
+trap cleanup EXIT
+
+# losetup ${dimg}
+LO_DEV=$(losetup --find --show "${imgf}") || fail "failed to losetup ${imgf}"
+kpartx -g -a "${LO_DEV}" && KPARTX_DEV="${LO_DEV}" ||
+	fail "failed: kpartx -a ${LO_DEV}"
+
+bn_lodev="${LO_DEV##*/}"
+part_dev="/dev/mapper/${bn_lodev}p${root_ptnum}"
+uefi_dev="/dev/mapper/${bn_lodev}p${uefi_ptnum}"
+
+[ -b "${part_dev}" ] || fail "root partition does not exist!"
+[ -b "${uefi_dev}" ] || fail "uefi partition does not exist!"
+
+mp="${TEMP_D}/mnt"
+mkdir "${mp}" || fail "failed to make ${mp}"
+UMOUNTS=""
+
+xchroot() {
+	my_name=$(readlink -f ${0})
+	my_dir=$(dirname ${my_name})
+	parent_dir=$(dirname ${my_dir})
+
+	_chroot="chroot"
+	chroot_hlp="${parent_dir}/chroot_helper"
+	[ -e "${chroot_hlp}" ] && _chroot="${chroot_hlp}"
+
+	debug "Running chroot: ${@}"
+	( DEBIAN_FRONTEND=noninteractive LANG=C LC_ALL=C ${_chroot} "${mp}" ${@} ) &&
+		debug "   Command Successfull" ||
+		{ debug "   Command FAILED!"; fail "chrooted-command failed!"; }
+}
+
+# mount root partition partition
+blkid -o udev -p "${part_dev}"
+mount -t ext4 "${part_dev}" "${mp}" &&
+	UMOUNTS="${mp} ${UMOUNTS}" || fail "failed to mount ${part_dev}"
+
+# make /tmp, tmp
+mount -t tmpfs none "${mp}/tmp" &&
+	UMOUNTS="${mp}/tmp ${UMOUNTS}" || fail "failed to mount /tmp"
+
+# Get info about the root fs
+blkid -p -o export "${part_dev}" > "${mp}/tmp/root_info"
+source "${mp}/tmp/root_info" || fail "unable to read ${mp}/tmp/root_info"
+
+# create and mount UEFI partition
+mkfs.vfat -F 32 -n UEFI ${uefi_dev} ||
+    fail "failed to create UEFI vfat"
+
+mkdir -p "${mp}/boot/efi" ||
+	fail "failed to create UEFI mount point";
+
+mount "${uefi_dev}" "${mp}/boot/efi" &&
+	UMOUNTS="${mp}/boot/efi ${UMOUNTS}" ||
+		fail "failed to mount UEFI vfat"
+
+# create resolvconf
+mount -t tmpfs none "${mp}/run" &&
+	UMOUNTS="${mp}/run ${UMOUNTS}" ||
+		fail "failed to mount run tmpfs"
+
+mkdir -p "${mp}/run/resolvconf" ||
+	fail "Unable to create ${mp}/run/resolvconf"
+
+cp $(readlink -f /etc/resolv.conf) "${mp}/run/resolvconf/resolv.conf" ||
+	fail "failed to put in temporary resolvconf"
+
+# mount tmpfs over its /tmp
+mount -t tmpfs none "${mp}/tmp" &&
+	UMOUNTS="${mp}/tmp ${UMOUNTS}" ||
+		fail "failed to mount tmpfs"
+
+# mount up /dev
+mount --bind /dev "${mp}/dev" &&
+	UMOUNTS="${mp}/dev ${UMOUNTS}" ||
+		fail "failed to mount dev under ${mp}"
+
+# mount proc
+mount proc-live -t proc "${mp}/proc" &&
+	UMOUNTS="${mp}/proc ${UMOUNTS}" ||
+		fail "failed to mount proc under ${mp}"
+
+# mount sys
+mount sysfs-live -t sysfs "${mp}/sys" &&
+	UMOUNTS="${mp}/sys ${UMOUNTS}" ||
+		fail "failed to mount sysfs"
+
+# place the mtab in place
+cp /etc/mtab "${mp}/etc/mtab" ||
+	fail "failed to copy mtab into image"
+
+# set the rc policy
+cat > "${mp}/usr/sbin/policy-rc.d" << EOF
+#!/bin/sh
+echo "All runlevel operations denied by policy" >&2
+exit 101
+EOF
+
+chmod 0755 "${mp}/usr/sbin/policy-rc.d" ||
+	fail "failed to set executable policy-rc.d"
+
+[ -x "${mp}/usr/sbin/policy-rc.d" ] ||
+	fail "policy-rc.d does not exist in image"
+
+
+# copy device (/dev/loopX) to chroot/tmp/loopX
+cp -a "${LO_DEV}" "${mp}/tmp/" ||
+	fail "failed to copy ${bn_lodev} to ${mp}/tmp"
+
+# Install the bits
+xchroot apt-get -y clean
+xchroot apt-get -y update -o Acquire::Languages=“none”
+xchroot apt-get -y install --no-install-recommends grub-efi-arm64 grub-efi-arm64-bin
+xchroot apt-get -y remove --purge grub-legacy-ec2
+xchroot apt-get -y clean
+
+# set the kernel commandline to use ttyAMA0
+mkdir -p ${mp}/etc/default/grub.d
+cat << EOF > ${mp}/etc/default/grub.d/50-cloudimg-settings.cfg
+${CLOUD_IMG_STR}
+#
+# Set the default commandline
+GRUB_CMDLINE_LINUX_DEFAULT="earlyprintk"
+EOF
+
+# Make grub-probe work
+xchroot dpkg-divert --local --rename /usr/sbin/grub-probe
+cat << EOF > ${mp}/usr/sbin/grub-probe
+#!/bin/bash
+
+arg_is_device=0
+target=""
+
+for opt in \$@
+do
+    case "\${opt}" in
+    --device)
+        # Means the thing in $arg is a device
+        arg_is_device=1
+        ;;
+    --target=*)
+        # = device, = fs, = fs_uuid
+        target=\${opt#*=}
+        ;;
+    *)
+        arg=\$opt
+        ;;
+    esac
+done
+
+set >> /tmp/probe.env
+
+case "\$target" in
+	abstraction)
+		echo
+		;;
+	device)
+		echo "${part_dev}"
+		;;
+	drive)
+		echo "(hd0,gpt1)}"
+		;;
+	fs)
+		# Returns the filesystem type
+		echo "ext2"
+		;;
+	fs_uuid)
+		echo "${UUID}"
+		;;
+esac
+EOF
+xchroot chmod 0755 /usr/sbin/grub-probe
+
+xchroot mkdir -p /boot/efi/grub ||
+	fail "failed to create ${mp}/boot/efi/grub"
+
+# This is normally done by grub-install. Since we have to do this by
+# hand -- and we have no way to test it yet -- we'll just see if this
+# works.
+cat << EOF > ${mp}/boot/efi/grub/grub.cfg
+search.fs_uuid ${UUID} root hd0,gpt1
+set prefix=(\$root)'/boot/grub'
+EOF
+
+mkdir -p "${mp}/boot/efi/EFI/boot" ||
+	fail "failed to create ${mp}/boot/efi/EFI/boot"
+
+xchroot cp /boot/efi/grub/grub.cfg /boot/efi/EFI/grub.cfg
+xchroot cat /boot/efi/grub/grub.cfg
+
+# Statically configure the grub modules for this image
+cat << EOF >> ${mp}/etc/default/grub.d/50-cloudimg-settings.cfg
+
+${CLOUD_IMG_STR}
+# For Cloud Image compatability
+GRUB_PRELOAD_MODULES="part_gpt fat gzio ext2 normal chain boot configfile linux search_fs_uuid search_label terminal serial video video_fb efi_gop"
+EOF
+
+xchroot find /usr/lib/grub
+xchroot cp -avu /usr/lib/grub/arm64-efi /boot/grub
+xchroot mkdir /boot/grub/fonts
+xchroot cp /usr/share/grub/unicode.pf2 /boot/grub/fonts
+
+# We have to do this by hand, since grub-install fails miserably
+# in qemu-aarch64-static.
+xchroot grub-mkimage \
+	--verbose \
+	--config=/boot/efi/grub/grub.cfg \
+	--output=/boot/efi/EFI/BOOT/BOOTaa64.EFI \
+	--format=arm64-efi \
+	--prefix=/boot/efi/EFI \
+	part_gpt fat gzio ext2 normal chain boot configfile linux search_fs_uuid search_label terminal serial video video_fb efi_gop
+
+# For some reason the grub disk is looking for /boot/grub/grub.cfg on
+# part 15....
+xchroot cat /boot/efi/grub/grub.cfg
+
+# update the grub configuration
+xchroot dpkg-divert --local --rename /etc/grub.d/30_os-prober
+xchroot update-grub
+sed -i "s,root=.* ,root=LABEL=cloudimg-rootfs ,g"\
+   		${mp}/boot/grub/grub.cfg ||
+		fail "failed to update grub root label"
+
+# Remove our fake stuff
+xchroot dpkg-divert --remove --local --rename /etc/grub.d/30_os-prober
+xchroot rm /usr/sbin/grub-probe
+xchroot dpkg-divert --remove --local --rename /usr/sbin/grub-probe
+
+# Some clean-up...
+xchroot apt-get -y clean
+xchroot apt-get -y update -o Acquire::Languages=“none”
+xchroot rm /etc/mtab
+xchroot rm /usr/sbin/policy-rc.d
+exit
+
+# And now we have a bootable arm64 image...
+
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2disk-grubhelper.ppc64el'
--- ovf/part2disk-grubhelper.ppc64el	1970-01-01 00:00:00 +0000
+++ ovf/part2disk-grubhelper.ppc64el	2016-03-22 02:54:49 +0000
@@ -0,0 +1,226 @@
+#!/bin/bash
+#    part2disk-grubhelper.ppc64el - helper for part2disk*.ppc64el for
+#		configuring a disk image for PReP boot with grub2
+#
+#    Copyright (C) 2010-2014 Canonical Ltd.
+#
+#    Authors: Ben Howard <ben.howard@xxxxxxxxxxxxx>
+#             Robert Jennings <robert.jennings@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEBUG=0
+LO_DEV=""
+KPARTX_DEV=""
+UMOUNTS=""
+TEMP_D=""
+
+my_dir=$(dirname $(readlink -f "${0}"))
+parent_dir=$(dirname ${my_dir})
+. ${parent_dir}/functions/common
+
+error() { echo "$@" 1>&2; }
+debug() {
+	error "$@";
+}
+
+mp=""
+part_dev=""
+error_set=0
+cleanup() {
+	if [ -z "${mp}" ]; then
+		if [ -f "${mp}/usr/sbin/policy-rc.d" ]; then
+			rm "${mp}/usr/sbin/policy-rc.d";
+		fi
+	fi
+
+	if [ -n "${UMOUNTS}" ]; then
+		for d in ${UMOUNTS}; do
+			umount "${d}"
+		done
+	fi
+
+	[ -z "${part_dev}" ] || { zerofree ${part_dev}; sync; }
+	[ -z "${KPARTX_DEV}" ] || kpartx -d "${KPARTX_DEV}"
+	[ -z "${LO_DEV}" ] || losetup -d "${LO_DEV}"
+	[ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+
+}
+fail() { [ $# -eq 0 ] || error "$@"; error_set=1; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [options] disk-image
+
+   install grub in the mbr of 'disk-image'.
+   number of the root partition
+
+   options:
+      -r | --root     the partition number for the root partition in image
+                      default to '1'
+      -p | --prep     the partition number for the PReP boot partition in image
+                      default to '2'
+      -v | --verbose  increase verbosity
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+short_opts="hr:p:v"
+long_opts="help,root:,prep:,verbose"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+root_ptnum=1
+prep_ptnum=2
+img=""
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-r|--root) root_ptnum=${2}; shift;;
+		-p|--prep) prep_ptnum=${2}; shift;;
+		-h|--help) Usage; exit 0;;
+		-v|--verbose) DEBUG=$((${DEBUG}+1)); set -x;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+[ $# -eq 1 ] || bad_Usage "must supply disk image"
+
+img=${1}
+
+[ "$(id -u)" = "0" ] || fail "sorry, must be root"
+
+imgf=$(readlink -f "${img}") || fail "failed to get full path to ${img}"
+
+TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX") ||
+	fail "failed to make tempd"
+trap cleanup EXIT
+
+# losetup ${dimg}
+LO_DEV=$(losetup --find --show "${imgf}") || fail "failed to losetup ${imgf}"
+kpartx -a "${LO_DEV}" && KPARTX_DEV="${LO_DEV}" ||
+	fail "failed: kpartx -a ${LO_DEV}"
+
+bn_lodev="${LO_DEV##*/}"
+part_dev="/dev/mapper/${bn_lodev}p${root_ptnum}"
+
+mp="${TEMP_D}/mnt"
+mkdir "${mp}" || fail "failed to make ${mp}"
+UMOUNTS=""
+
+xchroot() {
+	_chroot="chroot"
+
+	debug "Running chroot: ${@}"
+	( DEBIAN_FRONTEND=noninteractive LANG=C LC_ALL=C ${_chroot} "${mp}" "${@}" ) &&
+		debug "   Command Successfull" ||
+		{ debug "   Command FAILED!"; fail "chrooted-command failed!"; }
+}
+
+
+# mount root partition partition
+mount "${part_dev}" "${mp}" &&
+	UMOUNTS="${mp} ${UMOUNTS}" || fail "failed to mount ${part_dev}"
+
+# create resolvconf
+mount -t tmpfs none "${mp}/run" &&
+	UMOUNTS="${mp}/run ${UMOUNTS}" ||
+		fail "failed to mount run tmpfs"
+
+mkdir -p "${mp}/run/resolvconf" ||
+	fail "Unable to create ${mp}/run/resolvconf"
+
+cp /run/resolvconf/resolv.conf "${mp}/run/resolvconf/resolv.conf" ||
+	fail "failed to put in temporary resolvconf"
+
+# mount tmpfs over its /tmp
+mount -t tmpfs none "${mp}/tmp" &&
+	UMOUNTS="${mp}/tmp ${UMOUNTS}" ||
+		fail "failed to mount tmpfs"
+
+# mount up /dev
+mount --bind /dev "${mp}/dev" &&
+	UMOUNTS="${mp}/dev ${UMOUNTS}" ||
+		fail "failed to mount dev under ${mp}"
+
+# mount proc
+mount proc-live -t proc "${mp}/proc" &&
+	UMOUNTS="${mp}/proc ${UMOUNTS}" ||
+		fail "failed to mount proc under ${mp}"
+
+# mount sys
+mount sysfs-live -t sysfs "${mp}/sys" &&
+	UMOUNTS="${mp}/sys ${UMOUNTS}" ||
+		fail "failed to mount sysfs"
+
+# place the mtab in place
+cp /etc/mtab "${mp}/etc/mtab" ||
+	fail "failed to copy mtab into image"
+
+# set the rc policy
+cat > "${mp}/usr/sbin/policy-rc.d" << EOF
+#!/bin/sh
+echo "All runlevel operations denied by policy" >&2
+exit 101
+EOF
+
+chmod 0755 "${mp}/usr/sbin/policy-rc.d" ||
+	fail "failed to set executable policy-rc.d"
+
+[ -x "${mp}/usr/sbin/policy-rc.d" ] ||
+	fail "policy-rc.d does not exist in image"
+
+
+# copy device (/dev/loopX) to chroot/tmp/loopX
+cp -a "${LO_DEV}" "${mp}/tmp/" ||
+	fail "failed to copy ${bn_lodev} to ${mp}/tmp"
+
+# Install the bits
+xchroot apt-get -y clean
+xchroot apt-get -y update
+xchroot apt-get -y install grub2
+xchroot apt-get -y remove --purge grub-legacy-ec2
+
+# set the kernel commandline to use hvc0
+mkdir -p ${mp}/etc/default/grub.d
+cat << EOF > ${mp}/etc/default/grub.d/50-cloudimg-settings.cfg
+${CLOUD_IMG_STR}
+#
+# Set the default commandline
+GRUB_CMDLINE_LINUX_DEFAULT="console=hvc0 earlyprintk"
+EOF
+
+
+# install grug to PReP partition
+xchroot grub-install /dev/mapper/${bn_lodev}p${prep_ptnum} \
+	--no-nvram \
+	--boot-directory=/boot \
+	--target=powerpc-ieee1275
+
+# update the grub configuration
+xchroot dpkg-divert --local --rename /etc/grub.d/30_os-prober
+xchroot update-grub
+xchroot dpkg-divert --remove --local --rename /etc/grub.d/30_os-prober
+
+# Some clean-up...
+xchroot apt-get -y clean
+xchroot apt-get -y update
+xchroot rm /etc/mtab
+xchroot rm /usr/sbin/policy-rc.d
+exit
+
+# And now we have a bootable ppc64el image...
+
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2disk-grubhelper.uefi'
--- ovf/part2disk-grubhelper.uefi	1970-01-01 00:00:00 +0000
+++ ovf/part2disk-grubhelper.uefi	2016-03-22 02:54:49 +0000
@@ -0,0 +1,287 @@
+#!/bin/bash
+#    part2disk-grubhelper-uefi - helper for part2disk-got for configuring a
+#		disk image for both BIOS/GPT and UEFI boot.
+#
+#    Copyright (C) 2010-2013 Canonical Ltd.
+#
+#    Authors: Ben Howard <ben.howard@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEBUG=0
+LO_DEV=""
+KPARTX_DEV=""
+UMOUNTS=""
+TEMP_D=""
+
+my_dir=$(dirname $(readlink -f "${0}"))
+parent_dir=$(dirname ${my_dir})
+. ${parent_dir}/functions/common
+
+error() { echo "$@" 1>&2; }
+debug() {
+	error "$@";
+}
+
+mp=""
+part_dev=""
+error_set=0
+cleanup() {
+	if [ -z "${mp}" ]; then
+		if [ -f "${mp}/usr/sbin/policy-rc.d" ]; then
+			rm "${mp}/usr/sbin/policy-rc.d";
+		fi
+	fi
+
+	if [ -n "${UMOUNTS}" ]; then
+		for d in ${UMOUNTS}; do
+			umount "${d}"
+		done
+	fi
+
+	[ -z "${part_dev}" ] || { zerofree ${part_dev}; sync; }
+	[ -z "${KPARTX_DEV}" ] || kpartx -d "${KPARTX_DEV}"
+	[ -z "${LO_DEV}" ] || losetup -d "${LO_DEV}"
+	[ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+
+}
+fail() { [ $# -eq 0 ] || error "$@"; error_set=1; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [options] disk-image
+
+   install grub in the mbr of 'disk-image'.
+   number of the root partition
+
+   options:
+      -r | --root       the partition number for the root partition in image
+                        default to '1'
+      -u | --uefi       the partition number for the uefi partition in image
+						defaults to '15'
+      -v | --verbose    increase verbosity
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+short_opts="hr:u:v"
+long_opts="help,root:,uefi:,verbose"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+root_ptnum=1
+uefi_ptnum=15
+img=""
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-r|--root) root_ptnum=${2}; shift;;
+		-u|--uefi) uefi_ptnum=${2}; shift;;
+		-h|--help) Usage; exit 0;;
+		-v|--verbose) DEBUG=$((${DEBUG}+1));;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+[ $# -eq 1 ] || bad_Usage "must supply disk image"
+
+img=${1}
+
+[ "$(id -u)" = "0" ] || fail "sorry, must be root"
+
+imgf=$(readlink -f "${img}") || fail "failed to get full path to ${img}"
+
+TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${0##*/}.XXXXXX") ||
+	fail "failed to make tempd"
+trap cleanup EXIT
+
+# losetup ${dimg}
+LO_DEV=$(losetup --find --show "${imgf}") || fail "failed to losetup ${imgf}"
+kpartx -a "${LO_DEV}" && KPARTX_DEV="${LO_DEV}" ||
+	fail "failed: kpartx -a ${LO_DEV}"
+
+bn_lodev="${LO_DEV##*/}"
+part_dev="/dev/mapper/${bn_lodev}p${root_ptnum}"
+uefi_dev="/dev/mapper/${bn_lodev}p${uefi_ptnum}"
+
+echo "uefi_dev is ${uefi_dev}"
+
+mp="${TEMP_D}/mnt"
+mkdir "${mp}" || fail "failed to make ${mp}"
+UMOUNTS=""
+
+xchroot() {
+	_chroot="chroot"
+	bitness=${bitness:-$(chroot "${mp}" getconf LONG_BIT)}
+
+	# Proot does not work, so don't use it
+    [ -e "/usr/sbin/chroot.distrib" ] && \
+         _chroot="/usr/sbin/chroot.distrib"
+
+    debug "Running chroot: ${@}"
+    ( DEBIAN_FRONTEND=noninteractive LANG=C LC_ALL=C ${_chroot} "${mp}" "${@}" ) &&
+        debug "   Command Successfull" ||
+		{ debug "   Command FAILED!"; fail "chrooted-command failed!"; }
+}
+
+
+# mount root partition partition
+mount "${part_dev}" "${mp}" &&
+	UMOUNTS="${mp} ${UMOUNTS}" || fail "failed to mount ${part_dev}"
+
+# create and mount UEFI partition
+mkfs.vfat -F 32 -n UEFI ${uefi_dev} ||
+    fail "failed to create UEFI vfat"
+
+mkdir "${mp}/boot/efi" ||
+    fail "failed to create UEFI mount point"
+
+mount "${uefi_dev}" "${mp}/boot/efi" &&
+	UMOUNTS="${mp}/boot/efi ${UMOUNTS}" ||
+		fail "failed to mount UEFI vfat"
+
+mkdir -p "${mp}/boot/efi/EFI/BOOT" ||
+	fail "failed to make Ubuntu EFI"
+
+{
+cat << EOF >> "${mp}/etc/fstab"
+LABEL=UEFI	/boot/efi	vfat	defaults	0 0
+EOF
+} || fail "failed to write to new fstab"
+cat "${mp}/etc/fstab"
+
+# create resolvconf
+mount -t tmpfs none "${mp}/run" &&
+	UMOUNTS="${mp}/run ${UMOUNTS}" ||
+		fail "failed to mount run tmpfs"
+
+mkdir -p "${mp}/run/resolvconf" ||
+	fail "Unable to create ${mp}/run/resolvconf"
+
+cp /run/resolvconf/resolv.conf "${mp}/run/resolvconf/resolv.conf" ||
+	fail "failed to put in temporary resolvconf"
+
+# mount tmpfs over its /tmp
+mount -t tmpfs none "${mp}/tmp" &&
+	UMOUNTS="${mp}/tmp ${UMOUNTS}" ||
+		fail "failed to mount tmpfs"
+
+# mount up /dev
+mount --bind /dev "${mp}/dev" &&
+	UMOUNTS="${mp}/dev ${UMOUNTS}" ||
+		fail "failed to mount dev under ${mp}"
+
+# mount proc
+mount proc-live -t proc "${mp}/proc" &&
+	UMOUNTS="${mp}/proc ${UMOUNTS}" ||
+		fail "failed to mount proc under ${mp}"
+
+# mount sys
+mount sysfs-live -t sysfs "${mp}/sys" &&
+	UMOUNTS="${mp}/sys ${UMOUNTS}" ||
+		fail "failed to mount sysfs"
+
+# place the mtab in place
+cp /etc/mtab "${mp}/etc/mtab" ||
+	fail "failed to copy mtab into image"
+
+# set the rc policy
+cat > "${mp}/usr/sbin/policy-rc.d" << EOF
+#!/bin/sh
+echo "All runlevel operations denied by policy" >&2
+exit 101
+EOF
+
+chmod 0755 "${mp}/usr/sbin/policy-rc.d" ||
+	fail "failed to set executable policy-rc.d"
+
+[ -x "${mp}/usr/sbin/policy-rc.d" ] ||
+	fail "policy-rc.d does not exist in image"
+
+
+# copy device (/dev/loopX) to chroot/tmp/loopX
+cp -a "${LO_DEV}" "${mp}/tmp/" ||
+	fail "failed to copy ${bn_lodev} to ${mp}/tmp"
+
+# Install the bits
+xchroot apt-get -y clean
+xchroot apt-get -y update
+xchroot apt-get -y install grub-efi-amd64-signed grub-efi-amd64 shim-signed
+xchroot apt-get -y clean
+xchroot apt-get -y update
+
+# Install the UEFI bits
+xchroot cp /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed \
+		/boot/efi/EFI/BOOT/grubx64.efi
+
+BOOT_D="/boot/efi/EFI/BOOT"
+
+# Make sure these modules are always pre-loaded
+cat << EOF >> ${mp}/etc/default/grub.d/50-cloudimg-settings.cfg
+
+${CLOUD_IMG_STR}
+
+# For dual UEFI/GPT compatability
+GRUB_PRELOAD_MODULES="part_gpt fat ext2 normal chain boot configfile linux multiboot search_fs_uuid search_label terminal serial video video_fb video_bochs usb usb_keyboard efi_gop efi_uga"
+
+EOF
+
+
+xchroot cp /usr/lib/shim/shim.efi.signed ${BOOT_D}/shimx64.efi
+xchroot cp /usr/lib/shim/MokManager.efi.signed ${BOOT_D}/MokManager.efi
+xchroot cp /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed ${BOOT_D}/grubx64.efi
+
+xchroot grub-install /dev/${bn_lodev} \
+	--boot-directory=/boot \
+	--efi-directory=/boot/efi \
+	--target=x86_64-efi \
+	--removable \
+	--uefi-secure-boot \
+	--no-nvram \
+	--modules="part_gpt fat ext2 normal chain boot configfile linux multiboot search_fs_uuid search_label terminal serial video video_fb video_bochs usb usb_keyboard efi_gop efi_uga"
+
+sed -i "s| root| root hd0,gpt1|" ${mp}/boot/efi/EFI/BOOT/grub.cfg ||
+	fail "failed update hd0"
+
+sed -i "1i${CLOUD_IMG_STR}" ${mp}/boot/efi/EFI/BOOT/grub.cfg ||
+	fail "failed to insert cloud image comment"
+
+# For some reason the grub disk is looking for /boot/grub/grub.cfg on
+# part 15....
+xchroot mkdir -p /boot/efi/boot/grub
+xchroot cp /boot/efi/EFI/BOOT/grub.cfg /boot/efi/boot/grub
+
+# Install the BIOS/GPT bits. Since GPT boots from the ESP partition,
+# it means that we just run this simple command and we're done
+xchroot grub-install --target=i386-pc /dev/${bn_lodev}
+
+# update the grub configuration
+xchroot dpkg-divert --local --rename /etc/grub.d/30_os-prober
+xchroot update-grub
+sed -i "s,root=.* ,root=LABEL=cloudimg-rootfs ,g"\
+   		${mp}/boot/grub/grub.cfg ||
+		fail "failed to update grub root label"
+xchroot dpkg-divert --remove --local --rename /etc/grub.d/30_os-prober
+xchroot apt-get -y clean
+xchroot apt-get -y update
+
+# Some clean-up...
+xchroot rm /etc/mtab
+xchroot rm /usr/sbin/policy-rc.d
+exit
+
+# And now we have a dual boot image...
+
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2disk.ppc64el'
--- ovf/part2disk.ppc64el	1970-01-01 00:00:00 +0000
+++ ovf/part2disk.ppc64el	2016-03-22 02:54:49 +0000
@@ -0,0 +1,238 @@
+#!/bin/bash
+#    part2disk - wrap a partition image in a disk image
+#
+#    Copyright (C) 2010 Canonical Ltd.
+#
+#    Authors: Scott Moser <smoser@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+DEF_CYLINDER_SIZE=16065
+DEF_SECTOR_SIZE=512
+DEBUG=0
+EXTEND_SIZE=16777216 # Account for partitioning and prep-size
+base_d=$(dirname $(readlink -f "${0}"))
+PATH="${PATH}:${base_d}"
+error() { echo "$@" 1>&2; }
+debug() {
+	[ "${DEBUG}" -ge "${1:-0}" ] && shift || return 0;
+	error "$@";
+}
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [options] partition-image disk-image
+
+   create disk image 'disk-image' with 'partition-image' in a partition
+   inside it.
+
+   options:
+      -b | --bootcode F write "bootcode" from file 'F' to the at the beginning
+                        of the disk
+      -c | --cylinder-size C
+                        size of cylinders for the disk in 512 byte units
+                        default is ${DEF_CYLINDER_SIZE}
+      -G | --grub       install grub to disk image mbr
+      -s | --size  S    create the disk image of size 'S'.
+                        default is large enough to fit partition-image
+      -v | --verbose    increase verbosity
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+human2bytes() {
+   # converts size suitable for input to resize2fs to bytes
+   # s:512 byte sectors, K:kilobytes, M:megabytes, G:gigabytes
+   # none: block size of the image
+   local input=${1} defunit=${2:-1024}
+   local unit count;
+   case "$input" in
+      *s) count=${input%s}; unit=512;;
+      *K) count=${input%K}; unit=1024;;
+      *M) count=${input%M}; unit=$((1024*1024));;
+      *G) count=${input%G}; unit=$((1024*1024*1024));;
+      *)  count=${input}  ; unit=${2:-1024};;
+   esac
+   _RET=$((${count}*${unit}))
+}
+
+short_opts="b:c:Ghs:v"
+long_opts="bootcode:,grub,help,cylinder-size:,size:,verbose"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+csize=${DEF_CYLINDER_SIZE}
+ssize=${DEF_SECTOR_SIZE}
+size_in=""
+bootcode=""
+grub_ptnum=1
+grub=0
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-b|--boot-code) bootcode="$2"; shift;;
+		-c|--cylinder-size) csize=$2; shift;;
+		-G|--grub) grub=1;;
+		-h|--help) Usage; exit 0;;
+		-s|--size) size_in=$2; shift;;
+		-v|--verbose) DEBUG=$((${DEBUG}+1));;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+rootfs_dm=""
+loop_raw=""
+loop_dev=""
+clean_loops() {
+	debug 1 "Cleaning up loops"
+
+    [ -z "${rootfs_dm}" ] || {
+        find /dev/mapper -iname "${loop_dev///dev\//}*" | \
+			xargs -n1  -I DEVICE dmsetup remove DEVICE ||
+            	kpartx -d "${rootfs_dm}" ||
+                	echo "Failed to remove device mapper devices for ${copy_rootfs_loop}"
+        losetup -d "${loop_dev}";
+		unset loop_raw
+    }
+
+	[ -z "${loop_dev}" ] &&
+		losetup -d "${loop_dev}"
+
+}
+
+[ $# -eq 2 ] || bad_Usage "must supply partition image and output file"
+
+pimg=${1}
+dimg=${2}
+
+{ [ ${grub} -eq 0 ] ||
+	phelper=$(command -v part2disk-grubhelper.ppc64el); } ||
+		fail "no part2disk-grubhelper in PATH"
+
+[ -f "${pimg}" -o -b "${pimg}" ] || fail "${pimg}: not a file or block device"
+
+if [ -b "${pimg}" ]; then
+	kname=$(readlink -f "${pimg}") &&
+		pimg_s=$(awk '$4 == kn { print $3 * 1024 }' \
+		             "kn=${kname##*/}" /proc/partitions) &&
+		[ -n "${pimg_s}" ] ||
+		fail "failed to read size of ${pimg} from /proc/partitions"
+else
+	pimg_s=$(stat --format "%s" "${pimg}") ||
+		fail "failed to get size of ${pimg}"
+fi
+
+if [ -n "${size_in}" ]; then
+	human2bytes "${size_in}" 1 || fail "failed to convert ${size_in} to bytes"
+	size=$((${_RET} + ${EXTEND_SIZE}))
+	cylinders=$((${size}/(${csize}*${ssize})))
+else
+	# no size specified, get enough cylinders to fit part_img
+	# get 1 full cylinder + any remainder
+	pimg_se=$((${pimg_s} + ${EXTEND_SIZE}))
+	cylinders=$((${pimg_se}/(${csize}*${ssize}) + 1))
+	[ "${pimg_se}" = "$((${csize}*${ssize}))" ] || cylinders=$((${cylinders}+1))
+	size=$((${cylinders}*${ssize}*${csize}))
+fi
+
+debug 1 "using ${cylinders} cylinders of ${csize} * ${ssize} = $((${cylinders}*${ssize}*${csize})) bytes"
+
+if [ ! -b ${dimg} ]; then
+	dd if=/dev/zero of=${dimg} bs=1 count=0 seek=${size} ||
+		fail "Failed to create spare file"
+	stat ${dimg}
+fi
+
+if [ -n "${bootcode}" ]; then
+	boot_size=$(stat --format="%s" "${bootcode}")
+	[ ${boot_size} > 1048999 ] && fail "Bootcode file is too big!"
+
+	[ -f "${bootcode}" ] || fail "${bootcode}: not a file"
+	debug 1 "writing bootcode from ${bootcode}"
+	zcat --force "${bootcode}" | dd of="${dimg}" 2>/dev/null ||
+		fail "failed to write from ${bootcode}"
+fi
+
+# Create a MBR image with root on /dev/Xda1, with prep as
+# /dev/Xda2.
+parted_cmd="parted ${dimg} --script --"
+
+# Create the partition table
+${parted_cmd} mklabel msdos ||
+	fail "Failed to create MSDOS partition table"
+
+# Create the primary partition
+${parted_cmd} mkpart primary 7 -1 ||
+	fail "Failed to create rootfs partition entry"
+
+# Create the primary partition
+${parted_cmd} mkpart primary 0 7 ||
+	fail "Failed to create PReP partition entry"
+
+# Check the alignment
+${parted_cmd} align-check opt 1 ||
+	fail "Resultant partition is not properly aligned"
+
+# Now setup stuff
+parted_cmd="parted ${dimg} --script --"
+
+${parted_cmd} set 2 PREP on ||
+	fail "Failed to set primary partition bootable"
+
+# Print the table
+${parted_cmd} print
+
+if [ ! -b "${dimg}" ]; then
+	# Set the trap to make sure exit doesn't hose the system
+	trap clean_loops EXIT
+
+	# Setup the loop to work with
+	loop_raw="$(kpartx -v -a ${dimg} )" ||
+		fail "Failed to add image via kpartx"
+	loop_dev="$(echo -e ${loop_raw} |  head -n1 | awk '{print($(NF-1))}')" ||
+		fail "Unable to determine loop device"
+	rootfs_dm="/dev/mapper${loop_dev///dev/}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "${rootfs_dm} is not a block device"
+
+else
+	udevadm settle
+	blockdev --rereadpt ${dimg}
+	udevadm settle
+
+	[ -b "${dimg}1" ] && rootfs_dm="${dimg}1"
+	[ -b "${dimg}p1" ] && rootfs_dm="${dimg}p1"
+
+	[ ! -b "${rootfs_dm}" ] &&
+		fail "No partition to work with"
+fi
+
+# Now copy the source image
+dd if="${pimg}" of="${rootfs_dm}" &&
+	debug 1 "Copied partition to disk" ||
+	fail    "Failed to copy the partition into disk"
+
+clean_loops
+trap - EXIT
+
+if [ ${grub} -ne 0 ]; then
+	debug 1 "invoking part2disk-grubhelper ${dimg}"
+	sudo "${phelper}" "${dimg}" ||
+		fail "part2disk-grubhelper ${dimg} failed"
+fi
+
+error "wrote to ${dimg}"
+# vi: ts=4 noexpandtab

=== added file 'ovf/part2img'
--- ovf/part2img	1970-01-01 00:00:00 +0000
+++ ovf/part2img	2016-03-22 02:54:49 +0000
@@ -0,0 +1,131 @@
+#!/bin/bash
+#    part2disk - wrap a partition image in a disk image
+#
+#    Copyright (C) 2011 Canonical Ltd.
+#
+#    Authors: Ben Howard <ben.howard@xxxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, version 3 of the License.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+base_d=$(dirname $(readlink -f "${0}"))
+PATH="${PATH}:${base_d}"
+debug() { error "$(date -R):" "$@"; }
+error() { echo "$@" 1>&2; }
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+    cat <<EOF
+Usage: ${0##*/} --source {source} --target {target}
+   Convert raw disk image to QCOW2 disk image
+
+   --source: source raw file system image
+   --target: name of final file image (extension will be appended)
+   --type:   type of image to generate, i.e. qcow2 or vmdk
+   --extension: override the default extention
+
+    Resulting Extension:
+       QCOW2: <target>.qcow2
+       VMDK:  <target>.vmdk
+EOF
+}
+
+cmd_args=$*
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+short_opts="h"
+long_opts="help,source:,target:,type:,extension:"
+
+getopt_out=$(getopt --name "${0##*/}" \
+    --options "${short_opts}" --long "${long_opts}" -- "$@") &&
+    eval set -- "${getopt_out}" ||
+    bad_Usage
+
+source_img=""
+target_img=""
+extension=""
+
+while [ $# -ne 0 ]; do
+    cur=${1}; next=${2};
+    case "$cur" in
+        -h|--help) Usage; exit 0;;
+        --source)  source_img="${next}"; shift;;
+        --target)  target_img="${next}"; shift;;
+        --type)	   img_type="${next}"; shift;;
+        --extension) extension="${next}"; shift;;
+	esac
+	shift
+done
+
+vmdk_compress=1
+case "${img_type}" in
+    qcow2|QCOW|qemu)   ext="qcow2";;
+    vmdk|VMDK|vmware)  ext="vmdk";;
+    oldvmdk)           ext="vmdk"; vmdk_compress=0;;
+    *) fail "Unsupported image type - qcow2 and vmdk are currently supported"; exit 1;;
+esac
+
+extension="${extension:-$ext}"
+final_img="${target_img}.${extension}"
+[ -f "${source_img}" ]   || fail "Source image does not exist"
+[ ! -f "${final_img}" ] || fail "Destination image name already exists"
+
+if [ "${img_type}" = "qcow2" ]; then
+		which qemu-img >/dev/null 2>&1 ||
+            fail "Unable to locate qemu-img, please install it first"
+
+        # Make sure that the qcow2 is created right
+        qcow_cmd=(qemu-img convert -c -O qcow2)
+        release="$(lsb_release -c -s)"
+        if [[ "${release:0:1}" =~ (p|q) ]]; then
+            debug "part2qemu: not using compat=0.10 for qcow2 creation"
+        else
+            debug "part2qemu: using compat=0.10 for qcow creation"
+            qcow_cmd+=(-o compat=0.10)
+        fi
+
+        # Run the command
+        debug "part2qemu: [cmd] ${qcow_cmd[@]} ${source_img} ${final_img}"
+        debug "part2qemu: creating qcow2..."
+		${qcow_cmd[@]} ${source_img} ${final_img} ||
+		    fail "part2qemu: Failed to convert disk image to QCOW2 format"
+
+        qemu-img resize ${final_img} 2252M ||
+            fail "part2qemu: failed to resize disk"
+
+        debug "part2qemu: information about qcow2:"
+        qemu-img info ${final_img}
+fi
+
+if [ "${img_type}" = "vmdk" -o "${img_type}" = "oldvmdk" ]; then
+		if [ "${vmdk_compress}" != "0" ]; then
+			vboxmanage convertfromraw --format vmdk --variant Standard,Stream \
+				"${source_img}" "${final_img}" ||
+				fail "failed: vboxmanage convertfromraw --format vmdk --variant Standard,Stream ${source_img} ${final_img}"
+			capacity=$(vboxmanage showhdinfo "${final_img}" |
+				awk '$0 ~ /^Logical size:/ { printf("%i\n", $3 * 1024 * 1024) }') &&
+				[ -n "${capacity}" ] || fail "unable to get capacity"
+
+		else
+			debug "converting disk image from raw to vmdk with qemu-img"
+			qemu-img convert -f raw -O vmdk "${source_img}" "${final_img}" ||
+				fail "failed to convert disk from raw to vmdk"
+			capacity=$(qemu-img info "${source_img}" |
+				awk '$0 ~ /^virtual size:/ { sub(/[(]/,"",$4); print $4 }') &&
+				[ -n "${capacity}" ] || fail "unable to get capacity"
+
+			which pigz >/dev/null 2>&1 && gzip="pigz" || gzip="gzip --rsyncable"
+			debug "compressing disk image with ${gzip}"
+			( cd "${out_d}" &&
+				${gzip} --force -9 "${final_img##*/}" ) ||
+				fail "failed to compress ${final_img##*/}"
+		fi
+fi
+

=== added file 'ovf/write-ovf'
--- ovf/write-ovf	1970-01-01 00:00:00 +0000
+++ ovf/write-ovf	2016-03-22 02:54:49 +0000
@@ -0,0 +1,100 @@
+#!/usr/bin/python
+
+from Cheetah.Template import Template
+from optparse import OptionParser
+import sys
+import yaml
+import os
+import subprocess
+
+data_defaults = {
+	'DISK_FORMAT_URI': 'http://www.vmware.com/interfaces/specifications/vmdk.html#monolithicSparse',
+	'VIRTUAL_SYSTEM_NAME' : 'Ubuntu Server',
+    'VIRTUAL_SYSTEM_OS_INFO' : 'Ubuntu Server 11.04',
+	'VIRTUAL_SYSTEM_TYPES' : 'vmx-08 qemu-pc qemu-pc-0.13 virtualbox-2.2',
+}
+data_defaults_copy = {
+	'VIRTUAL_SYSTEM_OS_INFO' : 'VIRTUAL_SYSTEM_IDENTIFIER',
+}
+
+# merge values from src into cand.
+# if src has a key, cand will not override
+def mergedict(src,cand):
+    if isinstance(src,dict) and isinstance(cand,dict):
+        for k,v in cand.iteritems():
+            if k not in src:
+                src[k] = v
+            else:
+                src[k] = mergedict(src[k],v)
+    return src
+
+def diskFileInfo(f, d):
+	# FILE_DISK_SIZE, DISK_CAPACITY, FILE_DISK_HREF
+	if not 'FILE_DISK_HREF' in d:
+		d['FILE_DISK_HREF'] = f
+	if not 'FILE_DISK_SIZE' in d:
+		d['FILE_DISK_SIZE'] = os.stat(f).st_size
+
+	if 'DISK_CAPACITY' in os.environ:
+		d['DISK_CAPACITY'] = os.environ['DISK_CAPACITY']
+
+	if 'DISK_CAPACITY' not in d:
+		cmd = [ 'qemu-img', 'info', f ]
+		try:
+			p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+			(output,error) = p.communicate()
+			if p.returncode != 0:
+				raise Exception("unable to get DISK_CAPACITY for %s" % f)
+		except:
+				raise
+
+		for l in output.splitlines():
+			# hoping to match something like:
+			# virtual size: 50M (52428800 bytes)
+			if l.startswith('virtual size:'):
+				vals = l.split()
+				try:
+					s = vals[3][1:]
+					int(s)
+					d['DISK_CAPACITY'] = s
+					break
+				except:
+					raise Exception("failed to parse qemu-img output")
+		if not 'DISK_CAPACITY' in d:
+			raise Exception("Failed to parse qemu-img output")
+
+def main():
+	parser = OptionParser(usage="usage: %prog [options] data-file disk template-file")
+	(options, args) = parser.parse_args()
+
+	if len(args) != 3:
+		parser.error("Must give data-file, disk, template-file")
+
+	(data_file, template_file, disk_file) = sys.argv[1:4]
+
+
+	# get the disk file information
+	dfp = open(data_file,"r")
+	data_in = yaml.load(dfp)
+	dfp.close()
+
+	data = data_in
+	mergedict(data,data_defaults)
+
+	diskFileInfo(disk_file,data)
+
+	for src,tar in data_defaults_copy.iteritems():
+		if src in data and not tar in data:
+			data[tar] = data[src]
+
+	# TODO:
+	#   write manifest file
+	#   sign manifest file
+	t = Template(file=template_file, searchList=[data])
+	sys.stdout.write(t.respond())
+	
+
+if __name__ == "__main__":
+	main()
+
+# vi:ts=4 noexpandtab

=== added file 'remove-old-dailies'
--- remove-old-dailies	1970-01-01 00:00:00 +0000
+++ remove-old-dailies	2016-03-22 02:54:49 +0000
@@ -0,0 +1,171 @@
+#!/bin/bash
+# vi: ts=4 noexpandtab
+
+SAFE_DAYS=3
+SAFE_COUNT=3
+KEEP_BAD_BUILDS=2
+SAFE_FILE=.save
+
+BASES=( /srv/ec2-images/server )
+RELS="precise trusty vivid wily xenial"
+
+# keep ${SAVE_COUNT} builds or builds to ${SAVE_DAYS} days ago, whichever is greater.
+export LANG=C
+
+TEMP_D=""
+error() { echo "$@" 1>&2; }
+errorp() { printf "$@" 1>&2; }
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+failp() { [ $# -eq 0 ] || errorp "$@"; exit 1; }
+cleanup() {
+	[ -z "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} [ options ] [ basedir [ basedir [ ... ] ] ]
+   clean up builds under basedir
+   if no basedir given, use:
+      ${BASES[*]}
+
+   options:
+     -h | --help                  show usage
+     -n | --no-update-published   do not update published info
+          --dry-run               only report what would be done
+EOF
+}
+
+bad_Usage() { Usage 1>&2; [ $# -eq 0 ] || error "$@"; exit 1; }
+
+short_opts="hn"
+long_opts="help,dry-run,no-update-published"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+skip_modify=0
+debug=""
+update_published=1
+info_dir=""
+pt=( )
+
+oargs=( "${0##*/}" "${@}" )
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		  --dry-run) debug=echo; pt=( "--dry-run" );;
+		-h|--help) Usage; exit 0;;
+		-n|--no-update-published) update_published=0;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+if [ $# -ne 0 ]; then
+	BASES=( "$@" )
+fi
+
+[ -n "${PUBLISH_BASE}" ] && info_dir="${PUBLISH_BASE}/query"
+
+reldirs=( ); # like /srv/ec2-images/hardy
+for base in "${BASES[@]}"; do
+	for x in ${RELS}; do
+		x=${base}/${x}
+		[ -d "${x}" ] || continue
+		reldirs[${#reldirs[@]}]=${x}
+	done
+done
+
+datedir="20[01][0-9][01][0-9][0123][0-9]"
+
+safe_date=$(date --date "${SAFE_DAYS} days ago" +"%Y%m%d") ||
+	{ echo "failed to get date"; exit 1; }
+
+topurge=( )
+badbuilds=( )
+for reldir in "${reldirs[@]}"; do
+	count=0;
+	saved=0;
+	bad=0
+
+	# loop backwards through the subdirs
+	rlist=$(for x in "${reldir}/"*; do echo "${x}"; done | LANG=C sort -r)
+	for dailyd in ${rlist}; do
+		bdir=${dailyd##*/}
+
+		# must be a dir
+		[ -d "${dailyd}" ] || continue
+		# must match datedir or datedir.[0-9]
+		case "${bdir}" in
+			${datedir}|${datedir}.[0-9]) :;;
+			*) continue;;
+		esac
+
+		ndate=${bdir%.*} # remove .1
+
+		# if a SAFE_FILE exists, skip the dir
+		[ ! -e "${dailyd}/${SAFE_FILE}" ] || { continue; }
+
+		# if it is a failed build, it should have 'log.stdout.stderr'
+		# if it does and it is older than safe_days, then remove it
+		# but dont count it (we only want to count good builds)
+		if [ -f "${dailyd}/log.stdout.stderr" ] &&
+		   [ ! -f "${dailyd}/published-ec2-daily.txt" ]; then
+			bad=$((bad+1))
+			# if 'count' is non-zero, it means we've already
+			# seen a good build, and since we're counting backwards
+			# that one is newer than this one.  So, with a good build
+			# around, we care less about keeping bad ones
+			if [ ${count} -ne 0 ]; then
+				badbuilds[${#badbuilds[@]}]=${dailyd};
+			else
+				# keep some bad builds around
+				if [ ${bad} -gt ${KEEP_BAD_BUILDS} ]; then
+					badbuilds[${#badbuilds[@]}]=${dailyd};
+				fi
+			fi
+			continue;
+		fi
+
+		# start counting so we know if we've hit SAFE_COUNT
+		count=$((${count}+1))
+
+		# if the directory is less than SAFE_DAYS old, leave it
+		[ "${ndate}" -lt "${safe_date}" ] || continue
+
+		# if we're over SAFE_COUNT, then add to purge
+		if [ "${count}" -gt "${SAFE_COUNT}" ]; then
+			if [ "${dailyd}" -ef "${reldir}/current" ]; then
+				error "ERROR:   ${dailyd} == ${reldir}/current"
+				fail  "exiting instead of removing current build"
+			fi
+			topurge[${#topurge[@]}]=${dailyd};
+		fi
+	done
+done
+
+if [ ${#topurge[@]} -ne 0 ]; then
+	error "removing daily builds: ${topurge[@]}"
+	${debug} rm -Rf "${topurge[@]}"
+else
+	error "no daily builds to clean"
+fi
+
+if [ ${#badbuilds[@]} -ne 0 ]; then
+	error "removing bad builds: ${badbuilds[@]}"
+	${debug} rm -Rf "${badbuilds[@]}"
+else
+	error "no bad builds to clean"
+fi
+
+# publicize-clean is in ec2-publishing-scripts and cleans up
+# query data.  It makes most sense to run it directly after cleaning
+publicize-clean "${pt[@]}" || fail "failed to publicize-clean"
+
+[ -z "${debug}" ] || exit 0
+
+# trigger-sync is in ec2-publishing-scripts, and syncs
+# the modified data from the build system to http hosting system
+${debug} trigger-sync
+exit 0

=== added file 'testrun'
--- testrun	1970-01-01 00:00:00 +0000
+++ testrun	2016-03-22 02:54:49 +0000
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# this does nothing more than set environment variables and exec a command
+# the advantage of setting here versus in cron, is that anyone can
+# easily look at a crontab line and copy and paste it
+# 
+
+HOME=/home/vmbuilder
+umask 022
+
+EC2_DAILY=${HOME}/ec2-daily.next
+CDIMAGE_BIN="${HOME}/cdimage/bin"
+AUTO_BUILDS=${EC2_DAILY}/automated-ec2-builds
+PUBLISH_SCRIPTS=${HOME}/ec2-publishing-scripts
+XC2_PATH="${EC2_DAILY}/xc2"
+S3CMD_PATH="${EC2_DAILY}/s3cmd-0.9.9.91"
+MISC_PATH="${EC2_DAILY}/misc"
+VMBUILDER_PATH="${EC2_DAILY}/vmbuilder"
+export LIVE_BUILD_PATH="${EC2_DAILY}/live-build"
+MYPATH=${VMBUILDER_PATH}:${XC2_PATH}:${S3CMD_PATH}:${PUBLISH_SCRIPTS}:${AUTO_BUILDS}:${VMBUILDER_PATH}:$HOME/bin:${CDIMAGE_BIN}
+export PYTHONPATH="${EC2_DAILY}/boto-1.9b"
+LOGDIR="${EC2_DAILY}/logs"
+
+export PATH=${MYPATH}:/usr/bin:/usr/sbin:/usr/bin:/sbin:/bin
+export JAVA_HOME=/usr
+export START_D=${EC2_DAILY}
+export PUBLISH_BASE=/srv/ec2-images
+export XC2_RETRY_ON="Server.InternalError Read.timeout Server.Unavailable Unable.to.connect"
+
+unset LANG
+
+summary_file() {
+	local file=${1} head=${2:-20} tail=${2:-40}
+    local lines="" remain=""
+	lines=$(wc -l < "${file}")
+	if [ $lines -le $(($head+$tail)) ]; then
+		cat "${file}"
+	else
+		head -n "${head}" "${file}"
+		echo "lines=${lines} head=${head} tail=${tail}"
+		echo "... <<<< $((${lines}-${head}-${tail})) lines >>>>..."
+		tail -n "${tail}" "${file}"
+	fi
+}
+
+if [ "${1%=*}" = "--logname" -o "$1" = "--log" ]; then
+   if [ "$1" = "--log" ]; then
+      lbname="${2}-%s"
+   else
+      lbname="${1#*=}"
+   fi
+   shift
+   logname=$(printf "${lbname}" "$(date +%Y%m%d)")
+   [ -d "${LOGDIR}" ] || mkdir -p "${LOGDIR}" ||
+      { echo "failed to create ${LOGDIR}" 1>&2; exit 1; }
+   lfile="${LOGDIR}/${logname}"
+   i=0;
+   while lfile="${LOGDIR}/${logname}.${i}.log" && [ -e "${lfile}" ]; do
+      i=$((${i}+1))
+   done
+   "$@" > "${lfile}" 2>&1
+   [ $? -eq 0 ] && exit 0
+	echo "command failed: ${*}"
+	echo "==== [stdout/stderr] ${lfile} ====";
+   summary_file "${lfile}"
+else
+   exec "$@"
+fi

=== added file 'ubuntu-ver2adj'
--- ubuntu-ver2adj	1970-01-01 00:00:00 +0000
+++ ubuntu-ver2adj	2016-03-22 02:54:49 +0000
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+map_c_to_v() {
+    c=$(ubuntu-distro-info --series=${1// LTS/} -r)
+    if [[ "${c}" =~ "unknwon" ]]; then
+        echo "unknown"
+    else
+        echo "${c// LTS/}"
+    fi
+}
+
+map_v_to_c() {
+    version=${1}
+    for codename in $(ubuntu-distro-info --all);
+    do
+        c=$(map_c_to_v ${codename})
+        if  [ "${c}" == "${version}" ]; then
+            echo ${codename}
+            break
+        fi
+    done
+}

=== added file 'uecify-hardy'
--- uecify-hardy	1970-01-01 00:00:00 +0000
+++ uecify-hardy	2016-03-22 02:54:49 +0000
@@ -0,0 +1,164 @@
+#!/bin/bash
+# vi: ts=4 noexpandtab
+
+TEMP_D=""
+MP=""
+[ "$CLOUD" = "nova" ] && nova=: || nova=false
+
+error() { echo "$@" 1>&2; }
+debug() { error "$(date -R):" "$@"; }
+unmount_dir() {
+	local input=${1%/}
+	error "cleaning up mounts under ${input}"
+	tac /proc/mounts | sh -c '
+		while read s mp t opt a b ; do 
+			[ "${mp#${1}/}" != "${mp}" -o "${mp}" = "${1}" ] || continue; 
+			umount $mp || exit 1;
+		done' unmount_dir "${input}"
+}
+cleanup() {
+	if [ -n "${MP}" ]; then
+		unmount_dir "${MP}" || { error "FATAL: failed unmount!"; return 1; }
+		MP=""
+	fi
+	[ -z "${TEMP_D}" -o ! -d "${TEMP_D}" ] || rm -Rf "${TEMP_D}"
+}
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+Usage() {
+	cat <<EOF
+Usage: ${0##*/} image
+   convert a hardy based ec2 image into one suitable for UEC
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+short_opts="h"
+long_opts="help"
+getopt_out=$(getopt --name "${0##*/}" \
+	--options "${short_opts}" --long "${long_opts}" -- "$@") &&
+	eval set -- "${getopt_out}" ||
+	bad_Usage
+
+while [ $# -ne 0 ]; do
+	cur=${1}; next=${2};
+	case "$cur" in
+		-h|--help) Usage; exit 0;;
+		--) shift; break;;
+	esac
+	shift;
+done
+
+[ $# -eq 1 ] || bad_Usage "must supply image"
+img=${1}
+
+[ -f "${img}" ] || fail "${1} is not a file"
+
+[ "$(id -u)" = "0" ] || fail "sorry. have to be root"
+
+TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/.${0##*/}.tmp.XXXXXX") ||
+	fail "failed to make tempd"
+
+trap cleanup EXIT USR1 INT
+
+mkdir -p "${TEMP_D}/mp" || fail "failed to make temp mount point"
+MP="${TEMP_D}/mp"
+
+fslabel=$(blkid -o value -s LABEL "$img")
+
+mount -o loop "${img}" "${MP}" || fail "failed to mount ${img}"
+for d in /dev /proc /sys /dev/pts; do
+	mount --bind "${d}" "${MP}/${d}" || fail "failed to bind-mount ${d}"
+done
+
+rconf="$MP/etc/resolv.conf"
+if [ -e "$rconf" -o -L "$rconf" ]; then
+	mv "$rconf" "$rconf.dist" || fail "failed to backup resolv.conf"
+fi
+cp /etc/resolv.conf "$rconf" || fail "failed to update resolv.conf in image"
+
+# uses linux-server (versus linux-virtual) so that acpiphp.ko module
+# would be present.  LP: #364916
+chroot "${MP}" /bin/sh -xc 'LANG=C;  export DEBIAN_FRONTEND=noninteractive;
+	{ apt-get update || : ; } &&
+	apt-get --purge remove "linux-.*xen" --assume-yes &&
+	apt-get install linux-server linux-image-server --assume-yes &&
+		apt-get clean' ||
+	fail "failed to install packages"
+
+
+# in eucalyptus, ephemeral /dev/sda2 on both i386 and amd64.
+# on ec2, this is /dev/sda2 on i386 and /dev/sdb on amd64.
+# on nova we can identify by label
+$nova && eph0="LABEL=ephemeral0" || eph0="/dev/sda2"
+
+whitespace=$'\t ' # tab,space
+s="$whitespace" # shorter
+fstab_updates=(
+  # - ephemeral devices have an ext2 filesystem on them in UEC
+  #   ec2 and nova have ext3. make fstype 'auto' if not already
+  # update the /mnt entry only to use $eph0 as the device
+  -e "s,^\([^#$s]\+\)\([$s]\+\)/mnt\([$s]\+\)\([^$s]\+\),${eph0}\2/mnt\3auto,"
+)
+
+if [ -n "$fslabel" ]; then
+  	# if theres a label on the filesystem, update / entry to use LABEL=
+	fstab_updates=( "${fstab_updates[@]}"
+	  -e "s,^\([^#$s]\+\)\([$s]\+\)/\([$s]\+\),LABEL=${fslabel}\2/\3," )
+fi
+
+sed -i "${fstab_updates[@]}" "$MP/etc/fstab" ||
+	fail "failed to update fstab"
+
+mlist="$MP/boot/grub/menu.lst"
+if [ -e "$mlist" ]; then
+	s="$whitespace"
+	kline="^[$s]*kernel" # matches a kernel line
+	mlist_updates=(
+      # remove any existing console=, then add console=ttyS0
+	  -e "/$kline/s,console=[^ ]*,,g"
+	  -e "/$kline/s,$, console=ttyS0,"
+	)
+	if [ -n "$fslabel" ]; then
+		mlist_updates=( "${mlist_updates[@]}"
+			-e "/$kline/s,root=[^ ]*,root=LABEL=${fslabel}," )
+	fi
+	sed -i "${mlist_updates[@]}" "$mlist" ||
+		fail "failed to update grub/menu.lst"
+fi
+
+arch=$(chroot "${MP}" /bin/sh -c 'dpkg-query --show \
+	--showformat="\${Architecture}\n" bash')
+xarch=${arch};
+[ "${arch}" = "amd64" ] && xarch=x86_64
+
+# here you could do other things to the image
+dd if=/dev/zero of="${MP}/tmp.img" bs=1M
+rm "${MP}/tmp.img"
+
+bname=${img%.img}
+kernel=""
+kernel="${bname}-vmlinuz-server"
+ramdisk="${bname}-initrd-server"
+
+cp "${MP}/boot/vmlinuz-2.6"*-server "${kernel}" &&
+	cp "${MP}/boot/initrd.img-2.6"*-server "${ramdisk}" ||
+	fail "failed to copy out kernel/ramdisk"
+
+rconf="$MP/etc/resolv.conf"
+rm -f "$rconf" || fail "failed to remove resolv.conf"
+if [ -e "$rconf.dist" -o -L "$rconf.dist" ]; then
+	mv "$rconf.dist" "$rconf" || fail "failed to restore resolv.conf"
+fi
+
+unmount_dir "${MP}" && MP="" || fail "failed to unmount ${MP}"
+
+echo "modified ${img}"
+echo "wrote kernel=${kernel}"
+echo "wrote ramdisk=${ramdisk}"
+echo "you can now publish to bucket 'my-bucket' with:"
+cat <<EOF
+  cloud-publish-image --verbose --type image \\
+    --kernel-file "${kernel}" \\
+    --ramdisk-file "${ramdisk}" \\
+    "${xarch}" "${img}" my-bucket
+EOF

=== added file 'vmbuilder-cloudimg-fixes'
--- vmbuilder-cloudimg-fixes	1970-01-01 00:00:00 +0000
+++ vmbuilder-cloudimg-fixes	2016-03-22 02:54:49 +0000
@@ -0,0 +1,464 @@
+#!/bin/bash
+rootd="${1:-/}"
+set -e
+
+CLOUD_IMG_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process"
+
+LANG=C
+
+# dist_ge(dist1,dist2)
+# return true if dist1 is newer or the same as dist2
+dist_ge() { [[ "$1" > "$2" || "$1" == "$2" ]]; }
+dist_le() { [[ "$1" < "$2" || "$1" == "$2" ]]; }
+
+_xchroot() {
+   # Prevent multiple chroots
+   if [ "$1" = "/" ]; then
+      shift;
+      "$@"
+   else
+      chroot "$@"
+   fi
+}
+
+codename=$(_xchroot "${rootd}" sh -c 'lsb_release --short --codename')
+
+#### COMMON architecture independent functions
+arch=$(_xchroot "${rootd}" dpkg --print-architecture)
+
+add_serial_console() {
+   condev=$1
+   idir="$rootd/etc/init"
+   cat << EOF > "${idir}/${condev}.conf"
+# CONDEV - getty
+#
+# This service maintains a getty on CONDEV from the point the system is
+# started until it is shut down again.
+
+start on stopped rc RUNLEVEL=[2345] and (
+            not-container or
+            container CONTAINER=lxc or
+            container CONTAINER=lxc-libvirt)
+
+stop on runlevel [!2345]
+
+pre-start script
+    # getty will not be started if the serial console is not present
+    stty -F /dev/CONDEV -a 2> /dev/null > /dev/null || { stop ; exit 0; }
+end script
+
+respawn
+script
+    exec /sbin/getty -L CONDEV 115200 vt102
+end script
+${CLOUD_IMG_STR}
+EOF
+   sed -i "s/CONDEV/${condev}/g" "$idir/${condev}.conf"
+}
+
+## --------------
+# remove 127.0.1.1 entry (LP: #440757)
+_xchroot "${rootd}" sh -c 'sed -i "/^127.0.1.1/d" /etc/hosts'
+
+## --------------
+# remove ssh pregenerated keys (LP: #512377)
+
+if dist_ge "${codename}" lucid; then
+   _xchroot "${rootd}" sh -c 'rm -f /etc/ssh/ssh_host_[rd]sa_key*'
+fi
+
+## --------------
+if dist_ge "${codename}" trusty; then
+   _xchroot "${rootd}" locale-gen en_US.utf8
+fi
+
+## --------------
+# set cloud-init to be on
+if dist_ge "${codename}" natty; then
+   case "$codename" in
+      natty|oneiric) values="NoCloud, OVF, Ec2";;
+      precise) values="NoCloud, ConfigDrive, OVF, MAAS, Ec2";;
+      *) # this matches quantal and later
+         values="NoCloud, ConfigDrive, AltCloud, OVF, MAAS, Ec2, None";;
+   esac
+   printf "%s\t%s\t%s\t%s\n" \
+      cloud-init cloud-init/datasources multiselect  "$values" |
+      _xchroot "${rootd}" debconf-set-selections
+   _xchroot "${rootd}" dpkg-reconfigure --frontend=noninteractive cloud-init
+fi
+
+## --------------
+# write some build information to the guest
+# the idea is that given runtime info and this info, the instance
+# can at least determine if there is a newer build available
+# these variables are passed in in environment from cloudimg-build-launcher
+if dist_ge "${codename}" lucid &&
+   [ -n "${build_name}" -o -n "${serial}" ]; then
+   d="${rootd}/etc/cloud"
+   [ -d "$d" ] || mkdir -p "${d}"
+   {
+      [ -n "${build_name}" ] && echo "build_name: ${build_name}"
+      [ -n "${serial}" ] && echo "serial: ${serial}"
+   } > "$d/build.info"
+fi
+
+## --------------
+# for maverick and newer, use LABEL= for the '/' entry in fstab
+if dist_ge "${codename}" lucid && [ -n "${root_fs_label}" ]; then
+   bl="[:blank:]"
+   lstr="LABEL=${root_fs_label}"
+   sed -i "s,^[^#${bl}]*\([${bl}]*/[${bl}].*\),${lstr}\1," "${rootd}/etc/fstab"
+fi
+
+## Make sure that the update-motd.d directory exists
+[ ! -e "${rootd}/etc/update-motd.d" ] &&
+   mkdir -p "${rootd}/etc/update-motd.d"
+
+## write a MOTD file advertising support for images
+cat > "${rootd}/etc/update-motd.d/51-cloudguest" << EOF
+#!/bin/sh
+#
+${CLOUD_IMG_STR}
+# This file is not managed by a package.  If you no longer want to
+# see this message you can safely remove the file.
+echo ""
+echo "  Get cloud support with Ubuntu Advantage Cloud Guest:"
+echo "    http://www.ubuntu.com/business/services/cloud";
+EOF
+
+chmod +x "${rootd}/etc/update-motd.d/51-cloudguest"
+
+# for quantal and newer, add /etc/overlayroot.local.conf
+# but do not overwrite anything that somehow got there
+if dist_ge "${codename}" "quantal" &&
+   [ -f "${rootd}/etc/overlayroot.conf" ] &&
+   [ ! -f "${rootd}/etc/overlayroot.local.conf" ]; then
+   {
+      echo "${CLOUD_IMG_STR}"
+      echo "overlayroot_cfgdisk=LABEL=OROOTCFG"
+   } > "${rootd}/etc/overlayroot.local.conf"
+fi
+
+
+#### END COMMON ARCH FUNCTIONS
+
+if [ "$arch" = "ppc64el" ]; then
+   add_serial_console hvc0
+   exit 0
+fi
+
+# ARM images are special
+if [[ "$arch" =~ (arm|arm64|aarch64) ]]; then
+
+   echo "Configuring ARM Serial Port"
+   add_serial_console ttyAMA0
+
+   if dist_le "${code_name}" oneiric; then
+      echo "Removing resolv.conf as unneeded"
+   fi
+
+   echo "Image architecture is ARM. Existing vmbuilder-fixups"
+
+   exit 0
+fi
+
+## Add ttyS0 for i386/amd64 for Trusty and newer
+if dist_ge "$codename" trusty && [ "$arch" = "i386" -o "$arch" = "amd64" ]; then
+   add_serial_console ttyS0
+fi
+
+
+psuedo_grub_probe() {
+   cat <<"PSUEDO_GRUB_PROBE"
+#!/bin/sh
+Usage() {
+   cat <<EOF
+Usage: euca-psuedo-grub-probe
+   this is a wrapper around grub-probe to provide the answers for an ec2 guest
+EOF
+}
+bad_Usage() { Usage 1>&2; fail "$@"; }
+
+short_opts=""
+long_opts="device-map:,target:,device"
+getopt_out=$(getopt --name "${0##*/}" \
+   --options "${short_opts}" --long "${long_opts}" -- "$@") &&
+   eval set -- "${getopt_out}" ||
+   bad_Usage
+
+device_map=""
+target=""
+device=0
+arg=""
+
+while [ $# -ne 0 ]; do
+   cur=${1}; next=${2};
+   case "$cur" in
+      --device-map) device_map=${next}; shift;;
+      --device) device=1;;
+      --target) target=${next}; shift;;
+      --) shift; break;;
+   esac
+   shift;
+done
+arg=${1}
+
+case "${target}:${device}:${arg}" in
+   device:*:/*) echo "/dev/sda1"; exit 0;;
+   fs:*:*) echo "ext2"; exit 0;;
+   partmap:*:*)
+      # older versions of grub (lucid) want 'part_msdos' written
+      # rather than 'msdos'
+      legacy_pre=""
+      grubver=$(dpkg-query --show --showformat '${Version}\n' grub-pc 2>/dev/null) &&
+         dpkg --compare-versions "${grubver}" lt 1.98+20100804-5ubuntu3 &&
+         legacy_pre="part_"
+      echo "${legacy_pre}msdos";
+      exit 0;;
+   abstraction:*:*) echo ""; exit 0;;
+   drive:*:/dev/sda) echo "(hd0)";;
+   drive:*:/dev/sda*) echo "(hd0,1)";;
+   fs_uuid:*:*) exit 1;;
+esac
+PSUEDO_GRUB_PROBE
+}
+
+## --------------
+# add 'acpiphp' to modules so it is loaded on boot (LP: #450463)
+# but only do it on precise (LP: #1430323)
+if dist_le "${codename}" precise; then
+   _xchroot "${rootd}" sh -c 'f=/etc/modules;
+      grep "^acpiphp$" "${f}" ||
+      printf "# %s\n%s\n" "LP: #450463" "acpiphp" >> "${f}"'
+fi
+
+## --------------
+# below installs neatx from the freenx-team ppa , but only
+# if the ubuntu-desktop is installed and suite is lucid.
+# ideally we could use '--ppa' and '--add-pkgs' of vmbuilder, but
+# because initially there was no 'lucid' repo there, we used
+# karmic like this.  Then, quick change to lucid.
+#
+# to avoid key server timeouts we have the key in a HERE document
+if dist_ge "${codename}" lucid && ! dist_ge "${codename}" natty; then
+   _xchroot "${rootd}" sh -c '
+      desktop=$(dpkg-query --show ubuntu-desktop) ||
+         { echo "not installing nx (not -desktop)"; exit 0; }
+      ppaurl="http://ppa.launchpad.net/freenx-team/ppa/ubuntu";;
+      key=D018A4CE;
+      export DEBIAN_FRONTEND=noninteractive
+      printf "deb ${ppaurl} lucid main" > \
+         /etc/apt/sources.list.d/freenx-team-ppa.list &&
+      apt-key add - &&
+      apt-get update && apt-get install --assume-yes neatx-server ||
+         { echo "failed"; exit 1; }
+      ' <<EOF
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.9 (GNU/Linux)
+
+mI0ESXcA1AEEAK/FkL6U3huCjVb3NtewLY+6dNgmH+zvFDQi7Ltz1VmYEq8nIZfj
+N4AeC4Y7PELf/+4aSCiTI17+DAnrnfQkFLoXXTpqWL9YvsFpc3loX7EQJejyUPjk
+7KrmRJOZSID+JuBmf14IzCL8ShScta5ifu3rrjY5MpSdDARCuiIBK/TnABEBAAG0
+HUxhdW5jaHBhZCBQUEEgZm9yIEZyZWVOWCBUZWFtiLYEEwECACAFAkl3ANQCGwMG
+CwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRAqjjA00BikzvLPA/9iNkk2dSIqrHsw
+9AAna96O7f/oZ5CCL+3tu/OQf8oh42hcT8du7kqR69GZDDZnAs92yXDh+/5Qs87f
+pYBO7Buj41iVj9NQgY/o7RbJCoWhZGVvv48pPNKGtEnQnwI7ulELPKbD9WspZrRL
+O3VSl6Po7xQVVRw5N8xt4n8j/Z84Tw==
+=/zdI
+-----END PGP PUBLIC KEY BLOCK-----
+EOF
+fi
+
+## install / setup grub2
+if dist_ge "${codename}" lucid; then
+   gprobe="${rootd}/usr/sbin/grub-probe"
+   moved=0
+   if [ -f "${gprobe}" ]; then
+      mv "${gprobe}" "${gprobe}.dist"
+      moved=1
+   fi
+   psuedo_grub_probe > "${gprobe}"
+   chmod 755 "${gprobe}"
+
+   if dist_ge "${codename}" quantal; then
+      # for Quantal and later, use /etc/default/grub.d functionality
+      # rather than modifying the grub configuration itself.
+      # This avoids the mess of having to do dpkg stuff
+      # LP: 1179940
+      mkdir -p "${rootd}/etc/default/grub.d"
+      cat << EOF > "${rootd}/etc/default/grub.d/50-cloudimg-settings.cfg"
+# Cloud Image specific Grub settings for Generic Cloud Images
+${CLOUD_IMG_STR}
+
+# Set the recordfail timeout
+GRUB_RECORDFAIL_TIMEOUT=0
+
+# Do not wait on grub prompt
+GRUB_TIMEOUT=0
+
+# Set the default commandline
+GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0"
+
+# Set the grub console type
+GRUB_TERMINAL=console
+EOF
+      _xchroot "${rootd}" update-grub2
+
+   else
+
+      if dist_ge "${codename}" oneiric; then
+         # on precise or later, do not hang at grub prompt after incomplete boot.
+         # This requires a grub feature also. (LP: #1035279, LP: #669481)
+         printf "\n%s\n%s\n" "#Disable recordfail timeout" \
+            "GRUB_RECORDFAIL_TIMEOUT=0" >> "${rootd}/etc/default/grub"
+      fi
+
+      # Set the grub time out
+      new_timeout=5
+      sed -i -e "s,^GRUB_TIMEOUT=.*,GRUB_TIMEOUT=${new_timeout}," \
+          "${rootd}/etc/default/grub"
+
+      # modify default linux command line for serial console output
+      # change GRUB_CMDLINE_LINUX_DEFAULT="quite splash"
+      # to GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0"
+      opt="GRUB_CMDLINE_LINUX_DEFAULT"
+      defstr="console=ttyS0"
+      sed -i "s/\(${opt}=\".*\"\)$/${opt}=\"${defstr}\"/" \
+         "${rootd}/etc/default/grub"
+
+      # make the debconf values match those stored in /etc/default/grub
+      # above.  This means that the user isn't prompted for a merge on
+      # a dpkg-reconfigure grub-pc
+      printf "%s\t%s\t%s\t%s\n%s\t%s\t%s\t%s\n" \
+         grub-pc grub2/linux_cmdline_default string "${defstr}" \
+         grub-pc grub2/linux_cmdline string " " |
+            _xchroot "${rootd}" debconf-set-selections
+
+      sed -i -e 's,^\(GRUB_HIDDEN_TIMEOUT=.*\),#\1,' \
+         -e 's/^\(GRUB_HIDDEN_TIMEOUT_QUIET=.*\)/#\1/' \
+         -e 's,^#GRUB_TERMINAL=console,GRUB_TERMINAL=console,' \
+         "${rootd}/etc/default/grub"
+   fi
+
+   if dist_ge "${codename}" "trusty"; then
+      # since this is a disk image, we technically don't need to install all the
+      # grub modules, as the image itself is not bootable. This makes for a small
+      # disk image
+      _xchroot "${rootd}" update-grub
+   else
+      _xchroot "${rootd}" /bin/sh -c \
+          'grub-install --grub-setup=/bin/true /dev/sda && /usr/sbin/update-grub'
+   fi
+
+   # reconfigure grub so that upgrades to grub-pc do not force a debconf config
+   # changed prompt (LP: #1009294).  This re-runs update-grub
+   if dist_ge "$codename" "precise"; then
+      _xchroot "${rootd}" env DEBIAN_FRONTEND=noninteractive \
+         dpkg-reconfigure grub-pc
+   fi
+
+   grub2cfg="${rootd}/boot/grub/grub.cfg"
+   [ ! -f "${grub2cfg}" ] ||
+      sed -i -e "s,root=/dev/sda1,root=LABEL=${root_fs_label}," "${grub2cfg}"
+
+   if [ "${codename}" = "lucid" ]; then
+      # for lucid builds, remove /boot/grub/video.lst that was created
+      # during 'update-grub' above.  Its very hacky, but this file with 'vbe'
+      # in it takes update-grub down a sour path, causing failure on ec2.
+      # this workaround could be removed if LP: #623609 is fixed in lucid
+      rm -f "${rootd}/boot/grub/video.lst"
+   fi
+
+   [ ${moved} -eq 0 ] || mv "${gprobe}.dist" "${gprobe}"
+
+fi
+
+if [ "${codename}" = "lucid" ]; then
+   # for lucid builds, write hooks to kernel-img.conf.  This is not
+   # necessary for maverick and later grub2 packages as it puts hooks
+   # into etc/kernel/postinst.d/ (#554175), and handles removing
+   # these entries on release upgrade also
+   kimg_conf="${rootd}/etc/kernel-img.conf"
+   if [ -f "${kimg_conf}" ]; then
+      for hook in postinst_hook postrm_hook; do
+         grep -q "${hook}" "${kimg_conf}" ||
+            echo "${hook} = update-grub" >> "${kimg_conf}"
+      done
+   fi
+fi
+
+## modify /boot/grub/menu.lst if it exists
+## this is generated at install time by grub-legacy-ec2, but will have
+## devices as found from the _xchroot.  Here we write what it will be on ec2
+if [ -f "${rootd}/boot/grub/menu.lst" ]; then
+   grub_root="(hd0)"
+   linux_root=/dev/sda1
+   [ -n "${root_fs_label}" ] && linux_root="LABEL=${root_fs_label}"
+   # the sed code below basically fixes/sets the following lines in a
+   # /boot/grub/menu.lst file:
+   #   # kopt=root=xxxxxxx ro
+   #   kernel  /boot/vmlinuz-... root=xxxxxx ....
+   #   # groot=xxxxx
+   #   root    xxxxx
+   #   uuuid   xxxxx
+   sed -i "${rootd}/boot/grub/menu.lst" \
+      -e "s|^\(# kopt=root=\)[^ ]*|\1${linux_root}|" \
+      -e "s|^\(kernel.*root=\)[^ ]*|\1${linux_root}|" \
+      -e "s|^\(# groot=\)[^ ]*|\1${grub_root}|" \
+      -e "s|^\(root\|uuid\)\([[:space:]]*\).*|root\2${grub_root}|"
+
+   # LP: #682831
+   # in lucid with -ec2 kernel, we need to pass xencons=hvc0 in addition
+   # to console=hvc0 to work around an issue in plymouth
+   if [ "${codename}" = "lucid" ]; then
+      sed -i '/xencons=hvc0/!s,console=hvc0,xencons=hvc0 console=hvc0,' \
+         "${rootd}/boot/grub/menu.lst"
+   fi
+
+   # grub-legacy-ec2 writes this ucf entry. since we've modified
+   # /boot/grub/menu.lst, we have to remove it, or the user will
+   # get prompted for a 3 way merge of the changes the first time this runs
+   echo "ucf prior to grub removal contains:"
+   _xchroot "${rootd}" /bin/cat /var/lib/ucf/registry
+   _xchroot "${rootd}" /usr/bin/ucfr --purge grub /var/run/grub/menu.lst
+   _xchroot "${rootd}" /bin/sed -i -r \
+      '/grub[[:space:]]+\/var\/run\/grub\/menu.lst/d' \
+      /var/lib/ucf/registry
+   echo "ucf registry now contains:"
+   _xchroot "${rootd}" /bin/cat /var/lib/ucf/registry
+fi
+
+if [ "${codename}" = "hardy" -o "${codename}" = "karmic" ] &&
+   [ ! -f "${rootd}/boot/grub/menu.lst" ]; then
+   [ -d "${rootd}/boot/grub" ] || mkdir -p "${rootd}/boot/grub"
+   cat > "${rootd}/boot/grub/menu.lst" <<EOF
+# This file is not managed.  It is only present in order to provide
+# a way to boot a default AMI with a pv-grub image.
+default 0
+timeout 0
+hiddenmenu
+
+title vmlinuz
+root (hd0)
+kernel /vmlinuz root=/dev/sda1 ro
+initrd /initrd.img
+EOF
+fi
+
+if [ "${codename}" = "hardy" ]; then
+   # LP: #859814 : there is no cloud-init package in hardy, so we've
+   # chosen to apply that here directly
+   cat > "${rootd}/etc/apt/apt.conf.d/90cloud-init-pipelining" <<EOF
+//Written by cloud-init per 'apt_pipelining'
+Acquire::http::Pipeline-Depth "0";
+EOF
+fi
+
+## remove /etc/resolv.conf on oneiric and earlier
+if dist_le "${code_name}" oneiric; then
+   echo "Removing resolv.conf as unneeded"
+   _xchroot "${rootd}" rm /etc/resolv.conf
+fi
+
+
+# vi: ts=3 expandtab

=== added file 'write-versions'
--- write-versions	1970-01-01 00:00:00 +0000
+++ write-versions	2016-03-22 02:54:49 +0000
@@ -0,0 +1,15 @@
+#!/bin/bash -eux
+ROOT_D=$1
+BUILD_TYPE=$2
+SERIAL=$3
+DESCRIPTION=$4
+
+# write build.info
+mkdir -p "${ROOT_D}/etc/cloud"
+cat > "${ROOT_D}/etc/cloud/build.info" << EOM
+build_name: ${BUILD_TYPE}
+serial: ${SERIAL}
+EOM
+
+# write ec2-version
+echo "${DESCRIPTION}" >> "${ROOT_D}/etc/ec2_version"