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