live-build/ubuntu-cpc/hooks/042-vagrant.binary: fix unmount handling

so that the teardown is done properly /before/ we try to make an
image from our filesystem, since otherwise /etc/resolv.conf is broken.
LP: #1621393.
This commit is contained in:
Steve Langasek 2016-09-09 17:04:54 -07:00
parent d51fef0426
commit 4079a1acce
2 changed files with 14 additions and 1 deletions

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
livecd-rootfs (2.408.4) UNRELEASED; urgency=medium
* live-build/ubuntu-cpc/hooks/042-vagrant.binary: fix unmount handling
so that the teardown is done properly /before/ we try to make an
image from our filesystem, since otherwise /etc/resolv.conf is broken.
LP: #1621393.
-- Steve Langasek <steve.langasek@ubuntu.com> Fri, 09 Sep 2016 17:04:35 -0700
livecd-rootfs (2.408.3) xenial-proposed; urgency=medium
[ Louis Zuckerman ]

View File

@ -39,7 +39,9 @@ create_derivative "disk" "vagrant" #sets ${derivative_img}
mount_disk_image ${derivative_img} ${mount_d}
cleanup_vagrant() {
umount_disk_image ${mount_d}
if [ -d "$mount_d" ]; then
umount_disk_image "$mount_d"
fi
rm -rf ${box_d} ${seed_d} ${mount_d} ${derivative_img}
}
trap cleanup_vagrant EXIT
@ -49,6 +51,8 @@ chroot ${mount_d} apt-get update
# 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
umount_disk_image "$mount_d"
rmdir "$mount_d"
# Used to identify bits
suite=$(chroot chroot lsb_release -c -s)