| 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 src_image "" \ |
| 13 "Create a delta update by passing in the image on the remote machine." |
| 12 DEFINE_string stateful_update_flag "" "Flags to pass to stateful update." s | 14 DEFINE_string stateful_update_flag "" "Flags to pass to stateful update." s |
| 13 DEFINE_string update_image_path "" "Path of the image to update to." u | 15 DEFINE_string update_image_path "" "Path of the image to update to." u |
| 14 DEFINE_string vm_image_path "" "Path of the VM image to update from." v | 16 DEFINE_string vm_image_path "" "Path of the VM image to update from." v |
| 15 | 17 |
| 16 set -e | 18 set -e |
| 17 | 19 |
| 18 # Parse command line. | 20 # Parse command line. |
| 19 FLAGS "$@" || exit 1 | 21 FLAGS "$@" || exit 1 |
| 20 eval set -- "${FLAGS_ARGV}" | 22 eval set -- "${FLAGS_ARGV}" |
| 21 | 23 |
| 22 [ -n "${FLAGS_update_image_path}" ] || \ | 24 [ -n "${FLAGS_update_image_path}" ] || \ |
| 23 die "You must specify a path to an image to use as an update." | 25 die "You must specify a path to an image to use as an update." |
| 24 [ -n "${FLAGS_vm_image_path}" ] || \ | 26 [ -n "${FLAGS_vm_image_path}" ] || \ |
| 25 die "You must specify a path to a vm image." | 27 die "You must specify a path to a vm image." |
| 26 | 28 |
| 27 trap stop_kvm EXIT | 29 trap stop_kvm EXIT |
| 28 start_kvm "${FLAGS_vm_image_path}" | 30 start_kvm "${FLAGS_vm_image_path}" |
| 29 | 31 |
| 30 $(dirname $0)/../image_to_live.sh \ | 32 $(dirname $0)/../image_to_live.sh \ |
| 31 --remote=127.0.0.1 \ | 33 --remote=127.0.0.1 \ |
| 32 --ssh_port=${FLAGS_ssh_port} \ | 34 --ssh_port=${FLAGS_ssh_port} \ |
| 33 --stateful_update_flag=${FLAGS_stateful_update_flag} \ | 35 --stateful_update_flag=${FLAGS_stateful_update_flag} \ |
| 36 --src_image="${FLAGS_src_image}" \ |
| 34 --verify \ | 37 --verify \ |
| 35 --image=$(readlink -f ${FLAGS_update_image_path}) | 38 --image=$(readlink -f ${FLAGS_update_image_path}) |
| 36 | 39 |
| OLD | NEW |