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 # --- BEGIN COMMON.SH BOILERPLATE --- | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
10 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
(...skipping 17 matching lines...) Expand all Loading... |
28 # --- END COMMON.SH BOILERPLATE --- | 28 # --- END COMMON.SH BOILERPLATE --- |
29 | 29 |
30 . "${SCRIPT_ROOT}/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh" | 30 . "${SCRIPT_ROOT}/lib/cros_vm_lib.sh" || die "Unable to load cros_vm_lib.sh" |
31 | 31 |
32 DEFINE_string payload "" "Full name of the payload to update with." | 32 DEFINE_string payload "" "Full name of the payload to update with." |
33 DEFINE_string proxy_port "" \ | 33 DEFINE_string proxy_port "" \ |
34 "Have the client request from this proxy instead of devserver." | 34 "Have the client request from this proxy instead of devserver." |
35 DEFINE_string src_image "" \ | 35 DEFINE_string src_image "" \ |
36 "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." |
37 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 |
38 DEFINE_string update_image_path "" "Path of the image to update to." u | 38 DEFINE_string image "" "Path of the image to update to." u |
39 DEFINE_string update_url "" "Full url of an update image." | 39 DEFINE_string update_url "" "Full url of an update image." |
40 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 |
41 | 41 |
42 set -e | 42 set -e |
43 | 43 |
44 # Parse command line. | 44 # Parse command line. |
45 FLAGS "$@" || exit 1 | 45 FLAGS "$@" || exit 1 |
46 eval set -- "${FLAGS_ARGV}" | 46 eval set -- "${FLAGS_ARGV}" |
47 | 47 |
48 [ -n "${FLAGS_vm_image_path}" ] || \ | 48 [ -n "${FLAGS_vm_image_path}" ] || \ |
49 die "You must specify a path to a vm image." | 49 die "You must specify a path to a vm image." |
50 | 50 |
51 trap stop_kvm EXIT | 51 trap stop_kvm EXIT |
52 start_kvm "${FLAGS_vm_image_path}" | 52 start_kvm "${FLAGS_vm_image_path}" |
53 retry_until_ssh | 53 retry_until_ssh |
54 | 54 |
55 if [ -n "${FLAGS_update_image_path}" ]; then | 55 if [ -n "${FLAGS_image}" ]; then |
56 IMAGE_ARGS="--image=$(readlink -f ${FLAGS_update_image_path})" | 56 IMAGE_ARGS="--image=$(readlink -f ${FLAGS_image})" |
57 fi | 57 fi |
58 | 58 |
59 if [ -n "${FLAGS_payload}" ]; then | 59 if [ -n "${FLAGS_payload}" ]; then |
60 IMAGE_ARGS="--payload=${FLAGS_payload}" | 60 IMAGE_ARGS="--payload=${FLAGS_payload}" |
61 fi | 61 fi |
62 | 62 |
63 if [ -n "${FLAGS_proxy_port}" ]; then | 63 if [ -n "${FLAGS_proxy_port}" ]; then |
64 IMAGE_ARGS="${IMAGE_ARGS} --proxy_port=${FLAGS_proxy_port}" | 64 IMAGE_ARGS="${IMAGE_ARGS} --proxy_port=${FLAGS_proxy_port}" |
65 fi | 65 fi |
66 | 66 |
67 "${SCRIPTS_DIR}/image_to_live.sh" \ | 67 "${SCRIPTS_DIR}/image_to_live.sh" \ |
68 --for_vm \ | 68 --for_vm \ |
69 --remote=127.0.0.1 \ | 69 --remote=127.0.0.1 \ |
70 --ssh_port=${FLAGS_ssh_port} \ | 70 --ssh_port=${FLAGS_ssh_port} \ |
71 --stateful_update_flag=${FLAGS_stateful_update_flag} \ | 71 --stateful_update_flag=${FLAGS_stateful_update_flag} \ |
72 --src_image="${FLAGS_src_image}" \ | 72 --src_image="${FLAGS_src_image}" \ |
73 --update_url="${FLAGS_update_url}" \ | 73 --update_url="${FLAGS_update_url}" \ |
74 --verify \ | 74 --verify \ |
75 ${IMAGE_ARGS} | 75 ${IMAGE_ARGS} |
76 | 76 |
OLD | NEW |