live-build/ubuntu-cpc/functions: Add teardown_mountpoint to reverse setup_mountpoint

* live-build/ubuntu-cpc/functions: Add a function, teardown_mountpoint,
  to reverse the work done in setup_mountpoint.  Lack of this function
  has forced users of setup_mountpoint to implement this separately
  and the implementations have diverged. (LP: #1716992)
* live-build/ubuntu-cpc/functions: Remove umount_settle function.
  The was only used where teardown_mountpoint was lacking.
ubuntu/artful
Robert C Jennings 7 years ago
parent 8589d3548f
commit 83b4f5338c

9
debian/changelog vendored

@ -1,5 +1,14 @@
livecd-rootfs (2.454) UNRELEASED; urgency=medium
[ Robert C Jennings ]
* live-build/ubuntu-cpc/functions: Add a function, teardown_mountpoint,
to reverse the work done in setup_mountpoint. Lack of this function
has forced users of setup_mountpoint to implement this separately
and the implementations have diverged. (LP: #1716992)
* live-build/ubuntu-cpc/functions: Remove umount_settle function.
The was only used where teardown_mountpoint was lacking.
[ Steve Langasek ]
* live-build/functions: mount tmpfs on /var/cache/apt and var/lib/apt, so
we don't have to leave empty space in our derivative images for packages
that have been downloaded/installed/removed. This normally isn't

@ -91,6 +91,21 @@ setup_mountpoint() {
}
teardown_mountpoint() {
# Reverse the operations from setup_mountpoint
local mountpoint="$1"
umount "$mountpoint/var/cache/apt"
umount "$mountpoint/var/lib/apt"
umount "$mountpoint/tmp"
umount "$mountpoint/sys"
umount "$mountpoint/proc"
umount -R "$mountpoint/dev"
udevadm settle
sleep 3
mv resolv.conf.tmp "$mountpoint/etc/resolv.conf"
}
mount_partition() {
partition="$1"
mountpoint="$2"
@ -134,16 +149,9 @@ EOF
}
umount_settle() {
# Unmount device, and let it settle
umount $1
udevadm settle
}
umount_partition() {
local mountpoint=${1}
mv resolv.conf.tmp "$mountpoint/etc/resolv.conf"
umount -R $mountpoint
teardown_mountpoint $mountpoint
udevadm settle
if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then

@ -36,13 +36,7 @@ chroot binary/boot/squashfs.dir mkdir /lib/modules
chroot binary/boot/squashfs.dir rm /usr/sbin/grub-probe
chroot binary/boot/squashfs.dir dpkg-divert --remove --local --rename /usr/sbin/grub-probe
mv resolv.conf.tmp "binary/boot/squashfs.dir/etc/resolv.conf"
umount "binary/boot/squashfs.dir/proc"
umount "binary/boot/squashfs.dir/sys"
umount -R "binary/boot/squashfs.dir/dev"
umount "binary/boot/squashfs.dir/tmp"
umount "binary/boot/squashfs.dir/var/lib/apt"
umount "binary/boot/squashfs.dir/var/cache/apt"
teardown_mountpoint binary/boot/squashfs.dir
squashfs_f="${PWD}/livecd.ubuntu-cpc.squashfs"
squashfs_f_manifest="${squashfs_f}.manifest"

Loading…
Cancel
Save