| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 fi | 349 fi |
| 350 | 350 |
| 351 if [ ${FLAGS_update} -eq ${FLAGS_TRUE} ] && ! run_auto_update; then | 351 if [ ${FLAGS_update} -eq ${FLAGS_TRUE} ] && ! run_auto_update; then |
| 352 warn "Dumping update_engine.log for debugging and/or bug reporting." | 352 warn "Dumping update_engine.log for debugging and/or bug reporting." |
| 353 tail -n 200 "${FLAGS_update_log}" >&2 | 353 tail -n 200 "${FLAGS_update_log}" >&2 |
| 354 die "Update was not successful." | 354 die "Update was not successful." |
| 355 fi | 355 fi |
| 356 | 356 |
| 357 if [ ${FLAGS_update_stateful} -eq ${FLAGS_TRUE} ] && \ | 357 if [ ${FLAGS_update_stateful} -eq ${FLAGS_TRUE} ] && \ |
| 358 ! run_stateful_update; then | 358 ! run_stateful_update; then |
| 359 warn "Stateful update was not successful." | 359 die "Stateful update was not successful." |
| 360 fi | 360 fi |
| 361 | 361 |
| 362 remote_reboot | 362 remote_reboot |
| 363 | 363 |
| 364 if [[ ${FLAGS_update_hostkey} -eq ${FLAGS_TRUE} ]]; then | 364 if [[ ${FLAGS_update_hostkey} -eq ${FLAGS_TRUE} ]]; then |
| 365 local known_hosts="${HOME}/.ssh/known_hosts" | 365 local known_hosts="${HOME}/.ssh/known_hosts" |
| 366 cp "${known_hosts}" "${known_hosts}~" | 366 cp "${known_hosts}" "${known_hosts}~" |
| 367 grep -v "^${FLAGS_remote} " "${known_hosts}" > "${TMP}/new_known_hosts" | 367 grep -v "^${FLAGS_remote} " "${known_hosts}" > "${TMP}/new_known_hosts" |
| 368 cat "${TMP}/new_known_hosts" "${TMP_KNOWN_HOSTS}" > "${known_hosts}" | 368 cat "${TMP}/new_known_hosts" "${TMP_KNOWN_HOSTS}" > "${known_hosts}" |
| 369 chmod 0640 "${known_hosts}" | 369 chmod 0640 "${known_hosts}" |
| 370 info "New updated in ${known_hosts}, backup made." | 370 info "New updated in ${known_hosts}, backup made." |
| 371 fi | 371 fi |
| 372 | 372 |
| 373 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" | 373 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" |
| 374 if [ ${FLAGS_verify} -eq ${FLAGS_TRUE} ]; then | 374 if [ ${FLAGS_verify} -eq ${FLAGS_TRUE} ]; then |
| 375 verify_image | 375 verify_image |
| 376 else | 376 else |
| 377 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) | 377 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) |
| 378 info "Update was successful and rebooted to $release_description" | 378 info "Update was successful and rebooted to $release_description" |
| 379 fi | 379 fi |
| 380 | 380 |
| 381 print_time_elapsed | 381 print_time_elapsed |
| 382 | 382 |
| 383 exit 0 | 383 exit 0 |
| 384 } | 384 } |
| 385 | 385 |
| 386 main $@ | 386 main $@ |
| OLD | NEW |