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, CHROMEOS_VERSION_DEVSER VER | |
petkov
2011/03/14 21:05:07
80 chars.
Also, you might want to mention that th
| |
359 # as environment variables to override the default assumptions (local AU server) | |
petkov
2011/03/14 21:05:07
refer to cros_set_lsb_release here.
| |
360 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ | |
361 CHROMEOS_VERSION_TRACK=${CHROMEOS_VERSION_TRACK} \ | |
362 CHROMEOS_VERSION_AUSERVER=${CHROMEOS_VERSION_AUSERVER} \ | |
363 CHROMEOS_VERSION_DEVSERVER=${CHROMEOS_VERSION_DEVSERVER}" | |
364 | |
358 if [ -d "$HOME/.subversion" ]; then | 365 if [ -d "$HOME/.subversion" ]; then |
359 TARGET="/home/${USER}/.subversion" | 366 TARGET="/home/${USER}/.subversion" |
360 mkdir -p "${FLAGS_chroot}${TARGET}" | 367 mkdir -p "${FLAGS_chroot}${TARGET}" |
361 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}" | 368 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}" |
362 fi | 369 fi |
363 | 370 |
364 # Configure committer username and email in chroot .gitconfig | 371 # Configure committer username and email in chroot .gitconfig |
365 if [ $FLAGS_git_config -eq $FLAGS_TRUE ]; then | 372 if [ $FLAGS_git_config -eq $FLAGS_TRUE ]; then |
366 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ | 373 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ |
367 user.name "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" | 374 user.name "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" |
368 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ | 375 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ |
369 user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \ | 376 user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \ |
370 sed -e 's/.*<\([^>]*\)>.*/\1/')" | 377 sed -e 's/.*<\([^>]*\)>.*/\1/')" |
371 fi | 378 fi |
372 | 379 |
373 # Run command or interactive shell. Also include the non-chrooted path to | 380 # 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. | 381 # the source trunk for scripts that may need to print it (e.g. |
375 # build_image.sh). | 382 # build_image.sh). |
376 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 383 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
377 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ | 384 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ |
378 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" | 385 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" |
379 | 386 |
380 # Remove trap and explicitly unmount | 387 # Remove trap and explicitly unmount |
381 trap - EXIT | 388 trap - EXIT |
382 teardown_env | 389 teardown_env |
OLD | NEW |