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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 die "Error reinterpreting path. Path ${1} is not within source tree." | 103 die "Error reinterpreting path. Path ${1} is not within source tree." |
104 fi | 104 fi |
105 | 105 |
106 # Prepend the chroot repository path. | 106 # Prepend the chroot repository path. |
107 echo "/home/${USER}/trunk/${relative_path}" | 107 echo "/home/${USER}/trunk/${relative_path}" |
108 fi | 108 fi |
109 } | 109 } |
110 | 110 |
111 function start_dev_server { | 111 function start_dev_server { |
112 kill_all_devservers | 112 kill_all_devservers |
113 local devserver_flags= | 113 local devserver_flags="--pregenerate_update" |
114 # Parse devserver flags. | 114 # Parse devserver flags. |
115 if [ -n "${FLAGS_image}" ]; then | 115 if [ -n "${FLAGS_image}" ]; then |
116 devserver_flags="${devserver_flags} \ | 116 devserver_flags="${devserver_flags} \ |
117 --image $(reinterpret_path_for_chroot ${FLAGS_image})" | 117 --image $(reinterpret_path_for_chroot ${FLAGS_image})" |
118 IMAGE_PATH="${FLAGS_image}" | 118 IMAGE_PATH="${FLAGS_image}" |
119 elif [ -n "${FLAGS_archive_dir}" ]; then | 119 elif [ -n "${FLAGS_archive_dir}" ]; then |
120 devserver_flags="${devserver_flags} \ | 120 devserver_flags="${devserver_flags} \ |
121 --archive_dir $(reinterpret_path_for_chroot ${FLAGS_archive_dir}) -t" | 121 --archive_dir $(reinterpret_path_for_chroot ${FLAGS_archive_dir}) -t" |
122 IMAGE_PATH="${FLAGS_archive_dir}/chromiumos_test_image.bin" | 122 IMAGE_PATH="${FLAGS_archive_dir}/chromiumos_test_image.bin" |
123 else | 123 else |
124 # IMAGE_PATH should be the newest image and learn the board from | 124 # IMAGE_PATH should be the newest image and learn the board from |
125 # the target. | 125 # the target. |
126 FLAGS_board="" | 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 fi | 130 fi |
131 | 131 |
132 devserver_flags="${devserver_flags} \ | 132 devserver_flags="${devserver_flags} \ |
133 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" | 133 --src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\"" |
134 | 134 |
135 info "Starting devserver with flags ${devserver_flags}" | 135 info "Starting devserver with flags ${devserver_flags}" |
136 ./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \ | 136 ./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \ |
137 --client_prefix=ChromeOSUpdateEngine \ | 137 --client_prefix=ChromeOSUpdateEngine \ |
138 --port=${FLAGS_devserver_port} > ${FLAGS_server_log} 2>&1" & | 138 --port=${FLAGS_devserver_port} > ${FLAGS_server_log} 2>&1" & |
139 | 139 |
140 echo -n "Waiting on devserver to start" | 140 info "Waiting on devserver to start" |
| 141 info "note: be patient as the server generates the update before starting." |
141 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null | 142 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null |
142 do | 143 do |
143 sleep .5 | 144 sleep 5 |
144 echo -n "." | 145 echo -n "." |
145 done | 146 done |
146 echo "" | 147 echo "" |
147 } | 148 } |
148 | 149 |
149 # Copies stateful update script which fetches the newest stateful update | 150 # Copies stateful update script which fetches the newest stateful update |
150 # from the dev server and prepares the update. chromeos_startup finishes | 151 # from the dev server and prepares the update. chromeos_startup finishes |
151 # the update on next boot. | 152 # the update on next boot. |
152 function run_stateful_update { | 153 function run_stateful_update { |
153 local dev_url=$(get_devserver_url) | 154 local dev_url=$(get_devserver_url) |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) | 384 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) |
384 info "Update was successful and rebooted to $release_description" | 385 info "Update was successful and rebooted to $release_description" |
385 fi | 386 fi |
386 | 387 |
387 print_time_elapsed | 388 print_time_elapsed |
388 | 389 |
389 exit 0 | 390 exit 0 |
390 } | 391 } |
391 | 392 |
392 main $@ | 393 main $@ |
OLD | NEW |