OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 sleep .5 | 62 sleep .5 |
63 echo -n "." | 63 echo -n "." |
64 done | 64 done |
65 echo "" | 65 echo "" |
66 } | 66 } |
67 | 67 |
68 # Copys stateful update script which fetches the newest stateful update | 68 # Copys stateful update script which fetches the newest stateful update |
69 # from the dev server and prepares the update. chromeos_startup finishes | 69 # from the dev server and prepares the update. chromeos_startup finishes |
70 # the update on next boot. | 70 # the update on next boot. |
71 function copy_stateful_update { | 71 function copy_stateful_update { |
72 info "Starting stateful update." | 72 local dev_url=$(get_devserver_url) |
73 local dev_dir="$(dirname $0)/../platform/dev" | 73 local stateful_url="" |
| 74 |
| 75 # Assume users providing an update url are using an archive_dir path. |
| 76 if [ -n "${FLAGS_update_url}" ]; then |
| 77 stateful_url=$(echo ${dev_url} | sed -e "s/update/static\/archive/") |
| 78 else |
| 79 stateful_url=$(echo ${dev_url} | sed -e "s/update/static/") |
| 80 fi |
| 81 |
| 82 info "Starting stateful update using URL ${stateful_url}" |
74 | 83 |
75 # Copy over update script and run update. | 84 # Copy over update script and run update. |
76 remote_cp_to "$dev_dir/stateful_update" "/tmp" | 85 local dev_dir="$(dirname $0)/../platform/dev" |
77 remote_sh "/tmp/stateful_update" | 86 remote_cp_to "${dev_dir}/stateful_update" "/tmp" |
| 87 remote_sh "/tmp/stateful_update ${stateful_url}" |
78 } | 88 } |
79 | 89 |
80 function get_update_args { | 90 function get_update_args { |
81 if [ -z ${1} ]; then | 91 if [ -z ${1} ]; then |
82 die "No url provided for update." | 92 die "No url provided for update." |
83 fi | 93 fi |
84 local update_args="--omaha_url ${1}" | 94 local update_args="--omaha_url ${1}" |
85 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then | 95 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then |
86 info "Forcing update independent of the current version" | 96 info "Forcing update independent of the current version" |
87 update_args="--update ${update_args}" | 97 update_args="--update ${update_args}" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 fi | 207 fi |
198 | 208 |
199 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" | 209 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" |
200 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) | 210 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) |
201 info "Update was successful and rebooted to $release_description" | 211 info "Update was successful and rebooted to $release_description" |
202 | 212 |
203 return 0 | 213 return 0 |
204 } | 214 } |
205 | 215 |
206 main $@ | 216 main $@ |
OLD | NEW |