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

Unified Diff: src/scripts/image_to_usb.sh

Issue 522014: Make image_to_usb.sh warn if given a partition. (Closed)
Patch Set: make check more robust Created 11 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/image_to_usb.sh
diff --git a/src/scripts/image_to_usb.sh b/src/scripts/image_to_usb.sh
index 7aa6707d29a3620894fa4742782d795621d5e0e8..f8248364365f13c4f0a367c19f4b145d1708da51 100755
--- a/src/scripts/image_to_usb.sh
+++ b/src/scripts/image_to_usb.sh
@@ -55,6 +55,18 @@ then
# Output to a block device (i.e., a real USB key), so need sudo dd
echo "Copying USB image ${FLAGS_from} to device ${FLAGS_to}..."
+ # Warn if it looks like they supplied a partition as the destination.
+ if echo $FLAGS_to | grep -q '[0-9]$'; then
+ drive=$(echo $FLAGS_to | sed -re 's/[0-9]+$//')
+ if [ -b "$drive" ]; then
+ echo
+ echo "NOTE: It looks like you may have supplied a partition as the "
+ echo "destination. This script needs to write to the drive's device "
+ echo "node instead (i.e. ${drive} rather than ${FLAGS_to})."
+ echo
+ fi
+ fi
+
# Make sure this is really what the user wants, before nuking the device
if [ $FLAGS_yes -ne $FLAGS_TRUE ]
then
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698