OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 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 # Load common constants. This should be the first executable line. | 7 # --- BEGIN COMMON.SH BOILERPLATE --- |
8 # The path to common.sh should be relative to your script's location. | 8 # Load common CrOS utilities. Inside the chroot this file is installed in |
9 . "$(dirname "$0")/common.sh" | 9 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 10 # location. |
| 11 find_common_sh() { |
| 12 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 13 local path |
| 14 |
| 15 SCRIPT_ROOT= |
| 16 for path in "${common_paths[@]}"; do |
| 17 if [ -r "${path}/common.sh" ]; then |
| 18 SCRIPT_ROOT=${path} |
| 19 break |
| 20 fi |
| 21 done |
| 22 } |
| 23 |
| 24 find_common_sh |
| 25 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 26 # --- END COMMON.SH BOILERPLATE --- |
10 | 27 |
11 # Flags | 28 # Flags |
12 DEFINE_string target "x86" \ | 29 DEFINE_string target "x86" \ |
13 "The target architecture to test. One of { x86, arm }." | 30 "The target architecture to test. One of { x86, arm }." |
14 DEFINE_string root "" \ | 31 DEFINE_string root "" \ |
15 "The root file system to check." | 32 "The root file system to check." |
16 | 33 |
17 # Parse command line | 34 # Parse command line |
18 FLAGS "$@" || exit 1 | 35 FLAGS "$@" || exit 1 |
19 eval set -- "${FLAGS_ARGV}" | 36 eval set -- "${FLAGS_ARGV}" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 74 |
58 LIBS="`sudo find $ROOT -type f -name '*.so*'`" | 75 LIBS="`sudo find $ROOT -type f -name '*.so*'`" |
59 | 76 |
60 # Check that all .so files, plus the binaries, have the appropriate dependencies | 77 # Check that all .so files, plus the binaries, have the appropriate dependencies |
61 if ! "${SCRIPTS_DIR}/check_deps" "$ROOT" $BINARIES $LIBS; then | 78 if ! "${SCRIPTS_DIR}/check_deps" "$ROOT" $BINARIES $LIBS; then |
62 echo test_image: Failed dependency check | 79 echo test_image: Failed dependency check |
63 EXITCODE=1 | 80 EXITCODE=1 |
64 fi | 81 fi |
65 | 82 |
66 exit $EXITCODE | 83 exit $EXITCODE |
OLD | NEW |