SOURCES: webapps.sh - error checks

glen glen at pld-linux.org
Sun Nov 20 19:03:35 CET 2005


Author: glen                         Date: Sun Nov 20 18:03:35 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- error checks

---- Files affected:
SOURCES:
   webapps.sh (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: SOURCES/webapps.sh
diff -u SOURCES/webapps.sh:1.3 SOURCES/webapps.sh:1.4
--- SOURCES/webapps.sh:1.3	Sun Nov 20 18:58:39 2005
+++ SOURCES/webapps.sh	Sun Nov 20 19:03:30 2005
@@ -17,18 +17,35 @@
 Usage: $0 register httpd webapp
 Usage: $0 unregister httpd webapp
 
-Where httpd one of the webservers
+Where httpd is one of the webservers
 apache 1.x: apache
 apache 2.x: httpd
 lighttpd: lighttpd
 EOF
 }
 
+die() {
+	echo >&2 "$0: $*"
+	exit 1
+}
+
+checkconfig() {
+	# sanity check
+	if [ ! -d "$webapps/$app" ]; then
+		die "Missing directory: $webapps/$app"
+	fi
+	if [ ! -d "/etc/$httpd/webapps" ]; then
+		die "Missing directory: /etc/$httpd/webapps"
+	fi
+}
+
 case "$action" in
 register)
+	checkconfig
 	webapp_register
 	;;
 unregister)
+	checkconfig
 	webapp_unregister
 	;;
 *)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/webapps.sh?r1=1.3&r2=1.4&f=u




More information about the pld-cvs-commit mailing list