Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: enter_chroot.sh

Issue 6693001: Ignore git config errors that may occur in enter_chroot. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bin/au_test_harness/cros_au_test_harness.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 "The destination dir for the chroot environment." "d" 37 "The destination dir for the chroot environment." "d"
38 DEFINE_string trunk "$GCLIENT_ROOT" \ 38 DEFINE_string trunk "$GCLIENT_ROOT" \
39 "The source trunk to bind mount within the chroot." "s" 39 "The source trunk to bind mount within the chroot." "s"
40 DEFINE_string build_number "" \ 40 DEFINE_string build_number "" \
41 "The build-bot build number (when called by buildbot only)." "b" 41 "The build-bot build number (when called by buildbot only)." "b"
42 DEFINE_string chrome_root "" \ 42 DEFINE_string chrome_root "" \
43 "The root of your chrome browser source. Should contain a 'src' subdir." 43 "The root of your chrome browser source. Should contain a 'src' subdir."
44 DEFINE_string chrome_root_mount "/home/$USER/chrome_root" \ 44 DEFINE_string chrome_root_mount "/home/$USER/chrome_root" \
45 "The mount point of the chrome broswer source in the chroot." 45 "The mount point of the chrome broswer source in the chroot."
46 46
47 DEFINE_boolean git_config $FLAGS_TRUE \
48 "Config git to work with your user/pass in the chroot."
49 DEFINE_boolean official_build $FLAGS_FALSE \ 47 DEFINE_boolean official_build $FLAGS_FALSE \
50 "Set CHROMEOS_OFFICIAL=1 for release builds." 48 "Set CHROMEOS_OFFICIAL=1 for release builds."
51 DEFINE_boolean mount $FLAGS_FALSE "Only set up mounts." 49 DEFINE_boolean mount $FLAGS_FALSE "Only set up mounts."
52 DEFINE_boolean unmount $FLAGS_FALSE "Only tear down mounts." 50 DEFINE_boolean unmount $FLAGS_FALSE "Only tear down mounts."
53 DEFINE_boolean ssh_agent $FLAGS_TRUE "Import ssh agent." 51 DEFINE_boolean ssh_agent $FLAGS_TRUE "Import ssh agent."
54 DEFINE_boolean verbose $FLAGS_FALSE "Print out actions taken" 52 DEFINE_boolean verbose $FLAGS_FALSE "Print out actions taken"
55 53
56 # More useful help 54 # More useful help
57 FLAGS_HELP="USAGE: $0 [flags] [VAR=value] [-- command [arg1] [arg2] ...] 55 FLAGS_HELP="USAGE: $0 [flags] [VAR=value] [-- command [arg1] [arg2] ...]
58 56
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ 353 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \
356 CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-"{DEV-BUILD}"}" 354 CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-"{DEV-BUILD}"}"
357 355
358 if [ -d "$HOME/.subversion" ]; then 356 if [ -d "$HOME/.subversion" ]; then
359 TARGET="/home/${USER}/.subversion" 357 TARGET="/home/${USER}/.subversion"
360 mkdir -p "${FLAGS_chroot}${TARGET}" 358 mkdir -p "${FLAGS_chroot}${TARGET}"
361 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}" 359 ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}"
362 fi 360 fi
363 361
364 # Configure committer username and email in chroot .gitconfig 362 # Configure committer username and email in chroot .gitconfig
365 if [ $FLAGS_git_config -eq $FLAGS_TRUE ]; then 363 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \
366 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ 364 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/ *<.*//')" 365 true
368 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \ 366 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \
369 user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \ 367 user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \
370 sed -e 's/.*<\([^>]*\)>.*/\1/')" 368 sed -e 's/.*<\([^>]*\)>.*/\1/')" ||
371 fi 369 true
372 370
373 # Run command or interactive shell. Also include the non-chrooted path to 371 # 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. 372 # the source trunk for scripts that may need to print it (e.g.
375 # build_image.sh). 373 # build_image.sh).
376 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ 374 sudo -- chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \
377 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ 375 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \
378 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@" 376 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" "$@"
379 377
380 # Remove trap and explicitly unmount 378 # Remove trap and explicitly unmount
381 trap - EXIT 379 trap - EXIT
382 teardown_env 380 teardown_env
OLDNEW
« no previous file with comments | « bin/au_test_harness/cros_au_test_harness.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698