From 5089e589ef05a90a4fbcd12c43a935b7969270cb Mon Sep 17 00:00:00 2001 From: Robert C Jennings Date: Wed, 13 Sep 2017 13:37:25 -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 | 12 ++++++++++ live-build/functions | 22 ++++++++++++------- .../ubuntu-cpc/hooks/032-root-squashfs.binary | 6 +---- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/debian/changelog b/debian/changelog index bcf6f520..c63fba55 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +livecd-rootfs (2.441.6) 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. + + -- Robert C Jennings Wed, 13 Sep 2017 13:36:40 -0500 + livecd-rootfs (2.441.5) zesty; urgency=medium [ Colin Watson ] diff --git a/live-build/functions b/live-build/functions index 02c366b4..ee3ee116 100644 --- a/live-build/functions +++ b/live-build/functions @@ -91,6 +91,19 @@ setup_mountpoint() { } +teardown_mountpoint() { + # Reverse the operations from setup_mountpoint + local mountpoint="$1" + + 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 +147,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 e5c0d7a1..6be35133 100755 --- a/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary +++ b/live-build/ubuntu-cpc/hooks/032-root-squashfs.binary @@ -36,11 +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" +teardown_mountpoint binary/boot/squashfs.dir apt-get -qqy install squashfs-tools