]> git.pld-linux.org Git - packages/webapps.git/commitdiff
- fix listing registered webapps
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 5 Jan 2009 15:04:48 +0000 (15:04 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    webapps.sh -> 1.16

webapps.sh

index 87c61c2403f1bfa4ce613482fb60f99ce0785c66..a5492b9bb4278d1cbffae9c6bc2de160e571f623 100644 (file)
@@ -33,29 +33,19 @@ webapp_list() {
        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 @@ unregister)
 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
This page took 0.090066 seconds and 4 git commands to generate.