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