Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Unified Diff: image_to_vm.sh

Issue 5271010: Factored out the code to copy an image and modify it for test (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: image_to_vm.sh
diff --git a/image_to_vm.sh b/image_to_vm.sh
index 50e00e5612b33ba87277d2fcdb34f67bcd0bd8c8..405a46e1fca78bf38a4f60e7701a89c34c83a879 100755
--- a/image_to_vm.sh
+++ b/image_to_vm.sh
@@ -10,6 +10,8 @@
# Load common constants. This should be the first executable line.
# The path to common.sh should be relative to your script's location.
. "$(dirname "$0")/common.sh"
+
+# Load functions and constants for chromeos-install
. "$(dirname "$0")/chromeos-common.sh"
. "$(dirname "$0")/lib/cros_vm_constants.sh"
@@ -40,7 +42,7 @@ DEFINE_string state_image "" \
DEFINE_integer statefulfs_size 2048 \
"Stateful partition size in MBs."
DEFINE_boolean test_image "${FLAGS_FALSE}" \
- "Copies normal image to chromiumos_test_image.bin, modifies it for test."
+ "Copies normal image to ${CHROMEOS_TEST_IMAGE_NAME}, modifies it for test."
DEFINE_string to "" \
"Destination folder for VM output file(s)"
DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \
@@ -85,38 +87,11 @@ if [ -z "${FLAGS_to}" ] ; then
fi
# Use this image as the source image to copy
-SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin"
+SRC_IMAGE="${FLAGS_from}/${CHROMEOS_IMAGE_NAME}"
-# If we're asked to modify the image for test, then let's make a copy and
-# modify that instead.
if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then
- if [ ! -f "${FLAGS_from}/chromiumos_test_image.bin" ] || \
- [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then
- # Copy it.
- echo "Creating test image from original..."
- cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_test_image.bin"
-
- # Check for manufacturing image.
- if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then
- EXTRA_ARGS="--factory"
- fi
-
- # Check for install shim.
- if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then
- EXTRA_ARGS="--factory_install"
- fi
-
- # Modify it. Pass --yes so that mod_image_for_test.sh won't ask us if we
- # really want to modify the image; the user gave their assent already with
- # --test-image and the original image is going to be preserved.
- "${SCRIPTS_DIR}/mod_image_for_test.sh" --board=${FLAGS_board} --image \
- "${FLAGS_from}/chromiumos_test_image.bin" ${EXTRA_ARGS} --yes
- echo "Done with mod_image_for_test."
- else
- echo "Using cached test image."
- fi
- SRC_IMAGE="${FLAGS_from}/chromiumos_test_image.bin"
- echo "Source test image is: ${SRC_IMAGE}"
+ # make a test image as requested, this will modify SRC_IMAGE
sosa 2010/11/30 22:01:43 again same question
+ prepare_test_image
fi
# Memory units are in MBs

Powered by Google App Engine
This is Rietveld 408576698