]> code.ossystems Code Review - openembedded-core.git/commitdiff
scripts/contrib/ddimage: be explicit whether device doesn't exist or isn't writeable
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 2 Jul 2019 04:12:46 +0000 (16:12 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 3 Jul 2019 08:09:50 +0000 (09:09 +0100)
Make the error messages a little more friendly.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/contrib/ddimage

index a7dc5f7487bee23f3c17f28eab28032972b4e3ac..7f2ad112a6285db3690a14c709d5f9cb8fde1742 100755 (executable)
@@ -122,6 +122,12 @@ if [ ! -e "$IMAGE" ]; then
        exit 1
 fi
 
+if [ ! -e "$DEVICE" ]; then
+       echo "ERROR: Device $DEVICE does not exist"
+       usage
+       exit 1
+fi
+
 if [ "$(uname)" = "Darwin" ]; then
        # readlink doesn't support -f on MacOS, just assume it isn't a symlink
        ACTUAL_DEVICE=$DEVICE
@@ -139,9 +145,8 @@ if is_inuse $ACTUAL_DEVICE ; then
        exit 1
 fi
 
-
 if [ ! -w "$DEVICE" ]; then
-       echo "ERROR: Device $DEVICE does not exist or is not writable"
+       echo "ERROR: Device $DEVICE is not writable - possibly use sudo?"
        usage
        exit 1
 fi