support installing Chromium OS chroot in another chroot
The detection of whether we are inside the Chromium OS build chroot is
making a false positive when run inside Crouton which is itself a
Ubuntu chroot.
Let's filter out all Debian derivative chroot and check only for a
genuine Chromium OS chroot.
BUG=none
TEST=on Pixel in dev mode, run cros_sdk in the Crouton chroot.
CQ-DEPEND=I3c143e85c141e2def038fb859c90bea7003fc875
Change-Id: I723fc57805d3891d00a111547f9aaa33231aa9ea
Reviewed-on: https://chromium-review.googlesource.com/188071
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index 2ce8af9..d1dd6a3 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -345,6 +345,7 @@
CROSSDEV_OVERLAY="${OVERLAYS_ROOT}/crossdev"
CHROOT_OVERLAY="${OVERLAYS_ROOT}/chromiumos"
CHROOT_STATE="${FLAGS_chroot}/etc/debian_chroot"
+CHROOT_VERSION="${FLAGS_chroot}/etc/cros_chroot_version"
# Pass proxy variables into the environment.
for type in http ftp all; do
@@ -390,6 +391,12 @@
rm -f "$FLAGS_chroot/etc/"make.{globals,conf.user}
fi
+# Ensure that we properly detect when we are inside the chroot.
+# We'll force this to the latest version at the end as needed.
+if [[ ! -e ${CHROOT_VERSION} ]]; then
+ echo "0" > "${CHROOT_VERSION}"
+fi
+
# Set up users, if needed, before mkdir/mounts below.
[ -f $CHROOT_STATE ] || init_users