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/zesty
Robert C Jennings 7 years ago
parent 0259fee5dc
commit 5089e589ef

12
debian/changelog vendored

@ -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 <robert.jennings@canonical.com> Wed, 13 Sep 2017 13:36:40 -0500
livecd-rootfs (2.441.5) zesty; urgency=medium livecd-rootfs (2.441.5) zesty; urgency=medium
[ Colin Watson ] [ Colin Watson ]

@ -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() { mount_partition() {
partition="$1" partition="$1"
mountpoint="$2" mountpoint="$2"
@ -134,16 +147,9 @@ EOF
} }
umount_settle() {
# Unmount device, and let it settle
umount $1
udevadm settle
}
umount_partition() { umount_partition() {
local mountpoint=${1} local mountpoint=${1}
mv resolv.conf.tmp "$mountpoint/etc/resolv.conf" teardown_mountpoint $mountpoint
umount -R $mountpoint
udevadm settle udevadm settle
if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then if [ -n "${rootfs_dev_mapper}" -a -b "${rootfs_dev_mapper}" ]; then

@ -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 rm /usr/sbin/grub-probe
chroot binary/boot/squashfs.dir dpkg-divert --remove --local --rename /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" teardown_mountpoint binary/boot/squashfs.dir
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"
apt-get -qqy install squashfs-tools apt-get -qqy install squashfs-tools

Loading…
Cancel
Save