| 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 . "$(dirname $0)/../common.sh" | 
|  10 . "$(dirname $0)/../lib/cros_vm_lib.sh" |  10 . "$(dirname $0)/../lib/cros_vm_lib.sh" | 
|  11  |  11  | 
|  12 DEFINE_string payload "" "Full name of the payload to update with." |  12 DEFINE_string payload "" "Full name of the payload to update with." | 
|  13 DEFINE_string proxy_port "" \ |  13 DEFINE_string proxy_port "" \ | 
|  14   "Have the client request from this proxy instead of devserver." |  14   "Have the client request from this proxy instead of devserver." | 
|  15 DEFINE_string src_image "" \ |  15 DEFINE_string src_image "" \ | 
|  16   "Create a delta update by passing in the image on the remote machine." |  16   "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 |  17 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 |  18 DEFINE_string update_image_path "" "Path of the image to update to." u | 
|  19 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 |  19 DEFINE_string vm_image_path "" "Path of the VM image to update from." v | 
|  21  |  20  | 
|  22 set -e |  21 set -e | 
|  23  |  22  | 
|  24 # Parse command line. |  23 # Parse command line. | 
|  25 FLAGS "$@" || exit 1 |  24 FLAGS "$@" || exit 1 | 
|  26 eval set -- "${FLAGS_ARGV}" |  25 eval set -- "${FLAGS_ARGV}" | 
|  27  |  26  | 
 |  27 [ -n "${FLAGS_update_image_path}" ] || [ -n "${FLAGS_payload}" ] || \ | 
 |  28   die "You must specify a path to an image to use as an update." | 
|  28 [ -n "${FLAGS_vm_image_path}" ] || \ |  29 [ -n "${FLAGS_vm_image_path}" ] || \ | 
|  29   die "You must specify a path to a vm image." |  30   die "You must specify a path to a vm image." | 
|  30  |  31  | 
|  31 trap stop_kvm EXIT |  32 trap stop_kvm EXIT | 
|  32 start_kvm "${FLAGS_vm_image_path}" |  33 start_kvm "${FLAGS_vm_image_path}" | 
|  33  |  34  | 
|  34 if [ -n "${FLAGS_update_image_path}" ]; then |  35 if [ -n "${FLAGS_update_image_path}" ]; then | 
|  35   IMAGE_ARGS="--image=$(readlink -f ${FLAGS_update_image_path})" |  36   IMAGE_ARGS="--image=$(readlink -f ${FLAGS_update_image_path})" | 
|  36 fi |  37 fi | 
|  37  |  38  | 
|  38 if [ -n "${FLAGS_payload}" ]; then |  39 if [ -n "${FLAGS_payload}" ]; then | 
|  39   IMAGE_ARGS="--payload=${FLAGS_payload}" |  40   IMAGE_ARGS="--payload=${FLAGS_payload}" | 
|  40 fi |  41 fi | 
|  41  |  42  | 
|  42 if [ -n "${FLAGS_proxy_port}" ]; then |  43 if [ -n "${FLAGS_proxy_port}" ]; then | 
|  43   IMAGE_ARGS="${IMAGE_ARGS} --proxy_port=${FLAGS_proxy_port}" |  44   IMAGE_ARGS="${IMAGE_ARGS} --proxy_port=${FLAGS_proxy_port}" | 
|  44 fi |  45 fi | 
|  45  |  46  | 
|  46 $(dirname $0)/../image_to_live.sh \ |  47 $(dirname $0)/../image_to_live.sh \ | 
|  47   --for_vm \ |  | 
|  48   --remote=127.0.0.1 \ |  48   --remote=127.0.0.1 \ | 
|  49   --ssh_port=${FLAGS_ssh_port} \ |  49   --ssh_port=${FLAGS_ssh_port} \ | 
|  50   --stateful_update_flag=${FLAGS_stateful_update_flag} \ |  50   --stateful_update_flag=${FLAGS_stateful_update_flag} \ | 
|  51   --src_image="${FLAGS_src_image}" \ |  51   --src_image="${FLAGS_src_image}" \ | 
|  52   --update_url="${FLAGS_update_url}" \ |  | 
|  53   --verify \ |  52   --verify \ | 
 |  53   --for_vm \ | 
|  54   ${IMAGE_ARGS} |  54   ${IMAGE_ARGS} | 
|  55  |  55  | 
| OLD | NEW |