cros_sdk: handle mounting of common paths
This moves the logic out of make_chroot.sh. There's more mounts
to do still, but these are the easiest & common ones first.
BUG=b:191307774
TEST=`cros_sdk` still works
Change-Id: I1c9232b3b5e0f7ecf8b01207ac654209569dc716
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2994724
Reviewed-by: Alex Klein <saklein@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index c39f06d..49db71c 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -1156,6 +1156,7 @@
sdk_tarball = FetchRemoteTarballs(
sdk_cache, urls, 'stage3' if options.bootstrap else 'SDK')
+ mounted = False
if options.create:
lock.write_lock()
# Recheck if the chroot is set up here before creating to make sure we
@@ -1169,9 +1170,12 @@
Path(sdk_tarball),
Path(options.cache_dir),
usepkg=not options.bootstrap and not options.nousepkg)
+ mounted = True
if options.enter:
lock.read_lock()
+ if not mounted:
+ cros_sdk_lib.MountChrootPaths(options.chroot)
EnterChroot(options.chroot, options.cache_dir, options.chrome_root,
options.chrome_root_mount, options.goma_dir,
options.goma_client_json, options.working_dir,