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 # --- BEGIN COMMON.SH BOILERPLATE --- | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
10 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 --proxy_port ${FLAGS_proxy_port}" | 173 --proxy_port ${FLAGS_proxy_port}" |
174 fi | 174 fi |
175 | 175 |
176 [ ${FLAGS_for_vm} -eq ${FLAGS_TRUE} ] && \ | 176 [ ${FLAGS_for_vm} -eq ${FLAGS_TRUE} ] && \ |
177 devserver_flags="${devserver_flags} --for_vm" | 177 devserver_flags="${devserver_flags} --for_vm" |
178 | 178 |
179 devserver_flags="${devserver_flags} \ | 179 devserver_flags="${devserver_flags} \ |
180 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" | 180 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" |
181 | 181 |
182 info "Starting devserver with flags ${devserver_flags}" | 182 info "Starting devserver with flags ${devserver_flags}" |
183 ./enter_chroot.sh -- sudo sh -c "./start_devserver ${devserver_flags} \ | 183 ./enter_chroot.sh -- sudo sh -c "start_devserver ${devserver_flags} \ |
184 --client_prefix=ChromeOSUpdateEngine \ | 184 --client_prefix=ChromeOSUpdateEngine \ |
185 --board=${FLAGS_board} \ | 185 --board=${FLAGS_board} \ |
186 --port=${FLAGS_devserver_port} > ${FLAGS_server_log} 2>&1" & | 186 --port=${FLAGS_devserver_port} > ${FLAGS_server_log} 2>&1" & |
187 | 187 |
188 info "Waiting on devserver to start" | 188 info "Waiting on devserver to start" |
189 info "note: be patient as the server generates the update before starting." | 189 info "note: be patient as the server generates the update before starting." |
190 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null; do | 190 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null; do |
191 sleep 5 | 191 sleep 5 |
192 echo -n "." | 192 echo -n "." |
193 if ! pgrep -f start_devserver > /dev/null; then | 193 if ! pgrep -f start_devserver > /dev/null; then |
(...skipping 21 matching lines...) Expand all Loading... | |
215 # Assume users providing an update url are using an archive_dir path. | 215 # Assume users providing an update url are using an archive_dir path. |
216 if [ -n "${FLAGS_update_url}" ]; then | 216 if [ -n "${FLAGS_update_url}" ]; then |
217 stateful_url=$(echo ${dev_url} | sed -e "s/update/static\/archive/") | 217 stateful_url=$(echo ${dev_url} | sed -e "s/update/static\/archive/") |
218 else | 218 else |
219 stateful_url=$(echo ${dev_url} | sed -e "s/update/static/") | 219 stateful_url=$(echo ${dev_url} | sed -e "s/update/static/") |
220 fi | 220 fi |
221 | 221 |
222 info "Starting stateful update using URL ${stateful_url}" | 222 info "Starting stateful update using URL ${stateful_url}" |
223 | 223 |
224 # Copy over update script and run update. | 224 # Copy over update script and run update. |
225 local dev_dir="${SCRIPTS_DIR}/../platform/dev" | 225 if ! local stateful_update_script="$(./enter_chroot.sh \ |
sosa
2011/03/01 17:40:48
Why is the which check necessary? We don't check
| |
226 remote_cp_to "${dev_dir}/stateful_update" "/tmp" | 226 -- sh -c "which stateful_update")"; then |
227 die "The script stateful_update was not found!" | |
228 fi | |
229 local chroot_path="${SCRIPTS_DIR}/../../chroot" | |
230 | |
231 remote_cp_to "${chroot_path}/${stateful_update_script}" "/tmp" | |
227 remote_sh "/tmp/stateful_update ${stateful_update_args} ${stateful_url}" | 232 remote_sh "/tmp/stateful_update ${stateful_update_args} ${stateful_url}" |
228 } | 233 } |
229 | 234 |
230 function get_update_args { | 235 function get_update_args { |
231 if [ -z ${1} ]; then | 236 if [ -z ${1} ]; then |
232 die "No url provided for update." | 237 die "No url provided for update." |
233 fi | 238 fi |
234 local update_args="--omaha_url ${1}" | 239 local update_args="--omaha_url ${1}" |
235 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then | 240 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then |
236 info "Forcing update independent of the current version" | 241 info "Forcing update independent of the current version" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) | 443 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) |
439 info "Update was successful and rebooted to $release_description" | 444 info "Update was successful and rebooted to $release_description" |
440 fi | 445 fi |
441 | 446 |
442 print_time_elapsed | 447 print_time_elapsed |
443 | 448 |
444 exit 0 | 449 exit 0 |
445 } | 450 } |
446 | 451 |
447 main $@ | 452 main $@ |
OLD | NEW |