grml2iso: make sure to exit properly if provided argument to -c option does not exist
authorMichael Prokop <mika@grml.org>
Tue, 23 Apr 2013 13:15:10 +0000 (15:15 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 23 Apr 2013 13:23:04 +0000 (15:23 +0200)
Otherwise we're hiding the actual error message.

grml2iso

index 0addfb7..8f4d7b8 100755 (executable)
--- a/grml2iso
+++ b/grml2iso
@@ -86,7 +86,7 @@ Options:
     case $name in
       o)   ISOFILE="$OPTARG";;
       b)   GRML2USB_OPTS+=(--bootoptions="$OPTARG");;
     case $name in
       o)   ISOFILE="$OPTARG";;
       b)   GRML2USB_OPTS+=(--bootoptions="$OPTARG");;
-      c)   DIR="$(readlink -f "$OPTARG")";;
+      c)   DIR="$(readlink -f "$OPTARG")"; [ -n "$DIR" ] || { echo "Could not read $OPTARG - exiting" >&2 ; exit 1 ; } ;;
       f)   FORCE='true';;
       r)   GRML2USB_OPTS+=(--remove-bootoption="$OPTARG");;
       p)   GRML2USB_OPTS+=("$OPTARG");;
       f)   FORCE='true';;
       r)   GRML2USB_OPTS+=(--remove-bootoption="$OPTARG");;
       p)   GRML2USB_OPTS+=("$OPTARG");;