OLD | NEW |
---|---|
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Common constants for build scripts | 5 # Common constants for build scripts |
6 # This must evaluate properly for both /bin/bash and /bin/sh | 6 # This must evaluate properly for both /bin/bash and /bin/sh |
7 | 7 |
8 # All scripts should die on error unless commands are specifically excepted | 8 # All scripts should die on error unless commands are specifically excepted |
9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. | 9 # by prefixing with '!' or surrounded by 'set +e' / 'set -e'. |
10 # TODO: Re-enable this once shflags is less prone to dying. | 10 # TODO: Re-enable this once shflags is less prone to dying. |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 # ${1} specifies the location of the chroot. | 562 # ${1} specifies the location of the chroot. |
563 chroot_hacks_from_outside() { | 563 chroot_hacks_from_outside() { |
564 # Give args better names. | 564 # Give args better names. |
565 local chroot_dir=$1 | 565 local chroot_dir=$1 |
566 | 566 |
567 # Add root as a sudoer if not already done. | 567 # Add root as a sudoer if not already done. |
568 if ! sudo grep -q '^root ALL=(ALL) ALL$' "${chroot_dir}/etc/sudoers" ; then | 568 if ! sudo grep -q '^root ALL=(ALL) ALL$' "${chroot_dir}/etc/sudoers" ; then |
569 info "Upgrading old chroot (pre 2010-10-19) - adding root to sudoers" | 569 info "Upgrading old chroot (pre 2010-10-19) - adding root to sudoers" |
570 sudo bash -c "echo root ALL=\(ALL\) ALL >> \"${chroot_dir}/etc/sudoers\"" | 570 sudo bash -c "echo root ALL=\(ALL\) ALL >> \"${chroot_dir}/etc/sudoers\"" |
571 fi | 571 fi |
572 | |
573 # Add chromite stuff if not already done. | |
574 if ! grep -q "^PATH=.*/trunk/chromite/bin" "${chroot_dir}/home/$USER/.bashrc"; then | |
rochberg
2011/02/09 22:00:16
CHROOT_HOME="${chroot_dir}/home/$USER" would fix b
| |
575 info "Upgrading old chroot (pre 2011-02-09) - adding chromite to path" | |
576 echo "PATH=\$PATH:/home/$USER/trunk/chromite/bin" >> \ | |
577 "${chroot_dir}/home/$USER/.bashrc" | |
578 fi | |
579 if ! [ -L "${chroot_dir}/home/$USER/.local/lib/python2.6/site-packages/chromit e" ]; then | |
diandersAtChromium
2011/02/09 21:53:07
Is there a good way to wrap this line? ...or are
| |
580 info "Upgrading old chroot (pre 2011-02-09) - adding chromite to site-packag es" | |
581 mkdir -p "${chroot_dir}/home/$USER/.local/lib/python2.6/site-packages" | |
582 ln -s ../../../../trunk/chromite \ | |
583 "${chroot_dir}/home/$USER/.local/lib/python2.6/site-packages/" | |
584 fi | |
572 } | 585 } |
573 | 586 |
574 # The board and variant command line options can be used in a number of ways | 587 # The board and variant command line options can be used in a number of ways |
575 # to specify the board and variant. The board can encode both pieces of | 588 # to specify the board and variant. The board can encode both pieces of |
576 # information separated by underscores. Or the variant can be passed using | 589 # information separated by underscores. Or the variant can be passed using |
577 # the separate variant option. This function extracts the canonical board and | 590 # the separate variant option. This function extracts the canonical board and |
578 # variant information and provides it in the BOARD, VARIANT and BOARD_VARIANT | 591 # variant information and provides it in the BOARD, VARIANT and BOARD_VARIANT |
579 # variables. | 592 # variables. |
580 get_board_and_variant() { | 593 get_board_and_variant() { |
581 local flags_board="${1}" | 594 local flags_board="${1}" |
582 local flags_variant="${2}" | 595 local flags_variant="${2}" |
583 | 596 |
584 BOARD=$(echo "$flags_board" | cut -d '_' -f 1) | 597 BOARD=$(echo "$flags_board" | cut -d '_' -f 1) |
585 VARIANT=${flags_variant:-$(echo "$flags_board" | cut -s -d '_' -f 2)} | 598 VARIANT=${flags_variant:-$(echo "$flags_board" | cut -s -d '_' -f 2)} |
586 | 599 |
587 if [ -n "$VARIANT" ]; then | 600 if [ -n "$VARIANT" ]; then |
588 BOARD_VARIANT="${BOARD}_${VARIANT}" | 601 BOARD_VARIANT="${BOARD}_${VARIANT}" |
589 else | 602 else |
590 BOARD_VARIANT="${BOARD}" | 603 BOARD_VARIANT="${BOARD}" |
591 fi | 604 fi |
592 } | 605 } |
OLD | NEW |