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 # Load common constants. This should be the first executable line. | 9 # Load common constants. This should be the first executable line. |
10 # The path to common.sh should be relative to your script's location. | 10 # The path to common.sh should be relative to your script's location. |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 # Bind mounting .subversion into chroot | 278 # Bind mounting .subversion into chroot |
279 info "mounting ~/.subversion into chroot" | 279 info "mounting ~/.subversion into chroot" |
280 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/home/${USER}/.subversion")" | 280 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/home/${USER}/.subversion")" |
281 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]; then | 281 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]; then |
282 mkdir -p "$MOUNTED_PATH" | 282 mkdir -p "$MOUNTED_PATH" |
283 sudo mount --bind "$HOME/.subversion" "$MOUNTED_PATH" || \ | 283 sudo mount --bind "$HOME/.subversion" "$MOUNTED_PATH" || \ |
284 die "Could not mount $MOUNTED_PATH" | 284 die "Could not mount $MOUNTED_PATH" |
285 fi | 285 fi |
286 fi | 286 fi |
287 | 287 |
| 288 # Configure committer username and email in chroot .gitconfig |
| 289 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.name \ |
| 290 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" |
| 291 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.email \ |
| 292 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/.*<\([^>]*\)>.*/\1/')" |
| 293 |
288 # Run command or interactive shell. Also include the non-chrooted path to | 294 # Run command or interactive shell. Also include the non-chrooted path to |
289 # the source trunk for scripts that may need to print it (e.g. | 295 # the source trunk for scripts that may need to print it (e.g. |
290 # build_image.sh). | 296 # build_image.sh). |
291 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 297 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
292 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ | 298 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ |
293 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" -- "$@" | 299 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" -- "$@" |
294 | 300 |
295 # Remove trap and explicitly unmount | 301 # Remove trap and explicitly unmount |
296 trap - EXIT | 302 trap - EXIT |
297 teardown_env | 303 teardown_env |
OLD | NEW |