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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 # Note that this fixes $CHROMEOS_REVISION at the time the chroot is | 271 # Note that this fixes $CHROMEOS_REVISION at the time the chroot is |
272 # entered. That's ok for the main use case of automated builds, | 272 # entered. That's ok for the main use case of automated builds, |
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 #Adding OEM AU IF if it exists$ | |
petkov
2010/11/17 01:01:12
Fix the comment.
Raja Aluri
2010/11/17 04:12:01
Done.
| |
282 if [ ! -n "$CHROMEOS_RELEASE_APPID" ]; then | |
283 CHROMEOS_RELEASE_APPID="{DEV-BUILD}" | |
284 fi | |
285 CHROOT_PASSTHRU="CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID} ${CHROOT_PASST HRU}" | |
David McMahon
2010/11/17 00:28:37
You can skip the test and default setting above an
Raja Aluri
2010/11/17 04:12:01
Done.
| |
286 | |
281 if [ -d "$HOME/.subversion" ]; then | 287 if [ -d "$HOME/.subversion" ]; then |
282 # Bind mounting .subversion into chroot | 288 # Bind mounting .subversion into chroot |
283 info "mounting ~/.subversion into chroot" | 289 info "mounting ~/.subversion into chroot" |
284 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/home/${USER}/.subversion")" | 290 MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}/home/${USER}/.subversion")" |
285 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]; then | 291 if [ -z "$(mount | grep -F "on $MOUNTED_PATH ")" ]; then |
286 mkdir -p "$MOUNTED_PATH" | 292 mkdir -p "$MOUNTED_PATH" |
287 sudo mount --bind "$HOME/.subversion" "$MOUNTED_PATH" || \ | 293 sudo mount --bind "$HOME/.subversion" "$MOUNTED_PATH" || \ |
288 die "Could not mount $MOUNTED_PATH" | 294 die "Could not mount $MOUNTED_PATH" |
289 fi | 295 fi |
290 fi | 296 fi |
291 | 297 |
292 # Configure committer username and email in chroot .gitconfig | 298 # Configure committer username and email in chroot .gitconfig |
293 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.name \ | 299 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.name \ |
294 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" | 300 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/ *<.*//')" |
295 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.email \ | 301 git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all user.email \ |
296 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/.*<\([^>]*\)>.*/\1/')" | 302 "$(cd /tmp; git var GIT_COMMITTER_IDENT | sed -e 's/.*<\([^>]*\)>.*/\1/')" |
297 | 303 |
298 # Run command or interactive shell. Also include the non-chrooted path to | 304 # Run command or interactive shell. Also include the non-chrooted path to |
299 # the source trunk for scripts that may need to print it (e.g. | 305 # the source trunk for scripts that may need to print it (e.g. |
300 # build_image.sh). | 306 # build_image.sh). |
301 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ | 307 sudo chroot "$FLAGS_chroot" sudo -i -u $USER $CHROOT_PASSTHRU \ |
302 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ | 308 EXTERNAL_TRUNK_PATH="${FLAGS_trunk}" LANG=C SSH_AGENT_PID="${SSH_AGENT_PID}" \ |
303 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" -- "$@" | 309 SSH_AUTH_SOCK="${SSH_AUTH_SOCK}" -- "$@" |
304 | 310 |
305 # Remove trap and explicitly unmount | 311 # Remove trap and explicitly unmount |
306 trap - EXIT | 312 trap - EXIT |
307 teardown_env | 313 teardown_env |
OLD | NEW |