Allow creating chroots on a loopback device.
If the new --useimage flag is passed, instead of creating the chroot
inside a directory, create a loopback device containing an LVM thin LV
and mount it onto the chroot. This will enable a subsequent CL to set
up snapshots of the chroot state.
BUG=chromium:730144
TEST=Created/deleted/replaced a bunch of chroots with cros_sdk and a
local cbuildbot.
Change-Id: Ia79a944d2848c3e1ed00346b389b9f66fd5be4b7
Reviewed-on: https://chromium-review.googlesource.com/553404
Commit-Ready: Benjamin Gordon <bmgordon@chromium.org>
Tested-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Benjamin Gordon <bmgordon@chromium.org>
diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh
index 19bfe1d..f573700 100755
--- a/sdk_lib/enter_chroot.sh
+++ b/sdk_lib/enter_chroot.sh
@@ -281,6 +281,10 @@
debug "Mounting chroot environment."
mount --make-rslave /
+ if grep -q -e "${FLAGS_chroot}[[:space:]]" /proc/mounts; then
+ debug "Changing $FLAGS_chroot to a private subtree."
+ mount --make-private "$FLAGS_chroot"
+ fi
MOUNT_CACHE=$(echo $(awk '{print $2}' /proc/mounts))
setup_mount none "-t proc" /proc
setup_mount none "-t sysfs" /sys