mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 14:06:58 +02:00
Add delta update support to imaging tools.
Change-Id: I3ad6d418a1d47f47b78ba4e011c83bc569041475 BUG=6912 TEST=Ran with http://codereview.chromium.org/4129005/show with and without src_image Review URL: http://codereview.chromium.org/4147002
This commit is contained in:
parent
a0ff51c60d
commit
8e3e834e4a
@ -9,6 +9,8 @@
|
||||
. "$(dirname $0)/../common.sh"
|
||||
. "$(dirname $0)/../lib/cros_vm_lib.sh"
|
||||
|
||||
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
|
||||
@ -31,6 +33,7 @@ $(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 \
|
||||
--image=$(readlink -f ${FLAGS_update_image_path})
|
||||
|
||||
|
@ -34,6 +34,8 @@ DEFINE_integer devserver_port 8080 \
|
||||
"Port to use for devserver."
|
||||
DEFINE_string image "" \
|
||||
"Update with this image path that is in this source checkout." i
|
||||
DEFINE_string src_image "" \
|
||||
"Create a delta update by passing in the image on the remote machine."
|
||||
DEFINE_boolean update_stateful ${FLAGS_TRUE} \
|
||||
"Perform update of stateful partition e.g. /var /usr/local."
|
||||
DEFINE_string update_url "" "Full url of an update image."
|
||||
@ -84,21 +86,26 @@ function get_hostname {
|
||||
}
|
||||
|
||||
# Reinterprets path from outside the chroot for use inside.
|
||||
# Returns "" if "" given.
|
||||
# $1 - The path to reinterpret.
|
||||
function reinterpret_path_for_chroot() {
|
||||
local path_abs_path=$(readlink -f "${1}")
|
||||
local gclient_root_abs_path=$(readlink -f "${GCLIENT_ROOT}")
|
||||
if [ -z "${1}" ]; then
|
||||
echo ""
|
||||
else
|
||||
local path_abs_path=$(readlink -f "${1}")
|
||||
local gclient_root_abs_path=$(readlink -f "${GCLIENT_ROOT}")
|
||||
|
||||
# Strip the repository root from the path.
|
||||
local relative_path=$(echo ${path_abs_path} \
|
||||
| sed s:${gclient_root_abs_path}/::)
|
||||
# Strip the repository root from the path.
|
||||
local relative_path=$(echo ${path_abs_path} \
|
||||
| sed s:${gclient_root_abs_path}/::)
|
||||
|
||||
if [ "${relative_path}" = "${path_abs_path}" ]; then
|
||||
die "Error reinterpreting path. Path ${1} is not within your source tree."
|
||||
if [ "${relative_path}" = "${path_abs_path}" ]; then
|
||||
die "Error reinterpreting path. Path ${1} is not within source tree."
|
||||
fi
|
||||
|
||||
# Prepend the chroot repository path.
|
||||
echo "/home/${USER}/trunk/${relative_path}"
|
||||
fi
|
||||
|
||||
# Prepend the chroot repository path.
|
||||
echo "/home/${USER}/trunk/${relative_path}"
|
||||
}
|
||||
|
||||
function start_dev_server {
|
||||
@ -109,7 +116,6 @@ function start_dev_server {
|
||||
devserver_flags="${devserver_flags} \
|
||||
--image $(reinterpret_path_for_chroot ${FLAGS_image})"
|
||||
IMAGE_PATH="${FLAGS_image}"
|
||||
|
||||
elif [ -n "${FLAGS_archive_dir}" ]; then
|
||||
devserver_flags="${devserver_flags} \
|
||||
--archive_dir $(reinterpret_path_for_chroot ${FLAGS_archive_dir}) -t"
|
||||
@ -123,6 +129,9 @@ function start_dev_server {
|
||||
IMAGE_PATH="${IMAGE_PATH}/chromiumos_image.bin"
|
||||
fi
|
||||
|
||||
devserver_flags="${devserver_flags} \
|
||||
--src_image=\"$(reinterpret_path_for_chroot ${FLAGS_src_image})\""
|
||||
|
||||
info "Starting devserver with flags ${devserver_flags}"
|
||||
./enter_chroot.sh "sudo ./start_devserver ${devserver_flags} \
|
||||
--client_prefix=ChromeOSUpdateEngine \
|
||||
|
Loading…
Reference in New Issue
Block a user