| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 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 # Updates an existing vm image with another image. | 7 # Updates an existing vm image with another image. |
| 8 | 8 |
| 9 . "$(dirname $0)/../common.sh" | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
| 10 . "$(dirname $0)/../lib/cros_vm_lib.sh" | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
| 11 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 12 # location. |
| 13 find_common_sh() { |
| 14 local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") |
| 15 local path |
| 16 |
| 17 SCRIPT_ROOT= |
| 18 for path in "${common_paths[@]}"; do |
| 19 if [ -r "${path}/common.sh" ]; then |
| 20 SCRIPT_ROOT=${path} |
| 21 break |
| 22 fi |
| 23 done |
| 24 } |
| 25 |
| 26 find_common_sh |
| 27 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 28 # --- END COMMON.SH BOILERPLATE --- |
| 29 |
| 30 . "${SCRIPT_ROOT}/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh" |
| 11 | 31 |
| 12 DEFINE_string payload "" "Full name of the payload to update with." | 32 DEFINE_string payload "" "Full name of the payload to update with." |
| 13 DEFINE_string proxy_port "" \ | 33 DEFINE_string proxy_port "" \ |
| 14 "Have the client request from this proxy instead of devserver." | 34 "Have the client request from this proxy instead of devserver." |
| 15 DEFINE_string src_image "" \ | 35 DEFINE_string src_image "" \ |
| 16 "Create a delta update by passing in the image on the remote machine." | 36 "Create a delta update by passing in the image on the remote machine." |
| 17 DEFINE_string stateful_update_flag "" "Flags to pass to stateful update." s | 37 DEFINE_string stateful_update_flag "" "Flags to pass to stateful update." s |
| 18 DEFINE_string update_image_path "" "Path of the image to update to." u | 38 DEFINE_string update_image_path "" "Path of the image to update to." u |
| 19 DEFINE_string update_url "" "Full url of an update image." | 39 DEFINE_string update_url "" "Full url of an update image." |
| 20 DEFINE_string vm_image_path "" "Path of the VM image to update from." v | 40 DEFINE_string vm_image_path "" "Path of the VM image to update from." v |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 fi | 56 fi |
| 37 | 57 |
| 38 if [ -n "${FLAGS_payload}" ]; then | 58 if [ -n "${FLAGS_payload}" ]; then |
| 39 IMAGE_ARGS="--payload=${FLAGS_payload}" | 59 IMAGE_ARGS="--payload=${FLAGS_payload}" |
| 40 fi | 60 fi |
| 41 | 61 |
| 42 if [ -n "${FLAGS_proxy_port}" ]; then | 62 if [ -n "${FLAGS_proxy_port}" ]; then |
| 43 IMAGE_ARGS="${IMAGE_ARGS} --proxy_port=${FLAGS_proxy_port}" | 63 IMAGE_ARGS="${IMAGE_ARGS} --proxy_port=${FLAGS_proxy_port}" |
| 44 fi | 64 fi |
| 45 | 65 |
| 46 $(dirname $0)/../image_to_live.sh \ | 66 "${SCRIPTS_DIR}/image_to_live.sh" \ |
| 47 --for_vm \ | 67 --for_vm \ |
| 48 --remote=127.0.0.1 \ | 68 --remote=127.0.0.1 \ |
| 49 --ssh_port=${FLAGS_ssh_port} \ | 69 --ssh_port=${FLAGS_ssh_port} \ |
| 50 --stateful_update_flag=${FLAGS_stateful_update_flag} \ | 70 --stateful_update_flag=${FLAGS_stateful_update_flag} \ |
| 51 --src_image="${FLAGS_src_image}" \ | 71 --src_image="${FLAGS_src_image}" \ |
| 52 --update_url="${FLAGS_update_url}" \ | 72 --update_url="${FLAGS_update_url}" \ |
| 53 --verify \ | 73 --verify \ |
| 54 ${IMAGE_ARGS} | 74 ${IMAGE_ARGS} |
| 55 | 75 |
| OLD | NEW |