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 generate a Chromium OS update for use by the update engine. | 7 # Script to generate a Chromium OS update for use by the update engine. |
8 # If a source .bin is specified, the update is assumed to be a delta update. | 8 # If a source .bin is specified, the update is assumed to be a delta update. |
9 | 9 |
10 # Load common constants. This should be the first executable line. | 10 # --- BEGIN COMMON.SH BOILERPLATE --- |
11 # The path to common.sh should be relative to your script's location. | 11 # Load common CrOS utilities. Inside the chroot this file is installed in |
12 . "$(dirname "$0")/common.sh" | 12 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 13 # location. |
| 14 find_common_sh() { |
| 15 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 16 local path |
| 17 |
| 18 SCRIPT_ROOT= |
| 19 for path in "${common_paths[@]}"; do |
| 20 if [ -r "${path}/common.sh" ]; then |
| 21 SCRIPT_ROOT=${path} |
| 22 break |
| 23 fi |
| 24 done |
| 25 } |
| 26 |
| 27 find_common_sh |
| 28 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 29 # --- END COMMON.SH BOILERPLATE --- |
| 30 |
| 31 # Need to be inside the chroot to load chromeos-common.sh |
| 32 assert_inside_chroot |
13 | 33 |
14 # Load functions and constants for chromeos-install | 34 # Load functions and constants for chromeos-install |
15 . "$(dirname "$0")/chromeos-common.sh" | 35 . "/usr/lib/installer/chromeos-common.sh" || \ |
| 36 die "Unable to load /usr/lib/installer/chromeos-common.sh" |
16 | 37 |
17 SRC_MNT="" | 38 SRC_MNT="" |
18 DST_MNT="" | 39 DST_MNT="" |
19 SRC_KERNEL="" | 40 SRC_KERNEL="" |
20 SRC_ROOT="" | 41 SRC_ROOT="" |
21 DST_KERNEL="" | 42 DST_KERNEL="" |
22 DST_ROOT="" | 43 DST_ROOT="" |
23 STATE_MNT="" | 44 STATE_MNT="" |
24 STATE_LOOP_DEV="" | 45 STATE_LOOP_DEV="" |
25 | 46 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 else | 247 else |
227 echo "Generating old-style full update" | 248 echo "Generating old-style full update" |
228 | 249 |
229 trap cleanup INT TERM EXIT | 250 trap cleanup INT TERM EXIT |
230 DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 2) | 251 DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 2) |
231 if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then | 252 if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then |
232 patch_kernel "$FLAGS_image" "$DST_KERNEL" | 253 patch_kernel "$FLAGS_image" "$DST_KERNEL" |
233 fi | 254 fi |
234 DST_ROOT=$(extract_partition_to_temp_file "$FLAGS_image" 3) | 255 DST_ROOT=$(extract_partition_to_temp_file "$FLAGS_image" 3) |
235 | 256 |
236 GENERATOR="$(dirname "$0")/mk_memento_images.sh" | 257 GENERATOR="${SCRIPTS_DIR}/mk_memento_images.sh" |
237 | 258 |
238 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT" | 259 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT" |
239 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output" | 260 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output" |
240 | 261 |
241 trap - INT TERM EXIT | 262 trap - INT TERM EXIT |
242 cleanup noexit | 263 cleanup noexit |
243 echo "Done generating full update." | 264 echo "Done generating full update." |
244 fi | 265 fi |
OLD | NEW |