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

Unified Diff: src/scripts/image_to_usb.sh

Issue 1567013: Clean up temporary files and directories left by build_image, etc. (Closed)
Patch Set: Emit scripts to pack/unpack the image. Created 10 years, 9 months 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: src/scripts/image_to_usb.sh
diff --git a/src/scripts/image_to_usb.sh b/src/scripts/image_to_usb.sh
index 60ade0ccbdc60e5457f00412ed2e75c041034f38..b881e1a946d062b6c88aa0e5d59dc26202377a19 100755
--- a/src/scripts/image_to_usb.sh
+++ b/src/scripts/image_to_usb.sh
@@ -18,7 +18,7 @@ get_default_board
# Flags
DEFINE_string board "${DEFAULT_BOARD}" "Board for which the image was built"
DEFINE_string from "" \
- "Directory containing rootfs.image and mbr.image"
+ "Directory containing chromiumos_image.bin"
DEFINE_string to "" "${DEFAULT_TO_HELP}"
DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts" "y"
DEFINE_boolean install_autotest ${FLAGS_FALSE} \
@@ -26,7 +26,7 @@ DEFINE_boolean install_autotest ${FLAGS_FALSE} \
DEFINE_boolean copy_kernel ${FLAGS_FALSE} \
"Copy the kernel to the fourth partition."
DEFINE_boolean test_image "${FLAGS_FALSE}" \
- "Uses test image if available, otherwise creates one as rootfs_test.image."
+ "Copies normal image to chromiumos_test_image.bin, modifies it for test."
DEFINE_string build_root "/build" \
"The root location for board sysroots."
@@ -100,12 +100,14 @@ if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then
fi
STATEFUL_DIR="${FLAGS_from}/stateful_partition"
+mkdir -p "${STATEFUL_DIR}"
function do_cleanup {
echo "Cleaning loopback devices: ${STATEFUL_LOOP_DEV}"
if [ "${STATEFUL_LOOP_DEV}" != "" ]; then
sudo umount "${STATEFUL_DIR}"
sudo losetup -d "${STATEFUL_LOOP_DEV}"
+ rmdir "${STATEFUL_DIR}"
echo "Cleaned"
fi
}
@@ -144,6 +146,7 @@ if [ ${FLAGS_install_autotest} -eq ${FLAGS_TRUE} ] ; then
sudo umount ${STATEFUL_DIR}
sudo losetup -d "${stateful_loop_dev}"
trap - INT TERM EXIT
+ rmdir "${STATEFUL_DIR}"
else
echo "/usr/local/autotest under ${DEFAULT_CHROOT_DIR} is not installed."
echo "Please call make_autotest.sh inside chroot first."

Powered by Google App Engine
This is Rietveld 408576698