[PATCH modular] Verify existence of command specified by --cmd.

Trevor Woerner twoerner at gmail.com
Sat Oct 30 05:09:41 PDT 2010


From: Trevor Woerner <twoerner at gmail.com>

If the user specifies a 'git' or 'g/make' --cmd, make sure it
exists before trying to use it.

Signed-off-by: Trevor Woerner <twoerner at gmail.com>
---
 build.sh |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/build.sh b/build.sh
index 275a1e1..bf67ebd 100755
--- a/build.sh
+++ b/build.sh
@@ -1059,6 +1059,16 @@ do
 	shift
 	cmd1=`echo $1 | cut -d' ' -f1`
 	cmd2=`echo $1 | cut -d' ' -f2`
+
+	# verify the command exists
+	which $cmd1 > /dev/null 2>&1
+	if [ $? -ne 0 ]; then
+	    echo "The specified command '$cmd1' does not appear to exist"
+	    echo ""
+	    usage
+	    exit 1
+	fi
+
 	case X"$cmd1" in
 	    X"git")
 		GITCMD=$1
-- 
1.7.3.2.146.gca209



More information about the xorg-devel mailing list