OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 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 # This script takes a path to a rootfs.ext2 which was generated by | 7 # This script takes a path to a rootfs.ext2 which was generated by |
8 # build_image.sh and generates an image that can be used for auto | 8 # build_image.sh and generates an image that can be used for auto |
9 # update. | 9 # update. |
10 | 10 |
11 set -e | 11 set -e |
12 | 12 |
| 13 # --- BEGIN COMMON.SH BOILERPLATE --- |
| 14 # Load common CrOS utilities. Inside the chroot this file is installed in |
| 15 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 16 # location. |
| 17 find_common_sh() { |
| 18 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 19 local path |
| 20 |
| 21 SCRIPT_ROOT= |
| 22 for path in "${common_paths[@]}"; do |
| 23 if [ -r "${path}/common.sh" ]; then |
| 24 SCRIPT_ROOT=${path} |
| 25 break |
| 26 fi |
| 27 done |
| 28 } |
| 29 |
| 30 find_common_sh |
| 31 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 32 # --- END COMMON.SH BOILERPLATE --- |
| 33 |
| 34 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 35 |
13 # Load functions designed for image processing | 36 # Load functions designed for image processing |
14 if ! . "$(dirname "$0")/lib/cros_image_common.sh"; then | 37 if ! . "${SCRIPT_ROOT}/lib/cros_image_common.sh"; then |
15 echo "ERROR: Cannot load required library: lib/cros_image_common.sh; Abort." | 38 echo "ERROR: Cannot load required library: lib/cros_image_common.sh; Abort." |
16 exit 1 | 39 exit 1 |
17 fi | 40 fi |
18 | 41 |
19 if [ -z "$2" -o -z "$1" ] || [ "${#@}" -ne 2 -a "${#@}" -ne 3 ]; then | 42 if [ -z "$2" -o -z "$1" ] || [ "${#@}" -ne 2 -a "${#@}" -ne 3 ]; then |
20 echo "usage: $0 path/to/kernel_partition_img path/to/rootfs_partition_img" | 43 echo "usage: $0 path/to/kernel_partition_img path/to/rootfs_partition_img" |
21 echo " or $0 path/to/chromiumos_img kern_part_no rootfs_part_no" | 44 echo " or $0 path/to/chromiumos_img kern_part_no rootfs_part_no" |
22 exit 1 | 45 exit 1 |
23 fi | 46 fi |
24 | 47 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 set -- $CS_AND_RET_CODES | 128 set -- $CS_AND_RET_CODES |
106 CALC_CS="$1" | 129 CALC_CS="$1" |
107 shift | 130 shift |
108 RET_CODES="$@" | 131 RET_CODES="$@" |
109 if [ "$RET_CODES" != "$EXPECTED_RET_CODES" ]; then | 132 if [ "$RET_CODES" != "$EXPECTED_RET_CODES" ]; then |
110 echo compression/hash failed. $RET_CODES | 133 echo compression/hash failed. $RET_CODES |
111 exit 1 | 134 exit 1 |
112 fi | 135 fi |
113 | 136 |
114 echo Success. hash is "$CALC_CS" | 137 echo Success. hash is "$CALC_CS" |
OLD | NEW |