mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-05-08 01:11:31 +00:00
updated per Steve Langasek's feedback:
- put umount in trap - wrap comment lines at 78 chars - remove unnecessary DEBIAN_FRONTENT env var from apt-get lines
This commit is contained in:
parent
85d3b5fdaf
commit
213c3b317c
@ -3,16 +3,17 @@
|
|||||||
#
|
#
|
||||||
# Generate a generic Vagrant Box.
|
# Generate a generic Vagrant Box.
|
||||||
#
|
#
|
||||||
# Vagrant images are essentially nothing more than OVA's with extra-metadata and
|
# Vagrant images are essentially nothing more than OVA's with extra-metadata
|
||||||
# some preinstalled packages.
|
# and some preinstalled packages.
|
||||||
#
|
#
|
||||||
# We can't use the OVA's for Vagrant since Vagrant uses SSH to modify the instance.
|
# We can't use the OVA's for Vagrant since Vagrant uses SSH to modify the
|
||||||
# This build step creates a cloud-config ISO so that Cloud-Init will configure
|
# instance. This build step creates a cloud-config ISO so that Cloud-Init
|
||||||
# the initial user, creates meta-data that tells Vagrant how to interact with
|
# will configure the initial user, creates meta-data that tells Vagrant how
|
||||||
# the cloud-init created users, and finally create the OVA.
|
# to interact with the cloud-init created users, and finally create the OVA.
|
||||||
#
|
#
|
||||||
# For this step, we make a deriviative of binary/boot/disk.ext4 and install some
|
# For this step, we make a deriviative of binary/boot/disk.ext4 and install
|
||||||
# packages in it, convert it to a vmdk, and then assemble the vagrant box.
|
# some packages in it, convert it to a vmdk, and then assemble the vagrant
|
||||||
|
# box.
|
||||||
|
|
||||||
cur_d=${PWD}
|
cur_d=${PWD}
|
||||||
my_d=$(dirname $(readlink -f ${0}))
|
my_d=$(dirname $(readlink -f ${0}))
|
||||||
@ -33,18 +34,23 @@ apt-get -qqy install genisoimage qemu-utils
|
|||||||
box_d=$(mktemp -d)
|
box_d=$(mktemp -d)
|
||||||
seed_d=$(mktemp -d)
|
seed_d=$(mktemp -d)
|
||||||
mount_d=$(mktemp -d)
|
mount_d=$(mktemp -d)
|
||||||
trap "rm -rf ${box_d} ${seed_d} ${mount_d}" EXIT
|
|
||||||
|
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
|
||||||
|
|
||||||
pkgs=(virtualbox-guest-dkms
|
pkgs=(virtualbox-guest-dkms
|
||||||
virtualbox-guest-utils
|
virtualbox-guest-utils
|
||||||
)
|
)
|
||||||
|
|
||||||
create_derivative "disk" "vagrant" #sets ${derivative_img}
|
chroot ${mount_d} apt-get update
|
||||||
mount_disk_image ${derivative_img} ${mount_d}
|
chroot ${mount_d} apt-get install --no-install-recommends -y ${pkgs[@]}
|
||||||
env DEBIAN_FRONTEND=noninteractive chroot ${mount_d} apt-get update
|
chroot ${mount_d} apt-get clean
|
||||||
env DEBIAN_FRONTEND=noninteractive chroot ${mount_d} apt-get install --no-install-recommends -y ${pkgs[@]}
|
|
||||||
env DEBIAN_FRONTEND=noninteractive chroot ${mount_d} apt-get clean
|
|
||||||
umount_disk_image ${mount_d}
|
|
||||||
|
|
||||||
# Used to identify bits
|
# Used to identify bits
|
||||||
suite=$(chroot chroot lsb_release -c -s)
|
suite=$(chroot chroot lsb_release -c -s)
|
||||||
@ -55,7 +61,6 @@ distro=$(chroot chroot lsb_release --id --short | tr [:upper:] [:lower:])
|
|||||||
prefix="${distro}-${suite}-${version}-cloudimg"
|
prefix="${distro}-${suite}-${version}-cloudimg"
|
||||||
vmdk_f="${box_d}/${prefix}.vmdk"
|
vmdk_f="${box_d}/${prefix}.vmdk"
|
||||||
create_vmdk ${derivative_img} ${vmdk_f}
|
create_vmdk ${derivative_img} ${vmdk_f}
|
||||||
rm -f ${derivative_img}
|
|
||||||
|
|
||||||
# Vagrant needs a base user. We either inject the well-known SSH key
|
# 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
|
# or use password authentication. Both are ugly. So we'll use a password
|
||||||
|
Loading…
x
Reference in New Issue
Block a user