| 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 | 21 |
| 22 function kill_all_devservers { | 22 function kill_all_devservers { |
| 23 ! pkill -f 'python devserver.py' | 23 # Using ! here to avoid exiting with set -e is insufficient, so use |
| 24 # || true instead. |
| 25 pkill -f 'python devserver.py' || true |
| 24 } | 26 } |
| 25 | 27 |
| 26 function cleanup { | 28 function cleanup { |
| 27 kill_all_devservers | 29 kill_all_devservers |
| 28 rm -rf "${TMP}" | 30 rm -rf "${TMP}" |
| 29 } | 31 } |
| 30 | 32 |
| 31 function remote_reboot_sh { | 33 function remote_reboot_sh { |
| 32 rm -f "${TMP_KNOWN_HOSTS}" | 34 rm -f "${TMP_KNOWN_HOSTS}" |
| 33 remote_sh "$@" | 35 remote_sh "$@" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 fi | 186 fi |
| 185 | 187 |
| 186 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" | 188 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" |
| 187 local release_description=$(echo $REMOTE_OUT | cut -d '=' -f 2) | 189 local release_description=$(echo $REMOTE_OUT | cut -d '=' -f 2) |
| 188 echo "Update was successful and rebooted to $release_description" | 190 echo "Update was successful and rebooted to $release_description" |
| 189 | 191 |
| 190 return 0 | 192 return 0 |
| 191 } | 193 } |
| 192 | 194 |
| 193 main $@ | 195 main $@ |
| OLD | NEW |