Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: src/scripts/enter_chroot.sh

Issue 2126011: ACCESS DENIED workaround (Closed) Base URL: ssh://git@chromiumos-git/chromiumos.git
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to enter the chroot environment 7 # Script to enter the chroot environment
8 8
9 # Load common constants. This should be the first executable line. 9 # Load common constants. This should be the first executable line.
10 # The path to common.sh should be relative to your script's location. 10 # The path to common.sh should be relative to your script's location.
11 . "$(dirname "$0")/common.sh" 11 . "$(dirname "$0")/common.sh"
12 12
13 # Script must be run outside the chroot and as a regular user. 13 # Script must be run outside the chroot and as a regular user.
14 assert_outside_chroot 14 assert_outside_chroot
15 assert_not_root_user 15 assert_not_root_user
16 16
17 # Define command line flags 17 # Define command line flags
18 # See http://code.google.com/p/shflags/wiki/Documentation10x 18 # See http://code.google.com/p/shflags/wiki/Documentation10x
19 DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \ 19 DEFINE_string chroot "$DEFAULT_CHROOT_DIR" \
20 "The destination dir for the chroot environment." "d" 20 "The destination dir for the chroot environment." "d"
21 DEFINE_string trunk "$GCLIENT_ROOT" \ 21 DEFINE_string trunk "$GCLIENT_ROOT" \
22 "The source trunk to bind mount within the chroot." "s" 22 "The source trunk to bind mount within the chroot." "s"
23 DEFINE_string build_number "" \ 23 DEFINE_string build_number "" \
24 "The build-bot build number (when called by buildbot only)." "b" 24 "The build-bot build number (when called by buildbot only)." "b"
25 DEFINE_string chrome_root "" \ 25 DEFINE_string chrome_root "" \
26 "The root of your chrome browser source. Should contain a 'src' subdir." 26 "The root of your chrome browser source. Should contain a 'src' subdir."
27 DEFINE_string chrome_root_mount "/home/$USER/chrome_root" \
28 "The mount point of the chrome broswer source in the chroot."
27 29
28 DEFINE_boolean official_build $FLAGS_FALSE \ 30 DEFINE_boolean official_build $FLAGS_FALSE \
29 "Set CHROMEOS_OFFICIAL=1 for release builds." 31 "Set CHROMEOS_OFFICIAL=1 for release builds."
30 DEFINE_boolean mount $FLAGS_FALSE "Only set up mounts." 32 DEFINE_boolean mount $FLAGS_FALSE "Only set up mounts."
31 DEFINE_boolean unmount $FLAGS_FALSE "Only tear down mounts." 33 DEFINE_boolean unmount $FLAGS_FALSE "Only tear down mounts."
32 34
33 # More useful help 35 # More useful help
34 FLAGS_HELP="USAGE: $0 [flags] [VAR=value] [-- \"command\"] 36 FLAGS_HELP="USAGE: $0 [flags] [VAR=value] [-- \"command\"]
35 37
36 One or more VAR=value pairs can be specified to export variables into 38 One or more VAR=value pairs can be specified to export variables into
(...skipping 18 matching lines...) Expand all
55 if [ $FLAGS_official_build -eq $FLAGS_TRUE ] 57 if [ $FLAGS_official_build -eq $FLAGS_TRUE ]
56 then 58 then
57 CHROMEOS_OFFICIAL=1 59 CHROMEOS_OFFICIAL=1
58 fi 60 fi
59 61
60 # Only now can we die on error. shflags functions leak non-zero error codes, 62 # Only now can we die on error. shflags functions leak non-zero error codes,
61 # so will die prematurely if 'set -e' is specified before now. 63 # so will die prematurely if 'set -e' is specified before now.
62 # TODO: replace shflags with something less error-prone, or contribute a fix. 64 # TODO: replace shflags with something less error-prone, or contribute a fix.
63 set -e 65 set -e
64 66
65 INNER_CHROME_ROOT="/home/$USER/chrome_root" # inside chroot 67 INNER_CHROME_ROOT=$FLAGS_chrome_root_mount # inside chroot
66 CHROME_ROOT_CONFIG="/var/cache/chrome_root" # inside chroot 68 CHROME_ROOT_CONFIG="/var/cache/chrome_root" # inside chroot
67 INNER_DEPOT_TOOLS_ROOT="/home/$USER/depot_tools" # inside chroot 69 INNER_DEPOT_TOOLS_ROOT="/home/$USER/depot_tools" # inside chroot
68 FUSE_DEVICE="/dev/fuse" 70 FUSE_DEVICE="/dev/fuse"
69 AUTOMOUNT_PREF="/apps/nautilus/preferences/media_automount" 71 AUTOMOUNT_PREF="/apps/nautilus/preferences/media_automount"
70 SAVED_AUTOMOUNT_PREF_FILE="/tmp/.automount_pref" 72 SAVED_AUTOMOUNT_PREF_FILE="/tmp/.automount_pref"
71 73
72 sudo chmod 0777 "$FLAGS_chroot/var/lock" 74 sudo chmod 0777 "$FLAGS_chroot/var/lock"
73 75
74 LOCKFILE="$FLAGS_chroot/var/lock/enter_chroot" 76 LOCKFILE="$FLAGS_chroot/var/lock/enter_chroot"
75 77
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 263
262 # Run command or interactive shell. Also include the non-chrooted path to 264 # Run command or interactive shell. Also include the non-chrooted path to
263 # the source trunk for scripts that may need to print it (e.g. 265 # the source trunk for scripts that may need to print it (e.g.
264 # build_image.sh). 266 # build_image.sh).
265 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ 267 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \
266 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@" 268 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@"
267 269
268 # Remove trap and explicitly unmount 270 # Remove trap and explicitly unmount
269 trap - EXIT 271 trap - EXIT
270 teardown_env 272 teardown_env
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698