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

Side by Side Diff: enter_chroot.sh

Issue 5760004: Added option to set ChromeOS version name, track and AU/dev server URLs via environment variables (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Removed echo in CHROOT_PASSTHRU change that shouldn't have been there Created 10 years 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 | « chromeos_version.sh ('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) 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 # which pass each command line into a separate call to enter_chroot 273 # which pass each command line into a separate call to enter_chroot
274 # so always have up-to-date info. For developer builds, there may not 274 # so always have up-to-date info. For developer builds, there may not
275 # be a single revision, since the developer may have 275 # be a single revision, since the developer may have
276 # hand-sync'd some subdirs and edited files in others. 276 # hand-sync'd some subdirs and edited files in others.
277 # In that case, check against origin/HEAD and mark** revision. 277 # In that case, check against origin/HEAD and mark** revision.
278 # Use git:8 chars of sha1 278 # Use git:8 chars of sha1
279 REVISION=$(cd ${FLAGS_trunk}/src/scripts ; git rev-parse --short=8 HEAD) 279 REVISION=$(cd ${FLAGS_trunk}/src/scripts ; git rev-parse --short=8 HEAD)
280 CHROOT_PASSTHRU="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_OFFICIAL" 280 CHROOT_PASSTHRU="CHROMEOS_REVISION=$REVISION BUILDBOT_BUILD=$FLAGS_build_number CHROMEOS_OFFICIAL=$CHROMEOS_OFFICIAL"
281 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \ 281 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \
282 CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-"{DEV-BUILD}"}" 282 CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-"{DEV-BUILD}"}"
283 CHROOT_PASSTHRU="${CHROOT_PASSTHRU} \
284 CHROMEOS_VERSION_TRACK=$CHROMEOS_VERSION_TRACK CHROMEOS_VERSION_AUSERVER=$CHROME OS_VERSION_AUSERVER CHROMEOS_VERSION_DEVSERVER=$CHROMEOS_VERSION_DEVSERVER"
283 285
284 if [ -d "$HOME/.subversion" ]; then 286 if [ -d "$HOME/.subversion" ]; then
285 # Bind mounting .subversion into chroot 287 # Bind mounting .subversion into chroot
286 info "mounting ~/.subversion into chroot" 288 info "mounting ~/.subversion into chroot"
287 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/home/${USER}/.subversion")" 289 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/home/${USER}/.subversion")"
288 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]; then 290 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]; then
289 mkdir -p "$MOUNTED_PATH" 291 mkdir -p "$MOUNTED_PATH"
290 sudo mount --bind "$HOME/.subversion" "$MOUNTED_PATH" || \ 292 sudo mount --bind "$HOME/.subversion" "$MOUNTED_PATH" || \
291 die "Could not mount $MOUNTED_PATH" 293 die "Could not mount $MOUNTED_PATH"
292 fi 294 fi
293 fi 295 fi
294 296
295 # Configure committer username and email in chroot .gitconfig 297 # Configure committer username and email in chroot .gitconfig
296 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.name \ 298 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.name \
297 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" 299 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')"
298 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.email \ 300 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.email \
299 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/.*<\([^>]*\)>.*/\1/')" 301 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/.*<\([^>]*\)>.*/\1/')"
300 302
301 # Run command or interactive shell. Also include the non-chrooted path to 303 # Run command or interactive shell. Also include the non-chrooted path to
302 # the source trunk for scripts that may need to print it (e.g. 304 # the source trunk for scripts that may need to print it (e.g.
303 # build_image.sh). 305 # build_image.sh).
304 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ 306 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \
305 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ 307 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \
306 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" -- "$@" 308 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" -- "$@"
307 309
308 # Remove trap and explicitly unmount 310 # Remove trap and explicitly unmount
309 trap - EXIT 311 trap - EXIT
310 teardown_env 312 teardown_env
OLDNEW
« no previous file with comments | « chromeos_version.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698