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.
core-include-dmsetup
Robert C Jennings 7 years ago
parent 2c98112f93
commit 0acda846dd

11
debian/changelog vendored

@ -1,3 +1,14 @@
livecd-rootfs (2.408.17) 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 12:00:59 -0500
livecd-rootfs (2.408.16) xenial; urgency=medium livecd-rootfs (2.408.16) xenial; urgency=medium
* live-build/ubuntu-cpc/functions: call apt-get update in the chroot * live-build/ubuntu-cpc/functions: call apt-get update in the chroot

@ -94,6 +94,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() { mount_partition() {
partition="$1" partition="$1"
mountpoint="$2" mountpoint="$2"
@ -126,16 +141,9 @@ EOF
} }
umount_settle() {
# Unmount device, and let it settle
umount $1
udevadm settle
sleep 3
}
umount_partition() { umount_partition() {
local mountpoint=${1} local mountpoint=${1}
mv resolv.conf.tmp "$mountpoint/etc/resolv.conf" teardown_mountpoint $mountpoint
umount -R $mountpoint umount -R $mountpoint
udevadm settle udevadm settle

@ -24,8 +24,4 @@ chroot binary/boot/filesystem.dir mkdir /lib/modules
chroot binary/boot/filesystem.dir rm /usr/sbin/grub-probe chroot binary/boot/filesystem.dir rm /usr/sbin/grub-probe
chroot binary/boot/filesystem.dir dpkg-divert --remove --local --rename /usr/sbin/grub-probe chroot binary/boot/filesystem.dir dpkg-divert --remove --local --rename /usr/sbin/grub-probe
mv resolv.conf.tmp "binary/boot/filesystem.dir/etc/resolv.conf" teardown_mountpoint binary/boot/filesystem.dir
umount "binary/boot/filesystem.dir/proc"
umount "binary/boot/filesystem.dir/sys"
umount -R "binary/boot/filesystem.dir/dev"
umount "binary/boot/filesystem.dir/tmp"

Loading…
Cancel
Save