OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009-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 update the kernel on a live running ChromiumOS instance. | 7 # Script to update the kernel on a live running ChromiumOS instance. |
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 # /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 |
11 | 16 |
12 . "$(dirname $0)/common.sh" | 17 SCRIPT_ROOT= |
13 . "$(dirname $0)/remote_access.sh" | 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 --- |
| 29 |
| 30 . "${SCRIPT_ROOT}/remote_access.sh" |
14 | 31 |
15 # Script must be run inside the chroot. | 32 # Script must be run inside the chroot. |
16 restart_in_chroot_if_needed $* | 33 restart_in_chroot_if_needed "$@" |
17 | 34 |
18 DEFINE_string board "" "Override board reported by target" | 35 DEFINE_string board "" "Override board reported by target" |
19 DEFINE_string device "" "Override boot device reported by target" | 36 DEFINE_string device "" "Override boot device reported by target" |
20 DEFINE_string partition "" "Override kernel partition reported by target" | 37 DEFINE_string partition "" "Override kernel partition reported by target" |
21 DEFINE_string arch "" "Override architecture reported by target" | 38 DEFINE_string arch "" "Override architecture reported by target" |
22 DEFINE_boolean modules false "Update modules on target" | 39 DEFINE_boolean modules false "Update modules on target" |
23 DEFINE_boolean firmware false "Update firmware on target" | 40 DEFINE_boolean firmware false "Update firmware on target" |
24 | 41 |
25 # Parse command line. | 42 # Parse command line. |
26 FLAGS "$@" || exit 1 | 43 FLAGS "$@" || exit 1 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 fi | 138 fi |
122 | 139 |
123 remote_reboot | 140 remote_reboot |
124 | 141 |
125 remote_sh uname -r -v | 142 remote_sh uname -r -v |
126 info "old kernel: ${old_kernel}" | 143 info "old kernel: ${old_kernel}" |
127 info "new kernel: ${REMOTE_OUT}" | 144 info "new kernel: ${REMOTE_OUT}" |
128 } | 145 } |
129 | 146 |
130 main "$@" | 147 main "$@" |
OLD | NEW |