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 an image onto a live running ChromiumOS instance. | 7 # Script to update an image onto a live running ChromiumOS instance. |
8 | 8 |
9 # Load common constants. This should be the first executable line. | 9 # Load common constants. This should be the first executable line. |
10 # The path to common.sh should be relative to your script's location. | 10 # The path to common.sh should be relative to your script's location. |
(...skipping 20 matching lines...) Expand all Loading... |
31 DEFINE_string archive_dir "" \ | 31 DEFINE_string archive_dir "" \ |
32 "Update using the test image in the image.zip in this directory." a | 32 "Update using the test image in the image.zip in this directory." a |
33 DEFINE_string board "" "Override the board reported by the target" | 33 DEFINE_string board "" "Override the board reported by the target" |
34 DEFINE_integer devserver_port 8080 \ | 34 DEFINE_integer devserver_port 8080 \ |
35 "Port to use for devserver." | 35 "Port to use for devserver." |
36 DEFINE_boolean for_vm ${FLAGS_FALSE} "Image is for a vm." | 36 DEFINE_boolean for_vm ${FLAGS_FALSE} "Image is for a vm." |
37 DEFINE_string image "" \ | 37 DEFINE_string image "" \ |
38 "Update with this image path that is in this source checkout." i | 38 "Update with this image path that is in this source checkout." i |
39 DEFINE_string payload "" \ | 39 DEFINE_string payload "" \ |
40 "Update with this update payload, ignoring specified images." | 40 "Update with this update payload, ignoring specified images." |
| 41 DEFINE_string proxy_port "" \ |
| 42 "Have the client request from this proxy instead of devserver." |
41 DEFINE_string src_image "" \ | 43 DEFINE_string src_image "" \ |
42 "Create a delta update by passing in the image on the remote machine." | 44 "Create a delta update by passing in the image on the remote machine." |
43 DEFINE_boolean update_stateful ${FLAGS_TRUE} \ | 45 DEFINE_boolean update_stateful ${FLAGS_TRUE} \ |
44 "Perform update of stateful partition e.g. /var /usr/local." | 46 "Perform update of stateful partition e.g. /var /usr/local." |
45 DEFINE_string update_url "" "Full url of an update image." | 47 DEFINE_string update_url "" "Full url of an update image." |
46 | 48 |
47 # Flags for stateful update. | 49 # Flags for stateful update. |
48 DEFINE_string stateful_update_flag "" \ | 50 DEFINE_string stateful_update_flag "" \ |
49 "Flag to pass to stateful update e.g. old, clean, etc." s | 51 "Flag to pass to stateful update e.g. old, clean, etc." s |
50 | 52 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 IMAGE_PATH="${IMAGE_PATH}/chromiumos_image.bin" | 134 IMAGE_PATH="${IMAGE_PATH}/chromiumos_image.bin" |
133 devserver_flags="${devserver_flags} \ | 135 devserver_flags="${devserver_flags} \ |
134 --image $(reinterpret_path_for_chroot ${IMAGE_PATH})" | 136 --image $(reinterpret_path_for_chroot ${IMAGE_PATH})" |
135 fi | 137 fi |
136 | 138 |
137 if [ -n "${FLAGS_payload}" ]; then | 139 if [ -n "${FLAGS_payload}" ]; then |
138 devserver_flags="${devserver_flags} \ | 140 devserver_flags="${devserver_flags} \ |
139 --payload $(reinterpret_path_for_chroot ${FLAGS_payload})" | 141 --payload $(reinterpret_path_for_chroot ${FLAGS_payload})" |
140 fi | 142 fi |
141 | 143 |
| 144 if [ -n "${FLAGS_proxy_port}" ]; then |
| 145 devserver_flags="${devserver_flags} \ |
| 146 --proxy_port ${FLAGS_proxy_port}" |
| 147 fi |
| 148 |
142 [ ${FLAGS_for_vm} -eq ${FLAGS_TRUE} ] && \ | 149 [ ${FLAGS_for_vm} -eq ${FLAGS_TRUE} ] && \ |
143 devserver_flags="${devserver_flags} --for_vm" | 150 devserver_flags="${devserver_flags} --for_vm" |
144 | 151 |
145 devserver_flags="${devserver_flags} \ | 152 devserver_flags="${devserver_flags} \ |
146 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" | 153 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" |
147 | 154 |
148 info "Starting devserver with flags ${devserver_flags}" | 155 info "Starting devserver with flags ${devserver_flags}" |
149 ./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \ | 156 ./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \ |
150 --client_prefix=ChromeOSUpdateEngine \ | 157 --client_prefix=ChromeOSUpdateEngine \ |
151 --board=${FLAGS_board} \ | 158 --board=${FLAGS_board} \ |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then | 209 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then |
203 info "Forcing update independent of the current version" | 210 info "Forcing update independent of the current version" |
204 update_args="--update ${update_args}" | 211 update_args="--update ${update_args}" |
205 fi | 212 fi |
206 | 213 |
207 echo "${update_args}" | 214 echo "${update_args}" |
208 } | 215 } |
209 | 216 |
210 function get_devserver_url { | 217 function get_devserver_url { |
211 local devserver_url="" | 218 local devserver_url="" |
| 219 local port=${FLAGS_devserver_port} |
| 220 |
| 221 if [[ -n ${FLAGS_proxy_port} ]]; then |
| 222 port=${FLAGS_proxy_port} |
| 223 fi |
| 224 |
212 if [ ${FLAGS_ignore_hostname} -eq ${FLAGS_TRUE} ]; then | 225 if [ ${FLAGS_ignore_hostname} -eq ${FLAGS_TRUE} ]; then |
213 if [ -z ${FLAGS_update_url} ]; then | 226 if [ -z ${FLAGS_update_url} ]; then |
214 devserver_url="http://$(get_hostname):${FLAGS_devserver_port}/update" | 227 devserver_url="http://$(get_hostname):${port}/update" |
215 else | 228 else |
216 devserver_url="${FLAGS_update_url}" | 229 devserver_url="${FLAGS_update_url}" |
217 fi | 230 fi |
218 fi | 231 fi |
219 echo "${devserver_url}" | 232 echo "${devserver_url}" |
220 } | 233 } |
221 | 234 |
222 function truncate_update_log { | 235 function truncate_update_log { |
223 remote_sh "> /var/log/update_engine.log" | 236 remote_sh "> /var/log/update_engine.log" |
224 } | 237 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) | 390 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) |
378 info "Update was successful and rebooted to $release_description" | 391 info "Update was successful and rebooted to $release_description" |
379 fi | 392 fi |
380 | 393 |
381 print_time_elapsed | 394 print_time_elapsed |
382 | 395 |
383 exit 0 | 396 exit 0 |
384 } | 397 } |
385 | 398 |
386 main $@ | 399 main $@ |
OLD | NEW |