| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 info "or you'll end up deleting $FLAGS_trunk too!" | 247 info "or you'll end up deleting $FLAGS_trunk too!" |
| 248 exit 0 | 248 exit 0 |
| 249 fi | 249 fi |
| 250 | 250 |
| 251 if [ $FLAGS_unmount -eq $FLAGS_TRUE ] | 251 if [ $FLAGS_unmount -eq $FLAGS_TRUE ] |
| 252 then | 252 then |
| 253 teardown_env | 253 teardown_env |
| 254 exit 0 | 254 exit 0 |
| 255 fi | 255 fi |
| 256 | 256 |
| 257 # Apply any hacks needed to update the chroot. |
| 258 chroot_hacks_from_outside "${FLAGS_chroot}" |
| 259 |
| 260 |
| 257 # Make sure we unmount before exiting | 261 # Make sure we unmount before exiting |
| 258 trap teardown_env EXIT | 262 trap teardown_env EXIT |
| 259 setup_env | 263 setup_env |
| 260 | 264 |
| 261 # Get the git revision to pass into the chroot. | 265 # Get the git revision to pass into the chroot. |
| 262 # | 266 # |
| 263 # This must be determined outside the chroot because (1) there is no | 267 # This must be determined outside the chroot because (1) there is no |
| 264 # git inside the chroot, and (2) if there were it would likely be | 268 # git inside the chroot, and (2) if there were it would likely be |
| 265 # the wrong version, which would mess up the .git directories. | 269 # the wrong version, which would mess up the .git directories. |
| 266 # | 270 # |
| (...skipping 27 matching lines...) Expand all Loading... |
| 294 # Run command or interactive shell. Also include the non-chrooted path to | 298 # Run command or interactive shell. Also include the non-chrooted path to |
| 295 # the source trunk for scripts that may need to print it (e.g. | 299 # the source trunk for scripts that may need to print it (e.g. |
| 296 # build_image.sh). | 300 # build_image.sh). |
| 297 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 301 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
| 298 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ | 302 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ |
| 299 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" -- "$@" | 303 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" -- "$@" |
| 300 | 304 |
| 301 # Remove trap and explicitly unmount | 305 # Remove trap and explicitly unmount |
| 302 trap - EXIT | 306 trap - EXIT |
| 303 teardown_env | 307 teardown_env |
| OLD | NEW |