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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
640 args="${args} --force_copy" | 640 args="${args} --force_copy" |
641 fi | 641 fi |
642 | 642 |
643 # Modify the image for test, creating a new test image | 643 # Modify the image for test, creating a new test image |
644 "${SCRIPTS_DIR}/mod_image_for_test.sh" --board=${FLAGS_board} \ | 644 "${SCRIPTS_DIR}/mod_image_for_test.sh" --board=${FLAGS_board} \ |
645 --image="$1/$2" --noinplace ${args} | 645 --image="$1/$2" --noinplace ${args} |
646 | 646 |
647 # From now on we use the just-created test image | 647 # From now on we use the just-created test image |
648 CHROMEOS_RETURN_VAL="$1/${CHROMEOS_TEST_IMAGE_NAME}" | 648 CHROMEOS_RETURN_VAL="$1/${CHROMEOS_TEST_IMAGE_NAME}" |
649 } | 649 } |
650 | |
651 # Check that the specified file exists. If the file path is empty or the file | |
652 # doesn't exist on the filesystem generate useful error messages. Otherwise | |
653 # show the user the name and path of the file that will be used. | |
davidjames
2011/03/01 00:31:54
Can you show an example use case here? Took me a f
| |
654 check_for_file() { | |
655 local name=$1 | |
656 local padding=$2 | |
657 local path=$3 | |
658 | |
659 if [ -z "${path}" ]; then | |
660 die "No ${name} file specified." | |
661 fi | |
662 | |
663 if [ ! -e "${path}" ]; then | |
664 die "No ${name} file found at: ${path}" | |
665 else | |
666 info "Using ${name}${padding}: ${path}" | |
667 fi | |
668 } | |
669 | |
670 # Check that the specified tool exists. If it does not exist in the PATH | |
671 # generate a useful error message indicating how to install the ebuild | |
672 # that contains the required tool. | |
673 check_for_tool() { | |
674 local tool=$1 | |
675 local ebuild=$2 | |
676 | |
677 if ! which "${tool}" >/dev/null ; then | |
678 error "The ${tool} utility was not found in your path. Run the following" | |
679 error "command in your chroot to install it: sudo -E emerge ${ebuild}" | |
680 exit 1 | |
681 fi | |
682 } | |
OLD | NEW |