OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 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 |
11 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's | 11 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
12 # location. | 12 # location. |
13 find_common_sh() { | 13 find_common_sh() { |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 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 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ | |
358 CHROMEOS_VERSION_TRACK=$CHROMEOS_VERSION_TRACK CHROMEOS_VERSION_AUSERVER=$CHROME
OS_VERSION_AUSERVER CHROMEOS_VERSION_DEVSERVER=$CHROMEOS_VERSION_DEVSERVER" | |
359 | 357 |
360 if [ -d "$HOME/.subversion" ]; then | 358 if [ -d "$HOME/.subversion" ]; then |
361 TARGET="/home/${USER}/.subversion" | 359 TARGET="/home/${USER}/.subversion" |
362 mkdir -p "${FLAGS_chroot}${TARGET}" | 360 mkdir -p "${FLAGS_chroot}${TARGET}" |
363 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}" | 361 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}" |
364 fi | 362 fi |
365 | 363 |
366 # Configure committer username and email in chroot .gitconfig | 364 # Configure committer username and email in chroot .gitconfig |
367 if [ $FLAGS_git_config -eq $FLAGS_TRUE ]; then | 365 if [ $FLAGS_git_config -eq $FLAGS_TRUE ]; then |
368 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ | 366 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ |
369 user.name "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" | 367 user.name "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" |
370 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ | 368 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ |
371 user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \ | 369 user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \ |
372 sed -e 's/.*<\([^>]*\)>.*/\1/')" | 370 sed -e 's/.*<\([^>]*\)>.*/\1/')" |
373 fi | 371 fi |
374 | 372 |
375 # Run command or interactive shell. Also include the non-chrooted path to | 373 # Run command or interactive shell. Also include the non-chrooted path to |
376 # the source trunk for scripts that may need to print it (e.g. | 374 # the source trunk for scripts that may need to print it (e.g. |
377 # build_image.sh). | 375 # build_image.sh). |
378 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 376 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
379 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ | 377 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ |
380 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" | 378 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" |
381 | 379 |
382 # Remove trap and explicitly unmount | 380 # Remove trap and explicitly unmount |
383 trap - EXIT | 381 trap - EXIT |
384 teardown_env | 382 teardown_env |
OLD | NEW |