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 12 matching lines...) Expand all Loading... |
23 "Perform update of root partition." | 23 "Perform update of root partition." |
24 DEFINE_boolean update_known_hosts ${FLAGS_FALSE} \ | 24 DEFINE_boolean update_known_hosts ${FLAGS_FALSE} \ |
25 "Update your known_hosts with the new remote instance's key." | 25 "Update your known_hosts with the new remote instance's key." |
26 DEFINE_string update_log "update_engine.log" \ | 26 DEFINE_string update_log "update_engine.log" \ |
27 "Path to log for the update_engine." | 27 "Path to log for the update_engine." |
28 DEFINE_boolean verify ${FLAGS_TRUE} "Verify image on device after update." | 28 DEFINE_boolean verify ${FLAGS_TRUE} "Verify image on device after update." |
29 | 29 |
30 # Flags for devserver. | 30 # Flags for devserver. |
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_integer devserver_port 8080 \ | 34 DEFINE_integer devserver_port 8080 \ |
34 "Port to use for devserver." | 35 "Port to use for devserver." |
35 DEFINE_string image "" \ | 36 DEFINE_string image "" \ |
36 "Update with this image path that is in this source checkout." i | 37 "Update with this image path that is in this source checkout." i |
37 DEFINE_string src_image "" \ | 38 DEFINE_string src_image "" \ |
38 "Create a delta update by passing in the image on the remote machine." | 39 "Create a delta update by passing in the image on the remote machine." |
39 DEFINE_boolean update_stateful ${FLAGS_TRUE} \ | 40 DEFINE_boolean update_stateful ${FLAGS_TRUE} \ |
40 "Perform update of stateful partition e.g. /var /usr/local." | 41 "Perform update of stateful partition e.g. /var /usr/local." |
41 DEFINE_string update_url "" "Full url of an update image." | 42 DEFINE_string update_url "" "Full url of an update image." |
42 | 43 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 devserver_flags="${devserver_flags} \ | 117 devserver_flags="${devserver_flags} \ |
117 --image $(reinterpret_path_for_chroot ${FLAGS_image})" | 118 --image $(reinterpret_path_for_chroot ${FLAGS_image})" |
118 IMAGE_PATH="${FLAGS_image}" | 119 IMAGE_PATH="${FLAGS_image}" |
119 elif [ -n "${FLAGS_archive_dir}" ]; then | 120 elif [ -n "${FLAGS_archive_dir}" ]; then |
120 devserver_flags="${devserver_flags} \ | 121 devserver_flags="${devserver_flags} \ |
121 --archive_dir $(reinterpret_path_for_chroot ${FLAGS_archive_dir}) -t" | 122 --archive_dir $(reinterpret_path_for_chroot ${FLAGS_archive_dir}) -t" |
122 IMAGE_PATH="${FLAGS_archive_dir}/chromiumos_test_image.bin" | 123 IMAGE_PATH="${FLAGS_archive_dir}/chromiumos_test_image.bin" |
123 else | 124 else |
124 # IMAGE_PATH should be the newest image and learn the board from | 125 # IMAGE_PATH should be the newest image and learn the board from |
125 # the target. | 126 # the target. |
126 FLAGS_board="" | |
127 learn_board | 127 learn_board |
128 IMAGE_PATH="$($(dirname "$0")/get_latest_image.sh --board="${FLAGS_board}")" | 128 IMAGE_PATH="$($(dirname "$0")/get_latest_image.sh --board="${FLAGS_board}")" |
129 IMAGE_PATH="${IMAGE_PATH}/chromiumos_image.bin" | 129 IMAGE_PATH="${IMAGE_PATH}/chromiumos_image.bin" |
| 130 devserver_flags="${devserver_flags} \ |
| 131 --image $(reinterpret_path_for_chroot ${IMAGE_PATH})" |
130 fi | 132 fi |
131 | 133 |
132 devserver_flags="${devserver_flags} \ | 134 devserver_flags="${devserver_flags} \ |
133 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" | 135 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" |
134 | 136 |
135 info "Starting devserver with flags ${devserver_flags}" | 137 info "Starting devserver with flags ${devserver_flags}" |
136 ./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \ | 138 ./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \ |
137 --client_prefix=ChromeOSUpdateEngine \ | 139 --client_prefix=ChromeOSUpdateEngine \ |
138 --port=${FLAGS_devserver_port} > ${FLAGS_server_log} 2>&1" & | 140 --port=${FLAGS_devserver_port} > ${FLAGS_server_log} 2>&1" & |
139 | 141 |
140 info "Waiting on devserver to start" | 142 info "Waiting on devserver to start" |
141 info "note: be patient as the server generates the update before starting." | 143 info "note: be patient as the server generates the update before starting." |
142 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null | 144 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null |
143 do | 145 do |
144 sleep 5 | 146 sleep 5 |
145 echo -n "." | 147 echo -n "." |
| 148 if ! pgrep -f start_devserver > /dev/null; then |
| 149 echo "Devserver failed, see dev_server.log." |
| 150 exit 1 |
| 151 fi |
146 done | 152 done |
147 echo "" | 153 echo "" |
148 } | 154 } |
149 | 155 |
150 # Copies stateful update script which fetches the newest stateful update | 156 # Copies stateful update script which fetches the newest stateful update |
151 # from the dev server and prepares the update. chromeos_startup finishes | 157 # from the dev server and prepares the update. chromeos_startup finishes |
152 # the update on next boot. | 158 # the update on next boot. |
153 function run_stateful_update { | 159 function run_stateful_update { |
154 local dev_url=$(get_devserver_url) | 160 local dev_url=$(get_devserver_url) |
155 local stateful_url="" | 161 local stateful_url="" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) | 390 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) |
385 info "Update was successful and rebooted to $release_description" | 391 info "Update was successful and rebooted to $release_description" |
386 fi | 392 fi |
387 | 393 |
388 print_time_elapsed | 394 print_time_elapsed |
389 | 395 |
390 exit 0 | 396 exit 0 |
391 } | 397 } |
392 | 398 |
393 main $@ | 399 main $@ |
OLD | NEW |