[Lunar-commits] <lunar> plugins.lunar: Reload available plugins when a new plugin is installed

Stefan Wold ratler at lunar-linux.org
Mon Feb 8 20:07:45 CET 2010


commit aef2bf89a292b3e25e346f6bb1e6665b8726d9b5
Author: Stefan Wold <ratler at lunar-linux.org>
Date:   Mon Feb 8 20:07:45 2010 +0100

    plugins.lunar: Reload available plugins when a new plugin is installed
    
    This fix a bug when installing several modules by using
    lin -c module1 module2. If module1 install a plugin it would never
    be registered so that module2 could take advantage of it. Plugins
    are normally loaded only once when lin is executed.
---
 var/lib/lunar/functions/plugins.lunar |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/var/lib/lunar/functions/plugins.lunar b/var/lib/lunar/functions/plugins.lunar
index f8dc773..d31c6e2 100644
--- a/var/lib/lunar/functions/plugins.lunar
+++ b/var/lib/lunar/functions/plugins.lunar
@@ -85,6 +85,7 @@ update_plugin() {
 				for PLUGIN in $MOONBASE/$SECTION/$1/plugin.d/*.plugin; do
 					debug_msg "Installed \"$(basename $PLUGIN)\""
 					install -m644 $PLUGIN $PLUGIN_DIR/
+					reload_plugins
 				done
 			elif [ "$2" == "remove" ] || ! module_installed $1 ; then
 				for PLUGIN in $MOONBASE/$SECTION/$1/plugin.d/*.plugin; do
@@ -113,4 +114,16 @@ update_plugins() {
 }
 
 
+reload_plugins() {
+    local ITERATOR
+    debug_msg "reload_plugins($@)"
+
+    # Unload current plugins
+    unset LUNAR_PLUGINS
+
+    for ITERATOR in $PLUGIN_DIR/*.plugin; do
+        . $ITERATOR
+    done
+}
+
 


More information about the Lunar-commits mailing list