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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 --proxy_port ${FLAGS_proxy_port}" | 146 --proxy_port ${FLAGS_proxy_port}" |
147 fi | 147 fi |
148 | 148 |
149 [ ${FLAGS_for_vm} -eq ${FLAGS_TRUE} ] && \ | 149 [ ${FLAGS_for_vm} -eq ${FLAGS_TRUE} ] && \ |
150 devserver_flags="${devserver_flags} --for_vm" | 150 devserver_flags="${devserver_flags} --for_vm" |
151 | 151 |
152 devserver_flags="${devserver_flags} \ | 152 devserver_flags="${devserver_flags} \ |
153 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" | 153 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" |
154 | 154 |
155 info "Starting devserver with flags ${devserver_flags}" | 155 info "Starting devserver with flags ${devserver_flags}" |
156 ./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \ | 156 ./enter_chroot.sh -- sudo sh -c "./start_devserver ${devserver_flags} \ |
157 --client_prefix=ChromeOSUpdateEngine \ | 157 --client_prefix=ChromeOSUpdateEngine \ |
158 --board=${FLAGS_board} \ | 158 --board=${FLAGS_board} \ |
159 --port=${FLAGS_devserver_port} > ${FLAGS_server_log} 2>&1" & | 159 --port=${FLAGS_devserver_port} > ${FLAGS_server_log} 2>&1" & |
160 | 160 |
161 info "Waiting on devserver to start" | 161 info "Waiting on devserver to start" |
162 info "note: be patient as the server generates the update before starting." | 162 info "note: be patient as the server generates the update before starting." |
163 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null | 163 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null |
164 do | 164 do |
165 sleep 5 | 165 sleep 5 |
166 echo -n "." | 166 echo -n "." |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 info "Forcing update independent of the current version" | 210 info "Forcing update independent of the current version" |
211 update_args="--update ${update_args}" | 211 update_args="--update ${update_args}" |
212 fi | 212 fi |
213 | 213 |
214 echo "${update_args}" | 214 echo "${update_args}" |
215 } | 215 } |
216 | 216 |
217 function get_devserver_url { | 217 function get_devserver_url { |
218 local devserver_url="" | 218 local devserver_url="" |
219 local port=${FLAGS_devserver_port} | 219 local port=${FLAGS_devserver_port} |
220 | 220 |
221 if [[ -n ${FLAGS_proxy_port} ]]; then | 221 if [[ -n ${FLAGS_proxy_port} ]]; then |
222 port=${FLAGS_proxy_port} | 222 port=${FLAGS_proxy_port} |
223 fi | 223 fi |
224 | 224 |
225 if [ ${FLAGS_ignore_hostname} -eq ${FLAGS_TRUE} ]; then | 225 if [ ${FLAGS_ignore_hostname} -eq ${FLAGS_TRUE} ]; then |
226 if [ -z ${FLAGS_update_url} ]; then | 226 if [ -z ${FLAGS_update_url} ]; then |
227 devserver_url="http://$(get_hostname):${port}/update" | 227 devserver_url="http://$(get_hostname):${port}/update" |
228 else | 228 else |
229 devserver_url="${FLAGS_update_url}" | 229 devserver_url="${FLAGS_update_url}" |
230 fi | 230 fi |
231 fi | 231 fi |
232 echo "${devserver_url}" | 232 echo "${devserver_url}" |
233 } | 233 } |
234 | 234 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) | 390 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) |
391 info "Update was successful and rebooted to $release_description" | 391 info "Update was successful and rebooted to $release_description" |
392 fi | 392 fi |
393 | 393 |
394 print_time_elapsed | 394 print_time_elapsed |
395 | 395 |
396 exit 0 | 396 exit 0 |
397 } | 397 } |
398 | 398 |
399 main $@ | 399 main $@ |
OLD | NEW |