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 # Script to take an archived build result and prepare a hwqual release. | 7 # Script to take an archived build result and prepare a hwqual release. |
8 | 8 |
9 # Load common constants. This should be the first executable line. | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
10 # The path to common.sh should be relative to your script's location. | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
11 . "$(dirname "$0")/common.sh" | 11 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 12 # location. |
| 13 find_common_sh() { |
| 14 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 15 local path |
| 16 |
| 17 SCRIPT_ROOT= |
| 18 for path in "${common_paths[@]}"; do |
| 19 if [ -r "${path}/common.sh" ]; then |
| 20 SCRIPT_ROOT=${path} |
| 21 break |
| 22 fi |
| 23 done |
| 24 } |
| 25 |
| 26 find_common_sh |
| 27 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 28 # --- END COMMON.SH BOILERPLATE --- |
12 | 29 |
13 # Flags | 30 # Flags |
14 DEFINE_string from "" "Directory with build archive (zipname)" | 31 DEFINE_string from "" "Directory with build archive (zipname)" |
15 DEFINE_string to "" "Directory to receive packaged hwqual" | 32 DEFINE_string to "" "Directory to receive packaged hwqual" |
16 DEFINE_string zipname "image.zip" "Name of zip file to create." | 33 DEFINE_string zipname "image.zip" "Name of zip file to create." |
17 DEFINE_string output_tag "chromeos-hwqual" "Name used in tar" | 34 DEFINE_string output_tag "chromeos-hwqual" "Name used in tar" |
18 | 35 |
19 TMP=$(mktemp -d "/tmp/image.XXXX") | 36 TMP=$(mktemp -d "/tmp/image.XXXX") |
20 | 37 |
21 function cleanup() { | 38 function cleanup() { |
(...skipping 13 matching lines...) Expand all Loading... |
35 echo "Please specify --from directory" | 52 echo "Please specify --from directory" |
36 exit 1 | 53 exit 1 |
37 fi | 54 fi |
38 | 55 |
39 FLAGS_from=$(readlink -f "${FLAGS_from}") | 56 FLAGS_from=$(readlink -f "${FLAGS_from}") |
40 | 57 |
41 if [[ -z "${FLAGS_to}" ]]; then | 58 if [[ -z "${FLAGS_to}" ]]; then |
42 FLAGS_to="${FLAGS_from}" | 59 FLAGS_to="${FLAGS_from}" |
43 fi | 60 fi |
44 | 61 |
45 local script_dir=$(dirname "$0") | 62 local script_dir=${SCRIPTS_DIR} |
46 | 63 |
47 script_dir=$(readlink -f "${script_dir}") | 64 script_dir=$(readlink -f "${script_dir}") |
48 docgen_dir="autotest/utils/docgen" | 65 docgen_dir="autotest/utils/docgen" |
49 html_target="${TMP}/autotest/client/site_tests/suite_HWQual/html" | 66 html_target="${TMP}/autotest/client/site_tests/suite_HWQual/html" |
50 | 67 |
51 trap cleanup EXIT | 68 trap cleanup EXIT |
52 | 69 |
53 cd "${TMP}" | 70 cd "${TMP}" |
54 | 71 |
55 echo "Extracting build artifacts..." | 72 echo "Extracting build artifacts..." |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 tar --bzip2 -cf "${FLAGS_to}/${FLAGS_output_tag}.tar.bz2" . | 130 tar --bzip2 -cf "${FLAGS_to}/${FLAGS_output_tag}.tar.bz2" . |
114 | 131 |
115 trap - EXIT | 132 trap - EXIT |
116 cleanup | 133 cleanup |
117 | 134 |
118 echo "Done." | 135 echo "Done." |
119 cd "${script_dir}" | 136 cd "${script_dir}" |
120 } | 137 } |
121 | 138 |
122 main "$@" | 139 main "$@" |
OLD | NEW |