mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 14:01:43 +01:00
This reverts commit be787f3525a47fb5baac5cb50c0f13972bc7cfb6. Revert "Fix sudo again." This reverts commit 0f411ec7d9bf09ee008544fdc52751b42970a611. TBR dgarrett BUG= TEST= Review URL: http://codereview.chromium.org/6348022 Change-Id: I2fb9ca4967ff173c17840b96eb68b02ff2b7774a
56 lines
1.6 KiB
Bash
Executable File
56 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright (c) 2010 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 $0)/../common.sh"
|
|
. "$(dirname $0)/../lib/cros_vm_lib.sh"
|
|
|
|
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_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 update_image_path "" "Path of the image to update to." u
|
|
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_update_image_path}" ] || [ -n "${FLAGS_payload}" ] || \
|
|
die "You must specify a path to an image to use as an update."
|
|
[ -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_update_image_path}" ]; then
|
|
IMAGE_ARGS="--image=$(readlink -f ${FLAGS_update_image_path})"
|
|
fi
|
|
|
|
if [ -n "${FLAGS_payload}" ]; then
|
|
IMAGE_ARGS="--payload=${FLAGS_payload}"
|
|
fi
|
|
|
|
if [ -n "${FLAGS_proxy_port}" ]; then
|
|
IMAGE_ARGS="${IMAGE_ARGS} --proxy_port=${FLAGS_proxy_port}"
|
|
fi
|
|
|
|
$(dirname $0)/../image_to_live.sh \
|
|
--remote=127.0.0.1 \
|
|
--ssh_port=${FLAGS_ssh_port} \
|
|
--stateful_update_flag=${FLAGS_stateful_update_flag} \
|
|
--src_image="${FLAGS_src_image}" \
|
|
--verify \
|
|
--for_vm \
|
|
${IMAGE_ARGS}
|
|
|