SOURCES: webapps.sh - fix listing registered webapps

glen glen at pld-linux.org
Mon Jan 5 16:04:54 CET 2009


Author: glen                         Date: Mon Jan  5 15:04:54 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fix listing registered webapps

---- Files affected:
SOURCES:
   webapps.sh (1.15 -> 1.16) 

---- Diffs:

================================================================
Index: SOURCES/webapps.sh
diff -u SOURCES/webapps.sh:1.15 SOURCES/webapps.sh:1.16
--- SOURCES/webapps.sh:1.15	Fri Sep 29 12:52:13 2006
+++ SOURCES/webapps.sh	Mon Jan  5 16:04:48 2009
@@ -33,29 +33,19 @@
 	done
 }
 
-# return application list for webserver
+# return registered application list for webserver
 # useful for bash_completion parsing
-webapp_applist() {
+webapp_apps_registered() {
 	local action="$1"
 	local server=$2
 
-	for app in /etc/webapps/*; do
-		[ -d $app ] || continue
-		[ -f $app/$server.conf ] || continue
-		local appname=${app##*/}
-		local link=$(webapp_link $appname)
-
-		case "$action" in
-		*-registered)
-			[ -f /etc/$server/webapps.d/$link.conf ] && echo $appname
-			;;
-		*-unregistered)
-			[ -f /etc/$server/webapps.d/$link.conf ] || echo $appname
-			;;
-		*)
-			echo $appname
-		;;
-		esac
+	for conf in /etc/$server/webapps.d/*.conf; do
+		[ -L $conf ] || continue
+		appname=$(readlink $conf)
+	   	appname=${appname#*$webapps/}
+		appname=${appname%/$server.conf}
+		[ -f /etc/webapps/$appname/$server.conf ] || continue
+		echo $appname
 	done
 }
 
@@ -124,7 +114,17 @@
 list)
 	webapp_list $2
 	;;
-list-apps|list-apps-registered|list-apps-unregistered)
+list-apps)
+		webapp_list_apps
+	;;
+list-apps-registered)
+	if [ "$2" ]; then
+		webapp_apps_registered $action $2
+	else
+		webapp_list_apps
+	fi
+	;;
+list-apps-unregistered)
 	if [ "$2" ]; then
 		webapp_applist $action $2
 	else
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/webapps.sh?r1=1.15&r2=1.16&f=u



More information about the pld-cvs-commit mailing list