From 83b4f5338ce1305195cba4ad4a2a870c071e944f Mon Sep 17 00:00:00 2001 From: Robert C Jennings Date: Wed, 13 Sep 2017 13:31:12 -0500 Subject: [PATCH] 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. --- debian/changelog | 9 +++++++ live-build/functions | 24 ++++++++++++------- .../ubuntu-cpc/hooks/032-root-squashfs.binary | 8 +------ 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/debian/changelog b/debian/changelog index ec0d6209..71a5f044 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/live-build/functions b/live-build/functions index 868fcdb2..fbd8b44c 100644 --- a/live-build/functions +++ b/live-build/functions @@ -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 diff --git a/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary b/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary index 703b2b15..bcce0a76 100755 --- a/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary +++ b/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary @@ -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"