| 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 # --- 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 # Apply any hacks needed to update the chroot. | 345 # Apply any hacks needed to update the chroot. |
| 346 chroot_hacks_from_outside "${FLAGS_chroot}" | 346 chroot_hacks_from_outside "${FLAGS_chroot}" |
| 347 chroot_hacks_too | 347 chroot_hacks_too |
| 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 # Get the git revision to pass into the chroot. | 354 CHROOT_PASSTHRU="BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_
OFFICIAL" |
| 355 # | |
| 356 # This must be determined outside the chroot because (1) there is no | |
| 357 # git inside the chroot, and (2) if there were it would likely be | |
| 358 # the wrong version, which would mess up the .git directories. | |
| 359 # | |
| 360 # Note that this fixes $CHROMEOS_REVISION at the time the chroot is | |
| 361 # entered. That's ok for the main use case of automated builds, | |
| 362 # which pass each command line into a separate call to enter_chroot | |
| 363 # so always have up-to-date info. For developer builds, there may not | |
| 364 # be a single revision, since the developer may have | |
| 365 # hand-sync'd some subdirs and edited files in others. | |
| 366 # In that case, check against origin/HEAD and mark** revision. | |
| 367 # Use git:8 chars of sha1 | |
| 368 REVISION=$(cd ${FLAGS_trunk}/src/scripts ; git rev-parse --short=8 HEAD) | |
| 369 CHROOT_PASSTHRU="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number
CHROMEOS_OFFICIAL=$CHROMEOS_OFFICIAL" | |
| 370 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ | 355 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ |
| 371 CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-"{DEV-BUILD}"}" | 356 CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-"{DEV-BUILD}"}" |
| 372 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ | 357 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ |
| 373 CHROMEOS_VERSION_TRACK=$CHROMEOS_VERSION_TRACK CHROMEOS_VERSION_AUSERVER=$CHROME
OS_VERSION_AUSERVER CHROMEOS_VERSION_DEVSERVER=$CHROMEOS_VERSION_DEVSERVER" | 358 CHROMEOS_VERSION_TRACK=$CHROMEOS_VERSION_TRACK CHROMEOS_VERSION_AUSERVER=$CHROME
OS_VERSION_AUSERVER CHROMEOS_VERSION_DEVSERVER=$CHROMEOS_VERSION_DEVSERVER" |
| 374 | 359 |
| 375 if [ -d "$HOME/.subversion" ]; then | 360 if [ -d "$HOME/.subversion" ]; then |
| 376 TARGET="/home/${USER}/.subversion" | 361 TARGET="/home/${USER}/.subversion" |
| 377 mkdir -p "${FLAGS_chroot}${TARGET}" | 362 mkdir -p "${FLAGS_chroot}${TARGET}" |
| 378 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}" | 363 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}" |
| 379 fi | 364 fi |
| (...skipping 10 matching lines...) Expand all Loading... |
| 390 # Run command or interactive shell. Also include the non-chrooted path to | 375 # Run command or interactive shell. Also include the non-chrooted path to |
| 391 # the source trunk for scripts that may need to print it (e.g. | 376 # the source trunk for scripts that may need to print it (e.g. |
| 392 # build_image.sh). | 377 # build_image.sh). |
| 393 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 378 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
| 394 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ | 379 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ |
| 395 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" | 380 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" |
| 396 | 381 |
| 397 # Remove trap and explicitly unmount | 382 # Remove trap and explicitly unmount |
| 398 trap - EXIT | 383 trap - EXIT |
| 399 teardown_env | 384 teardown_env |
| OLD | NEW |