| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2011 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 # --- BEGIN COMMON.SH BOILERPLATE --- | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
| 10 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 | 349 |
| 350 # Make sure we unmount before exiting | 350 # Make sure we unmount before exiting |
| 351 trap teardown_env EXIT | 351 trap teardown_env EXIT |
| 352 setup_env | 352 setup_env |
| 353 | 353 |
| 354 CHROOT_PASSTHRU="BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_
OFFICIAL" | 354 CHROOT_PASSTHRU="BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_
OFFICIAL" |
| 355 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ | 355 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ |
| 356 CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-"{DEV-BUILD}"}" | 356 CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-"{DEV-BUILD}"}" |
| 357 | 357 |
| 358 # Set CHROMEOS_VERSION_TRACK, CHROMEOS_VERSION_AUSERVER, |
| 359 # CHROMEOS_VERSION_DEVSERVER as environment variables to override the default |
| 360 # assumptions (local AU server). These are used in cros_set_lsb_release, and |
| 361 # are used by external Chromium OS builders. |
| 362 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ |
| 363 CHROMEOS_VERSION_TRACK=${CHROMEOS_VERSION_TRACK} \ |
| 364 CHROMEOS_VERSION_AUSERVER=${CHROMEOS_VERSION_AUSERVER} \ |
| 365 CHROMEOS_VERSION_DEVSERVER=${CHROMEOS_VERSION_DEVSERVER}" |
| 366 |
| 358 if [ -d "$HOME/.subversion" ]; then | 367 if [ -d "$HOME/.subversion" ]; then |
| 359 TARGET="/home/${USER}/.subversion" | 368 TARGET="/home/${USER}/.subversion" |
| 360 mkdir -p "${FLAGS_chroot}${TARGET}" | 369 mkdir -p "${FLAGS_chroot}${TARGET}" |
| 361 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}" | 370 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}" |
| 362 fi | 371 fi |
| 363 | 372 |
| 364 # Configure committer username and email in chroot .gitconfig | 373 # Configure committer username and email in chroot .gitconfig |
| 365 if [ $FLAGS_git_config -eq $FLAGS_TRUE ]; then | 374 if [ $FLAGS_git_config -eq $FLAGS_TRUE ]; then |
| 366 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ | 375 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ |
| 367 user.name "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" | 376 user.name "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" |
| 368 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ | 377 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ |
| 369 user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \ | 378 user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \ |
| 370 sed -e 's/.*<\([^>]*\)>.*/\1/')" | 379 sed -e 's/.*<\([^>]*\)>.*/\1/')" |
| 371 fi | 380 fi |
| 372 | 381 |
| 373 # Run command or interactive shell. Also include the non-chrooted path to | 382 # Run command or interactive shell. Also include the non-chrooted path to |
| 374 # the source trunk for scripts that may need to print it (e.g. | 383 # the source trunk for scripts that may need to print it (e.g. |
| 375 # build_image.sh). | 384 # build_image.sh). |
| 376 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 385 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
| 377 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ | 386 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ |
| 378 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" | 387 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" |
| 379 | 388 |
| 380 # Remove trap and explicitly unmount | 389 # Remove trap and explicitly unmount |
| 381 trap - EXIT | 390 trap - EXIT |
| 382 teardown_env | 391 teardown_env |
| OLD | NEW |