[Fusionforge-commits] r14178 - trunk/src/utils

Olivier Berger olberger at fusionforge.org
Mon Aug 22 17:33:50 CEST 2011


Author: olberger
Date: 2011-08-22 17:33:49 +0200 (Mon, 22 Aug 2011)
New Revision: 14178

Modified:
   trunk/src/utils/list-enabled-plugins.sh
Log:
Safeguard angainst trailing semi-colons (comments)

Modified: trunk/src/utils/list-enabled-plugins.sh
===================================================================
--- trunk/src/utils/list-enabled-plugins.sh	2011-08-22 12:23:53 UTC (rev 14177)
+++ trunk/src/utils/list-enabled-plugins.sh	2011-08-22 15:33:49 UTC (rev 14178)
@@ -1,5 +1,9 @@
 #! /bin/sh
 
+# Lists which plugins are enabled or disabled.
+
+# Takes into account the 'plugin_status = valid' values if the plugin's etc/pluginname.ini file exists
+
 if [ -e plugins ] ; then
     cd .
 elif [ -e ../src/plugins ] ; then
@@ -9,22 +13,30 @@
     exit 1
 fi
 
-e=""
-d=""
+enabled=""
+disabled=""
 
 for name in plugins/*/NAME ; do 
     dir=${name%%/NAME}
     plugin=${dir##plugins/}
-    if [ -e $dir/packaging/control/[1-9][0-9][0-9]plugin-$plugin ] \
-	&& ([ ! -e $dir/etc/$plugin.ini ] || [ "$(confget -f $dir/etc/$plugin.ini plugin_status)" = valid ]) ; then
-	e="$e $plugin"
+    if [ -e $dir/packaging/control/[1-9][0-9][0-9]plugin-$plugin ] ; then
+	if [ ! -e $dir/etc/$plugin.ini ] ; then
+	    enabled="$enabled $plugin"
+	else
+	    # confget returns litteral semi-colons after values, so get rid of comments
+	    if [ "$(confget -f $dir/etc/$plugin.ini plugin_status | sed -r 's/[ ^t]*;.*//g')" = "valid" ] ; then
+		enabled="$enabled $plugin"
+	    else
+		disabled="$disabled $plugin"
+	    fi
+	fi
     else
-	d="$d $plugin"
+	disabled="$disabled $plugin"
     fi
 done
 
 if [ "$1" = "--disabled" ] ; then
-    echo $d
+    echo $disabled
 else
-    echo $e
+    echo $enabled
 fi




More information about the Fusionforge-commits mailing list