Make the error messages a little more friendly.

Signed-off-by: Paul Eggleton <[email protected]>
---
 scripts/contrib/ddimage | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/contrib/ddimage b/scripts/contrib/ddimage
index a7dc5f7487b..7f2ad112a62 100755
--- a/scripts/contrib/ddimage
+++ b/scripts/contrib/ddimage
@@ -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
-- 
2.20.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to