summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2018-11-23 09:56:17 +1300
committerPaul Eggleton <paul.eggleton@linux.intel.com>2019-07-02 16:11:06 +1200
commitdc6f669e7b7dbb7b97f8cea4b5f57b2bbb9bc885 (patch)
tree47371181d775964c9ac17d51cbc113af47698ff3
parent24303f66435b1e8a5b58948ce97530b055631ecd (diff)
downloadopenembedded-core-contrib-dc6f669e7b7dbb7b97f8cea4b5f57b2bbb9bc885.tar.gz
scripts/contrib/ddimage: be explicit whether device doesn't exist or isn't writeable
Make the error messages a little more friendly. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-xscripts/contrib/ddimage9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/contrib/ddimage b/scripts/contrib/ddimage
index a7dc5f7487..7f2ad112a6 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