Commit Graph

29 Commits

Author SHA1 Message Date
Allen Martin
07bfc7aa9d Separate out additional cmd line args to chroot
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
2010-07-13 15:44:59 -07:00
Zdenek Behan
6f17b5e5fe enter_chroot: when preparing chroot, mount devpts filesystem as well
* 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
2010-06-10 16:50:52 -07:00
Anush Elangovan
587d7498a1 Use git rev-parse --short=8 to get rev
Change-Id: I842fd7c76597a3cadacdfaa3de6b61fa7cb87703

Review URL: http://codereview.chromium.org/2762011
2010-06-10 15:39:19 -07:00
Sean Parent
2898f75335 ACCESS DENIED workaround
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
2010-05-25 15:06:33 -07:00
Chris Masone
162f654c95 disable automounting when inside the chroot
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
2010-05-12 14:58:37 -07:00
Chris Masone
99c6a289f4 add the ability to umount automounted devices from within the chroot
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
2010-05-11 09:20:00 -07:00
robotboy
152a1ab50d Add a bind mount of /dev to the chroot.
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
2010-04-26 14:07:27 -07:00
robotboy
9891221b6e Add a safe_unmount function and use it in enter_chroot.
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
2010-04-12 14:08:14 -07:00
Chris Sosa
317d8eb3fd Better handling of fuse in chroot
Review URL: http://codereview.chromium.org/1582011
2010-04-05 15:45:28 -07:00
Chris Sosa
c7b65a46b4 TBR: Forgot quote 2010-04-02 14:17:55 -07:00
Chris Sosa
6bc771a50b TBR: Sorry fix for build again 2010-04-02 14:15:53 -07:00
Chris Sosa
7138f0a79b TBR:Fix build. Shouldn't do fuse stuff if fuse isn't installed on host 2010-04-02 14:12:05 -07:00
Chris Sosa
aa1a7fd63d Adds gmergefs. A method of remoting to a target and pushing new
packages using emerge from the host

Review URL: http://codereview.chromium.org/1515011
2010-04-02 14:06:29 -07:00
Antoine Labour
e9e585f330 Add a --to option to build_image
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
2010-04-01 15:57:57 -07:00
David James
546747b982 Update enter_chroot.sh to exit with error messages when mount/unmount fails.
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
2010-03-23 15:19:43 -07:00
Chris Sosa
9ef57d996b Enter chroot can return an error code on cleanup. We make cleanup best effort
Review URL: http://codereview.chromium.org/1158006
2010-03-23 11:15:45 -07:00
Andrew de los Reyes
e8b6315eee enter_chroot: allow depot_tools to fail to mount
Review URL: http://codereview.chromium.org/601082
2010-02-16 14:18:34 -08:00
Andrew de los Reyes
c1e8d2728f enter_choot: fix breakage some people ran into
Review URL: http://codereview.chromium.org/593102
2010-02-13 12:39:21 -08:00
Andrew de los Reyes
2832fe84e1 enter chroot: permit chrome_root to contain symlink
Review URL: http://codereview.chromium.org/596108
2010-02-12 23:47:01 -08:00
Andrew de los Reyes
5d0248feb8 enter_chroot: bind mount depot_tools if present outside chroot.
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
2010-02-12 16:12:31 -08:00
Andrew de los Reyes
6d0ca16277 Enter_chroot: Mount chrome browser source inside chroot.
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
2010-02-12 14:36:08 -08:00
Andrew de los Reyes
c9317eac02 Chroot: allow multiple simultaneous entry.
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
2010-02-10 13:16:36 -08:00
Colin Watson
3a3566b51f Reduce noise in buildbot logs
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
2010-01-07 07:36:32 +00:00
David McMahon
857dbb59c0 Add --official_build option, and skip checking HEAD against origin/HEAD for official builds.
Review URL: http://codereview.chromium.org/486002
2009-12-09 18:21:05 -08:00
David McMahon
03aeb20079 Revert versioning to original (odd=trunk/dev, even=release) style.
Add handling for third type - continuous builds and (label) appropriately.
2009-12-08 16:30:21 -08:00
derat@google.com
4e7a92bd48 build: Update build_image.sh for non-~/chromeos setups.
BUG=659

Review URL: http://codereview.chromium.org/431001

git-svn-id: svn://chrome-svn/chromeos/trunk@305 06c00378-0e64-4dae-be16-12b19f9950a1
2009-11-21 23:44:14 +00:00
derat@google.com
86dcc8e68b build: Make enter_chroot.sh fail if run as root.
BUG=684

Review URL: http://codereview.chromium.org/429006

git-svn-id: svn://chrome-svn/chromeos/trunk@304 06c00378-0e64-4dae-be16-12b19f9950a1
2009-11-21 19:49:49 +00:00
djmm@google.com
7ba1563d79 Use git for "revision" if svn is unavailable.
Review URL: http://chromereview.prom.corp.google.com/1186033

git-svn-id: svn://chrome-svn/chromeos/trunk@219 06c00378-0e64-4dae-be16-12b19f9950a1
2009-11-13 00:00:16 +00:00
rspangler@google.com
d74220d772 Start copying over source.
git-svn-id: svn://chrome-svn/chromeos/trunk@4 06c00378-0e64-4dae-be16-12b19f9950a1
2009-10-09 20:56:14 +00:00