blob: 48caca0b2b3b59d2e179d50f9a6501a508167ce2 [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Updates an existing vm image with another image.
. $(dirname "$(readlink -f "$0")")/ || exit 1
. "${SCRIPT_ROOT}/" || exit 1
. "${SCRIPT_ROOT}/lib/" || die "Unable to load"
DEFINE_string payload "" "Full name of the payload to update with."
DEFINE_string proxy_port "" \
"Have the client request from this proxy instead of devserver."
DEFINE_boolean quick_test ${FLAGS_FALSE} "Don't perform update, only reboot."
DEFINE_string src_image "" \
"Create a delta update by passing in the image on the remote machine."
DEFINE_string stateful_update_flag "" "Flags to pass to stateful update." s
DEFINE_string image "" "Path of the image to update to." u
DEFINE_string update_log "update_engine.log" \
"Path to log for the update_engine."
DEFINE_string update_url "" "Full url of an update image."
DEFINE_string vm_image_path "" "Path of the VM image to update from." v
set -e
# Parse command line.
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
[ -n "${FLAGS_vm_image_path}" ] || \
die "You must specify a path to a vm image."
trap stop_kvm EXIT
start_kvm "${FLAGS_vm_image_path}"
if [ -n "${FLAGS_image}" ]; then
IMAGE_ARGS="--image=$(readlink -f ${FLAGS_image})"
if [ -n "${FLAGS_payload}" ]; then
if [ -n "${FLAGS_proxy_port}" ]; then
IMAGE_ARGS="${IMAGE_ARGS} --proxy_port=${FLAGS_proxy_port}"
if [ "${FLAGS_quick_test}" -eq "${FLAGS_TRUE}" ]; then
info "Skipping update testing."
QUICK_TEST_FLAGS="--noupdate --noupdate_stateful"
--for_vm \
--remote= \
--ssh_port=${FLAGS_ssh_port} \
--stateful_update_flag=${FLAGS_stateful_update_flag} \
--src_image="${FLAGS_src_image}" \
--noupdate_hostkey \
--update_log="${FLAGS_update_log}" \
--update_url="${FLAGS_update_url}" \
--verify \