Blame 0049-99base-warn-on-invalid-command-for-initqueue.patch

Harald Hoyer b94732
From 7c2311660f3f540c2ad9471bcc13686899d677cd Mon Sep 17 00:00:00 2001
Harald Hoyer b94732
From: Hannes Reinecke <hare@suse.de>
Harald Hoyer b94732
Date: Thu, 11 Dec 2014 15:46:10 +0100
Harald Hoyer b94732
Subject: [PATCH] 99base: warn on invalid command for initqueue
Harald Hoyer b94732
Harald Hoyer b94732
When 'initqueue' is called with an invalid command it'll generate
Harald Hoyer b94732
invalid job scripts. This will lead to confusing error messages
Harald Hoyer b94732
later on.
Harald Hoyer b94732
So abort in these cases and print out a warning.
Harald Hoyer b94732
Harald Hoyer b94732
Signed-off-by: Hannes Reinecke <hare@suse.de>
Harald Hoyer b94732
Signed-off-by: Thomas Renninger <trenn@suse.de>
Harald Hoyer b94732
---
Harald Hoyer b94732
 modules.d/99base/initqueue.sh | 4 ++++
Harald Hoyer b94732
 1 file changed, 4 insertions(+)
Harald Hoyer b94732
Harald Hoyer b94732
diff --git a/modules.d/99base/initqueue.sh b/modules.d/99base/initqueue.sh
Harald Hoyer b94732
index 4a07da3..193cc5c 100755
Harald Hoyer b94732
--- a/modules.d/99base/initqueue.sh
Harald Hoyer b94732
+++ b/modules.d/99base/initqueue.sh
Harald Hoyer b94732
@@ -42,6 +42,10 @@ exe=$1
Harald Hoyer b94732
 shift
Harald Hoyer b94732
 
Harald Hoyer b94732
 [ -x "$exe" ] || exe=$(command -v $exe)
Harald Hoyer b94732
+if [ -z "$exe" ] ; then
Harald Hoyer b94732
+    echo "Invalid command"
Harald Hoyer b94732
+    exit 1
Harald Hoyer b94732
+fi
Harald Hoyer b94732
 
Harald Hoyer b94732
 {
Harald Hoyer b94732
     [ -n "$onetime" ] && echo '[ -e "$job" ] && rm -f -- "$job"'