From 74124543e323ef892f2b4d9a7f32788822130906 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Thu, 21 Jul 2016 09:14:50 -0700 Subject: [PATCH] Import patches-unapplied version 2.421 to ubuntu/yakkety-proposed Imported using git-ubuntu import. Changelog parent: 8c784360c6c16add140b69121218cbc7bffc9521 New changelog entries: [ Louis Zuckerman ] * Fixes for vagrant box builder in ubuntu-cpc LP: #1565985 - Install virtualbox-guest-utils - Don't disable default synced folder - Don't set vm name - Add cloud-init config to manage /etc/hosts LP: #1561250 --- debian/changelog | 11 ++++ .../ubuntu-cpc/hooks/042-vagrant.binary | 64 +++++++++++-------- 2 files changed, 47 insertions(+), 28 deletions(-) diff --git a/debian/changelog b/debian/changelog index b2bffaf0..20ea8999 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +livecd-rootfs (2.421) yakkety; urgency=medium + + [ Louis Zuckerman ] + * Fixes for vagrant box builder in ubuntu-cpc LP: #1565985 + - Install virtualbox-guest-utils + - Don't disable default synced folder + - Don't set vm name + - Add cloud-init config to manage /etc/hosts LP: #1561250 + + -- Steve Langasek Thu, 21 Jul 2016 09:14:50 -0700 + livecd-rootfs (2.420) yakkety; urgency=medium [ Ɓukasz 'sil2100' Zemczak ] diff --git a/live-build/ubuntu-cpc/hooks/042-vagrant.binary b/live-build/ubuntu-cpc/hooks/042-vagrant.binary index a784aa21..6fd02d9c 100755 --- a/live-build/ubuntu-cpc/hooks/042-vagrant.binary +++ b/live-build/ubuntu-cpc/hooks/042-vagrant.binary @@ -1,22 +1,23 @@ -#!/bin/bash -eux +#!/bin/bash -ex # vi: ts=4 noexpandtab # # Generate a generic Vagrant Box. # -# Vagrant images are essentially nothing more than OVA's with extra-metadata. +# Vagrant images are essentially nothing more than OVA's with extra-metadata +# and some preinstalled packages. # -# We can't use the OVA's for Vagrant since Vagrant uses SSH to modify the instance. -# This build step creates a cloud-config ISO so that Cloud-Init will configure -# the initial user, creates meta-data that tells Vagrant how to interact with -# the cloud-init created users, and finally create the OVA. +# We can't use the OVA's for Vagrant since Vagrant uses SSH to modify the +# instance. This build step creates a cloud-config ISO so that Cloud-Init +# will configure the initial user, creates meta-data that tells Vagrant how +# to interact with the cloud-init created users, and finally create the OVA. # -# For this step, we re-use the VMDK's made in 040-vmdk-image.binary +# For this step, we make a deriviative of binary/boot/disk.ext4 and install +# some packages in it, convert it to a vmdk, and then assemble the vagrant +# box. cur_d=${PWD} my_d=$(dirname $(readlink -f ${0})) -base_vmdk="livecd.ubuntu-cpc.vmdk" - case $ARCH in amd64|i386) ;; *) @@ -24,11 +25,6 @@ case $ARCH in exit 0 esac -if [ ! -e ${base_vmdk} ]; then - echo "Did not find VMDK to produce Vagrant images." - exit 0 -fi - . /build/config/functions # Virtualbox is needed for making a small VMDK @@ -37,7 +33,22 @@ apt-get -qqy install genisoimage qemu-utils # Lets be safe about this box_d=$(mktemp -d) seed_d=$(mktemp -d) -trap "rm -rf ${box_d} ${seed_d}" EXIT +mount_d=$(mktemp -d) + +create_derivative "disk" "vagrant" #sets ${derivative_img} +mount_disk_image ${derivative_img} ${mount_d} + +cleanup_vagrant() { + umount_disk_image ${mount_d} + rm -rf ${box_d} ${seed_d} ${mount_d} ${derivative_img} +} +trap cleanup_vagrant EXIT + +chroot ${mount_d} apt-get update +# virtualbox-guest-utils Recommends: virtualbox-guest-x11, which we want to +# avoid pulling into a cloud image. +chroot ${mount_d} apt-get install --no-install-recommends -y virtualbox-guest-utils +chroot ${mount_d} apt-get clean # Used to identify bits suite=$(chroot chroot lsb_release -c -s) @@ -47,7 +58,7 @@ distro=$(chroot chroot lsb_release --id --short | tr [:upper:] [:lower:]) # Get the VMDK in place prefix="${distro}-${suite}-${version}-cloudimg" vmdk_f="${box_d}/${prefix}.vmdk" -cp ${base_vmdk} ${vmdk_f} +create_vmdk ${derivative_img} ${vmdk_f} # Vagrant needs a base user. We either inject the well-known SSH key # or use password authentication. Both are ugly. So we'll use a password @@ -70,6 +81,7 @@ cat > ${seed_d}/user-data <