That way we can directly build an image onto a usb stick/sd card without a separate step.
Also, add mounting of /sys into the chroot that is needed by build_gpt on a block device.
Review URL: http://codereview.chromium.org/1521012
This is necessary for two reasons:
1) It's nice to get an error message when mount/unmount fails
2) set -e mode doesn't have any effect when you're in a subshell
Note that these mount/unmount failures do happen regularly in development,
so folks who depended on mount/umount failing silently will no longer be
able to rely on this and will have to kill the mounts manually.
Also fix subtle bugs in regexes for matching mount paths. (E.g. where the
regex for $HOME/chroot also matches $HOME/chroot2).
TEST=Tested mount/unmount with concurrently open shells.
Tested mount/unmount when mount is being used by a process but the
lock file does not reflect this.
BUG=none
Review URL: http://codereview.chromium.org/1211001
Another CL is coming to automatically add depot_tools to the PATH
inside the chroot. It's in a different repo.
Review URL: http://codereview.chromium.org/605016
If one passes --chrome_root=.../path/to/chrome_root/outside/chroot to
enter_chroot.sh once, enter_chroot will make a note inside the croot
and mount it on all subsequent calls to enter_chroot, even if the
argument is not passed again. If ever enter_chroot can't find the
proper dir, it deletes any stored note.
chrome_root must contain a "src" subdirectory.
Review URL: http://codereview.chromium.org/596102
Change enter_chroot.sh to keep a list of open PIDs (enter_chroot.sh
instances) in chroot/var/lock, and use flock on that file to support
atomic operations to it.
When entering chroot, append the PID to the lock file.
When exiting chroot, clear out current PID and any dead
PIDs/duplicates. If the lock file is empty, only then clean up the
mounts.
Note that I have a little bit of code duplication: the number 200,
which is a manually numbered fd in bash, seemed impossible to place
inside a variable. If you know how to do it, please let me know.
Review URL: http://codereview.chromium.org/584010
Set LANG=C also when providing a command to enter_chroot.sh. Should make
buildbot logs quite a bit shorter.
Review URL: http://codereview.chromium.org/521053