diff --git a/bin/cros_run_vm_update b/bin/cros_run_vm_update index 67995df648..df0f5486fb 100755 --- a/bin/cros_run_vm_update +++ b/bin/cros_run_vm_update @@ -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}) diff --git a/image_to_live.sh b/image_to_live.sh index 41c32e0d88..9317c3d8d1 100755 --- a/image_to_live.sh +++ b/image_to_live.sh @@ -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 \