[PATCH 25/33] 99base: warn on invalid command for initqueue

Thomas Renninger
2014-11-20T14:57:00Z

From: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>

When 'initqueue' is called with an invalid command it'll generate
invalid job scripts. This will lead to confusing error messages
later on.
So abort in these cases and print out a warning.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
Signed-off-by: Thomas Renninger <trenn-l3A5Bk7waGM@public.gmane.org>
---
modules.d/99base/initqueue.sh | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/modules.d/99base/initqueue.sh b/modules.d/99base/initqueue.sh
index 4a07da3..193cc5c 100755
--- a/modules.d/99base/initqueue.sh
+++ b/modules.d/99base/initqueue.sh
@@ -42,6 +42,10 @@ exe=$1
shift

[ -x "$exe" ] || exe=$(command -v $exe)
+if [ -z "$exe" ] ; then
+ echo "Invalid command"
+ exit 1
+fi

{
[ -n "$onetime" ] && echo '[ -e "$job" ] && rm -f -- "$job"'
--
1.8.5.2