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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if [ "${relative_path}" = "${path_abs_path}" ]; then | 82 if [ "${relative_path}" = "${path_abs_path}" ]; then |
83 die "Error reinterpreting path. Path ${1} is not within your source tree." | 83 die "Error reinterpreting path. Path ${1} is not within your source tree." |
84 fi | 84 fi |
85 | 85 |
86 # Prepend the chroot repository path. | 86 # Prepend the chroot repository path. |
87 echo "/home/${USER}/trunk/${relative_path}" | 87 echo "/home/${USER}/trunk/${relative_path}" |
88 } | 88 } |
89 | 89 |
90 function start_dev_server { | 90 function start_dev_server { |
91 kill_all_devservers | 91 kill_all_devservers |
92 local devserver_flags=${FLAGS_devserver_port} | 92 local devserver_flags= |
93 # Parse devserver flags. | 93 # Parse devserver flags. |
94 if [ -n "${FLAGS_image}" ]; then | 94 if [ -n "${FLAGS_image}" ]; then |
95 devserver_flags="${devserver_flags} \ | 95 devserver_flags="${devserver_flags} \ |
96 --image $(reinterpret_path_for_chroot ${FLAGS_image})" | 96 --image $(reinterpret_path_for_chroot ${FLAGS_image})" |
97 IMAGE_PATH="${FLAGS_image}" | 97 IMAGE_PATH="${FLAGS_image}" |
98 | 98 |
99 elif [ -n "${FLAGS_archive_dir}" ]; then | 99 elif [ -n "${FLAGS_archive_dir}" ]; then |
100 devserver_flags="${devserver_flags} \ | 100 devserver_flags="${devserver_flags} \ |
101 --archive_dir $(reinterpret_path_for_chroot ${FLAGS_archive_dir}) -t" | 101 --archive_dir $(reinterpret_path_for_chroot ${FLAGS_archive_dir}) -t" |
102 IMAGE_PATH="${FLAGS_archive_dir}/chromiumos_test_image.bin" | 102 IMAGE_PATH="${FLAGS_archive_dir}/chromiumos_test_image.bin" |
103 else | 103 else |
104 # IMAGE_PATH should be the newest image and learn the board from | 104 # IMAGE_PATH should be the newest image and learn the board from |
105 # the target. | 105 # the target. |
106 FLAGS_board="" | 106 FLAGS_board="" |
107 learn_board | 107 learn_board |
108 IMAGE_PATH="$($(dirname "$0")/get_latest_image.sh --board="${FLAGS_board}")" | 108 IMAGE_PATH="$($(dirname "$0")/get_latest_image.sh --board="${FLAGS_board}")" |
109 IMAGE_PATH="${IMAGE_PATH}/chromiumos_image.bin" | 109 IMAGE_PATH="${IMAGE_PATH}/chromiumos_image.bin" |
110 fi | 110 fi |
111 | 111 |
112 info "Starting devserver with flags ${devserver_flags}" | 112 info "Starting devserver with flags ${devserver_flags}" |
113 ./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \ | 113 ./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \ |
114 --client_prefix=ChromeOSUpdateEngine > ${FLAGS_server_log} 2>&1" & | 114 --client_prefix=ChromeOSUpdateEngine \ |
| 115 --port=${FLAGS_devserver_port} > ${FLAGS_server_log} 2>&1" & |
115 | 116 |
116 echo -n "Waiting on devserver to start" | 117 echo -n "Waiting on devserver to start" |
117 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null | 118 until netstat -anp 2>&1 | grep 0.0.0.0:${FLAGS_devserver_port} > /dev/null |
118 do | 119 do |
119 sleep .5 | 120 sleep .5 |
120 echo -n "." | 121 echo -n "." |
121 done | 122 done |
122 echo "" | 123 echo "" |
123 } | 124 } |
124 | 125 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) | 358 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) |
358 info "Update was successful and rebooted to $release_description" | 359 info "Update was successful and rebooted to $release_description" |
359 fi | 360 fi |
360 | 361 |
361 print_time_elapsed | 362 print_time_elapsed |
362 | 363 |
363 exit 0 | 364 exit 0 |
364 } | 365 } |
365 | 366 |
366 main $@ | 367 main $@ |
OLD | NEW |