From 6c47714d931d737921b19dc3430252ec97d8dc4d Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Thu, 1 Apr 2010 10:51:33 -0700 Subject: [PATCH] Only mod image for test if necessary Review URL: http://codereview.chromium.org/1606004 --- image_to_usb.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/image_to_usb.sh b/image_to_usb.sh index b881e1a946..ad033ccbc4 100755 --- a/image_to_usb.sh +++ b/image_to_usb.sh @@ -48,7 +48,7 @@ AUTOTEST_SRC="${SYSROOT}/usr/local/autotest" set -e # No board, no default and no image set then we can't find the image -if [ -z ${FLAGS_from} ] && [ -z ${FLAGS_board} ] ; then +if [ -z ${FLAGS_from} ] && [ -z ${FLAGS_board} ] ; then setup_board_warning exit 1 fi @@ -90,13 +90,16 @@ SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin" # 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 - # Copy it. - echo "Creating test image from original..." - cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_test_image.bin" + if [ ! -f "${FLAGS_from}/chromiumos_test_image.bin" ] ; then + # Copy it. + echo "Creating test image from original..." + cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_test_image.bin" + # Modify it. + "${SCRIPTS_DIR}/mod_image_for_test.sh" --image \ + "${FLAGS_from}/chromiumos_test_image.bin" + fi # Use it. SRC_IMAGE="${FLAGS_from}/chromiumos_test_image.bin" - # Modify it. - "${SCRIPTS_DIR}/mod_image_for_test.sh" --image "${SRC_IMAGE}" fi STATEFUL_DIR="${FLAGS_from}/stateful_partition" @@ -139,10 +142,10 @@ if [ ${FLAGS_install_autotest} -eq ${FLAGS_TRUE} ] ; then sudo mkdir -p "${stateful_root}${autotest_client}" sudo cp -fpru ${AUTOTEST_SRC}/client/* \ - "${stateful_root}/${autotest_client}" + "${stateful_root}/${autotest_client}" sudo chmod 755 "${stateful_root}/${autotest_client}" sudo chown -R 1000:1000 "${stateful_root}/${autotest_client}" - + sudo umount ${STATEFUL_DIR} sudo losetup -d "${stateful_loop_dev}" trap - INT TERM EXIT