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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 chroot_hacks_from_outside() { | 555 chroot_hacks_from_outside() { |
556 # Give args better names. | 556 # Give args better names. |
557 local chroot_dir="${1}" | 557 local chroot_dir="${1}" |
558 | 558 |
559 # Add root as a sudoer if not already done. | 559 # Add root as a sudoer if not already done. |
560 if ! sudo grep -q '^root ALL=(ALL) ALL$' "${chroot_dir}/etc/sudoers" ; then | 560 if ! sudo grep -q '^root ALL=(ALL) ALL$' "${chroot_dir}/etc/sudoers" ; then |
561 info "Upgrading old chroot (pre 2010-10-19) - adding root to sudoers" | 561 info "Upgrading old chroot (pre 2010-10-19) - adding root to sudoers" |
562 sudo bash -c "echo root ALL=\(ALL\) ALL >> \"${chroot_dir}/etc/sudoers\"" | 562 sudo bash -c "echo root ALL=\(ALL\) ALL >> \"${chroot_dir}/etc/sudoers\"" |
563 fi | 563 fi |
564 } | 564 } |
565 | |
566 # The board and variant command line options can be used in a number of ways | |
567 # to specify the board and variant. The board can encode both pieces of | |
568 # information separated by underscores. Or the variant can be passed using | |
569 # the separate variant option. This function extracts the canonical board and | |
570 # variant information and provides it in the BOARD, VARIANT and BOARD_VARIANT | |
571 # variables. | |
572 get_board_and_variant() { | |
573 local flags_board="${1}" | |
574 local flags_variant="${2}" | |
kwwaters_gmail.com
2011/01/24 22:49:59
These variables are unused.
robotboy
2011/01/24 23:17:00
Ooops, fixed.
| |
575 | |
576 BOARD=$(echo "$FLAGS_board" |cut -d '_' -f 1) | |
kwwaters_gmail.com
2011/01/24 22:49:59
Spaces around "|".
robotboy
2011/01/24 23:17:00
Done.
| |
577 VARIANT=${FLAGS_variant:-$(echo "$FLAGS_board" |cut -s -d '_' -f 2)} | |
kwwaters_gmail.com
2011/01/24 22:49:59
Should this be "cut -s -d _ -f 2-" I'm not sure,
robotboy
2011/01/24 23:17:00
Nope, we ensure that the variant and board names d
| |
578 | |
579 if [ -n "$VARIANT" ] ; then | |
kwwaters_gmail.com
2011/01/24 22:49:59
Drop space between "]" and ";".
robotboy
2011/01/24 23:17:00
Done.
| |
580 BOARD_VARIANT="${BOARD}_${VARIANT}" | |
581 else | |
582 BOARD_VARIANT="${BOARD}" | |
583 fi | |
584 } | |
OLD | NEW |