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 # --- BEGIN COMMON.SH BOILERPLATE --- | 10 # --- BEGIN COMMON.SH BOILERPLATE --- |
11 # Load common CrOS utilities. Inside the chroot this file is installed in | 11 # Load common CrOS utilities. Inside the chroot this file is installed in |
12 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's | 12 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
13 # location. | 13 # location. |
14 find_common_sh() { | 14 find_common_sh() { |
15 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) | 15 local thisdir="$(dirname "$(readlink -f "$0")")" |
| 16 local common_paths=(/usr/lib/crosutils "${thisdir}") |
16 local path | 17 local path |
17 | 18 |
18 SCRIPT_ROOT= | 19 SCRIPT_ROOT= |
19 for path in "${common_paths[@]}"; do | 20 for path in "${common_paths[@]}"; do |
20 if [ -r "${path}/common.sh" ]; then | 21 if [ -r "${path}/common.sh" ]; then |
21 SCRIPT_ROOT=${path} | 22 SCRIPT_ROOT=${path} |
22 break | 23 break |
23 fi | 24 fi |
24 done | 25 done |
| 26 |
| 27 # HACK(zbehan): We have to fake GCLIENT_ROOT in case we're running inside |
| 28 # au_zip enviroment. GCLIENT_ROOT detection became fatal... |
| 29 [ "${SCRIPT_ROOT}" == "${thisdir}" ] && \ |
| 30 export GCLIENT_ROOT="." |
25 } | 31 } |
26 | 32 |
27 find_common_sh | 33 find_common_sh |
28 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) | 34 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
29 # --- END COMMON.SH BOILERPLATE --- | 35 # --- END COMMON.SH BOILERPLATE --- |
30 | 36 |
31 # Need to be inside the chroot to load chromeos-common.sh | |
32 assert_inside_chroot | |
33 | |
34 # Load functions and constants for chromeos-install | 37 # Load functions and constants for chromeos-install |
35 . "/usr/lib/installer/chromeos-common.sh" || \ | 38 # NOTE: Needs to be called from outside the chroot. |
| 39 . "/usr/lib/installer/chromeos-common.sh" &> /dev/null || \ |
| 40 . "${SRC_ROOT}/platform/installer/chromeos-common.sh" &> /dev/null || \ |
| 41 . "./chromeos-common.sh" || \ |
36 die "Unable to load /usr/lib/installer/chromeos-common.sh" | 42 die "Unable to load /usr/lib/installer/chromeos-common.sh" |
37 | 43 |
38 SRC_MNT="" | 44 SRC_MNT="" |
39 DST_MNT="" | 45 DST_MNT="" |
40 SRC_KERNEL="" | 46 SRC_KERNEL="" |
41 SRC_ROOT="" | 47 SRC_ROOT="" |
42 DST_KERNEL="" | 48 DST_KERNEL="" |
43 DST_ROOT="" | 49 DST_ROOT="" |
44 STATE_MNT="" | 50 STATE_MNT="" |
45 STATE_LOOP_DEV="" | 51 STATE_LOOP_DEV="" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 262 |
257 GENERATOR="${SCRIPTS_DIR}/mk_memento_images.sh" | 263 GENERATOR="${SCRIPTS_DIR}/mk_memento_images.sh" |
258 | 264 |
259 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT" | 265 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT" |
260 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output" | 266 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output" |
261 | 267 |
262 trap - INT TERM EXIT | 268 trap - INT TERM EXIT |
263 cleanup noexit | 269 cleanup noexit |
264 echo "Done generating full update." | 270 echo "Done generating full update." |
265 fi | 271 fi |
OLD | NEW |