From 43395e3a70c0b2eae19aec5bf048bfb37fd49ad3 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Wed, 22 Jun 2011 08:28:43 -0700 Subject: [PATCH] Only copy the final image file on local disk if it is not in the default location. BUG=None TEST=run with a "--to" path that is the default location where the image is generated. Verify the final image is not 0 bytes. Change-Id: Ib9a7feceb17054362f00a813c369564e753cd3ab Reviewed-on: http://gerrit.chromium.org/gerrit/2988 Tested-by: Dave Parker Reviewed-by: Chris Sosa Reviewed-by: Nick Sanders --- image_to_usb.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/image_to_usb.sh b/image_to_usb.sh index c0c1d966f2..7a203be6b1 100755 --- a/image_to_usb.sh +++ b/image_to_usb.sh @@ -261,8 +261,10 @@ if [ -b "${FLAGS_to}" ]; then echo "Done." else # Output to a file, so just make a copy. - echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." - ${COMMON_PV_CAT} "${SRC_IMAGE}" >"${FLAGS_to}" + if [ "${SRC_IMAGE}" != "${FLAGS_to}" ]; then + echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." + ${COMMON_PV_CAT} "${SRC_IMAGE}" >"${FLAGS_to}" + fi echo "Done. To copy to a USB/MMC drive, do something like:" echo " sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M oflag=sync"