OLD | NEW |
---|---|
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. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 fi | 115 fi |
116 fi | 116 fi |
117 | 117 |
118 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}${INNER_DEPOT_TOOLS_ROOT}")" | 118 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}${INNER_DEPOT_TOOLS_ROOT}")" |
119 if [ -z "$(mount | grep -F "on $MOUNTED_PATH")" ] | 119 if [ -z "$(mount | grep -F "on $MOUNTED_PATH")" ] |
120 then | 120 then |
121 if [ $(which gclient 2>/dev/null) ]; then | 121 if [ $(which gclient 2>/dev/null) ]; then |
122 echo "Mounting depot_tools" | 122 echo "Mounting depot_tools" |
123 DEPOT_TOOLS=$(dirname $(which gclient) ) | 123 DEPOT_TOOLS=$(dirname $(which gclient) ) |
124 mkdir -p "$MOUNTED_PATH" | 124 mkdir -p "$MOUNTED_PATH" |
125 sudo mount --bind "$DEPOT_TOOLS" "$MOUNTED_PATH" | 125 if ! sudo mount --bind "$DEPOT_TOOLS" "$MOUNTED_PATH"; then |
126 echo "depot_tools failed to mount. This may impact chromium build" | |
Alexey Marinichev
2010/02/16 22:13:17
Maybe we could add something like "check your NFS
| |
127 fi | |
126 fi | 128 fi |
127 fi | 129 fi |
128 ) 200>>"$LOCKFILE" | 130 ) 200>>"$LOCKFILE" |
129 } | 131 } |
130 | 132 |
131 function teardown_env { | 133 function teardown_env { |
132 # Only teardown if we're the last enter_chroot to die | 134 # Only teardown if we're the last enter_chroot to die |
133 | 135 |
134 ( | 136 ( |
135 flock 200 | 137 flock 200 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 | 217 |
216 # Run command or interactive shell. Also include the non-chrooted path to | 218 # Run command or interactive shell. Also include the non-chrooted path to |
217 # the source trunk for scripts that may need to print it (e.g. | 219 # the source trunk for scripts that may need to print it (e.g. |
218 # build_image.sh). | 220 # build_image.sh). |
219 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 221 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
220 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@" | 222 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C "$@" |
221 | 223 |
222 # Remove trap and explicitly unmount | 224 # Remove trap and explicitly unmount |
223 trap - EXIT | 225 trap - EXIT |
224 teardown_env | 226 teardown_env |
OLD | NEW |