This fix separates out any additional command line arguments given to
the enter_chroot.sh script when passed to the interior chroot. This
allows one to pass environment variable settings to the interior
chroot shell such as:
./enter_chroot.sh -- CHROME_ORIGIN=LOCAL_SOURCE emerge-x86-generic ...
Before this fix any of these variable settings will be sucked up by
the shell launching the chroot, not the interior shell.
BUG=chromium-os:2457
TEST=ran test cases detailed in bug report
Review URL: http://codereview.chromium.org/2855034
* This also adds reverse sort into the umount list, because of cascading mounts, so that /foo/anything is always before /foo, and as such is always unmounted first. If the list were not sorted, "mount point busy" errors might occur, depending on various conditions.
TEST=
1) With a previously created chroot, I ran enter_chroot.sh, and got the correct prompt. After logging out of that prompt, everything else was correctly unmounted, without any error messages. When entering chroot twice from two different shells, everything was correctly unmounted after the last shell exited.
2) Repeat 1 but with cleanly created chroot just for this purpose.
3) In the chroot, make packages for one board (x86-generic) using build_packages
4) The messages "openpty failed: 'out of pty devices'" whenever trying to emerge anything (or other commands looking up pts) have disappeared.
Review URL: http://codereview.chromium.org/2714010
Added chrome_root_mount option to specify the mount point to work around a permissions issue.
BUG=3464
TEST=none
Review URL: http://codereview.chromium.org/2126011
Unfortunately, bind mounting /media inside the chroot did not allow us
to programmatically unmount automounted USB sticks from within the chroot.
Instead, I disable automounting on our corporate desktops when you enter the
chroot. Your normal setting is restored when you exit the chroot again.
TEST=run gconftool-2 -g /apps/nautilus/preferences/media_automount to print the current value of your automount pref; run this before entering the chroot, outside the chroot while you've got some other terminal that's inside the chroot, and then after exiting the chroot.
Review URL: http://codereview.chromium.org/2029009
Talked to kmixter, and we felt that bindmounting the directory in
which the host os creates mount points for automounted external
devices is the cleanest solution to the inside/outside the chroot problem.
By doing this, image_to_usb can be run from inside the chroot without concern.
That means that (as far as I understand) the factory install flow can all be
done inside the chroot, as well as modding images for test and everything else.
Review URL: http://codereview.chromium.org/1991006
This is useful for various JTAG and fastboot based flashing of
targets. It is also useful in that we will now have access to
USB card readers and mass storage devices inside the chroot.
BUG=None
TEST=Enter and exit the chroot cleanly.
Review URL: http://codereview.chromium.org/1711016
The safe_unmount function first tries a regular unmount, If that
fails it warns and tries a lazy unmount. If the lazy unmount fails
it dies.
Both unmounts take the -d option in case the mount is a loop device.
BUG=None
TEST=Entered and exited multiple chroots
Review URL: http://codereview.chromium.org/1593021
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