| 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. |
| 11 | 11 |
| 12 . "$(dirname $0)/common.sh" | 12 . "$(dirname $0)/common.sh" |
| 13 . "$(dirname $0)/remote_access.sh" | 13 . "$(dirname $0)/remote_access.sh" |
| 14 | 14 |
| 15 DEFINE_boolean ignore_version ${FLAGS_TRUE} \ | 15 DEFINE_boolean ignore_version ${FLAGS_TRUE} \ |
| 16 "Ignore existing version on running instance and always update" | 16 "Ignore existing version on running instance and always update" |
| 17 DEFINE_boolean ignore_hostname ${FLAGS_TRUE} \ | 17 DEFINE_boolean ignore_hostname ${FLAGS_TRUE} \ |
| 18 "Ignore existing AU hostname on running instance use this hostname" | 18 "Ignore existing AU hostname on running instance use this hostname" |
| 19 DEFINE_boolean update_known_hosts ${FLAGS_FALSE} \ | 19 DEFINE_boolean update_known_hosts ${FLAGS_FALSE} \ |
| 20 "Update your known_hosts with the new remote instance's key" | 20 "Update your known_hosts with the new remote instance's key" |
| 21 DEFINE_boolean verbose ${FLAGS_FALSE} \ | 21 DEFINE_boolean verbose ${FLAGS_FALSE} \ |
| 22 "Whether to output verbose information for debugging." | 22 "Whether to output verbose information for debugging." |
| 23 DEFINE_integer devserver_port 8080 \ | 23 DEFINE_integer devserver_port 8080 \ |
| 24 "Port to use for devserver" | 24 "Port to use for devserver" |
| 25 DEFINE_string update_url "" "Full url of an update image" | 25 DEFINE_string update_url "" "Full url of an update image" |
| 26 | 26 |
| 27 function kill_all_devservers { | 27 function kill_all_devservers { |
| 28 echo "Killing dev server." |
| 28 # Using ! here to avoid exiting with set -e is insufficient, so use | 29 # Using ! here to avoid exiting with set -e is insufficient, so use |
| 29 # || true instead. | 30 # || true instead. |
| 30 sudo pkill -f devserver\.py || true | 31 sudo pkill -f devserver\.py || true |
| 31 } | 32 } |
| 32 | 33 |
| 33 function cleanup { | 34 function cleanup { |
| 34 echo "Killing dev server." | 35 if [ -z "${FLAGS_update_url}" ]; then |
| 35 kill_all_devservers | 36 kill_all_devservers |
| 37 fi |
| 36 cleanup_remote_access | 38 cleanup_remote_access |
| 37 rm -rf "${TMP}" | 39 rm -rf "${TMP}" |
| 38 } | 40 } |
| 39 | 41 |
| 40 function remote_reboot_sh { | 42 function remote_reboot_sh { |
| 41 rm -f "${TMP_KNOWN_HOSTS}" | 43 rm -f "${TMP_KNOWN_HOSTS}" |
| 42 remote_sh "$@" | 44 remote_sh "$@" |
| 43 } | 45 } |
| 44 | 46 |
| 45 function start_dev_server { | 47 function start_dev_server { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 fi | 224 fi |
| 223 | 225 |
| 224 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" | 226 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" |
| 225 local release_description=$(echo $REMOTE_OUT | cut -d '=' -f 2) | 227 local release_description=$(echo $REMOTE_OUT | cut -d '=' -f 2) |
| 226 echo "Update was successful and rebooted to $release_description" | 228 echo "Update was successful and rebooted to $release_description" |
| 227 | 229 |
| 228 return 0 | 230 return 0 |
| 229 } | 231 } |
| 230 | 232 |
| 231 main $@ | 233 main $@ |
| OLD | NEW |