diff options
-rw-r--r-- | TODO | 8 | ||||
-rwxr-xr-x | src/configure | 12 | ||||
-rw-r--r-- | src/gcsd.c | 5 | ||||
-rw-r--r-- | src/module_list.lua | 3 |
4 files changed, 21 insertions, 7 deletions
@@ -1,13 +1,13 @@ * send response to requestor * out-of-order responses - * finish API for command & response dispatch tables * add listener tables (for requests, responses and other messages) - * improve module loader (configurable path) + * config-parser (file and improve parser for modules config) + * finish API for command & response dispatch tables * module API etc. clean-up, finalize, freeze - * config-parser * add modules - tcp - udp - unix - inotify - * exec module, add support for parameters
\ No newline at end of file + * exec module, add support for parameters + * improve module loader (allow multiple search paths) diff --git a/src/configure b/src/configure index 5acbd2f..9b834ab 100755 --- a/src/configure +++ b/src/configure @@ -44,6 +44,7 @@ LUAC='' PREFIX='/usr/local' BINDIR='' ETCDIR='' +MODULESDIR='' MANDIR='' INSTALLMANPAGE=1 EXAMPLESDIR='' @@ -54,7 +55,8 @@ print_usage() { echo " --target=<TARGET> build target i.e. Linux (default: autodetect)" echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)" echo " --bindir=<DIR> the path to the bin directory (default: $PREFIX/bin)" - echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc" + echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc)" + echo " --modulesdir=<DIR> the path to the gcsd modules (default: $PREFIX/lib/gcsd)" echo " --mandir=<DIR> the path to the system man pages (default: $PREFIX/share/man)" echo " --no-manpage dont't install manpage" echo " --examplesdir=<DIR> the path to the examples files (default: $PREFIX/share/examples)" @@ -77,6 +79,9 @@ do --sysconfdir=*) ETCDIR=${arg#--sysconfdir=} ;; + --modulesdir=*) + MODULESDIR=${arg#--modulesdir=} + ;; --mandir=*) MANDIR=${arg#--mandir=} ;; @@ -215,6 +220,10 @@ if [ -z "$ETCDIR" ]; then ETCDIR=$PREFIX/etc fi +if [ -z "$MODULESDIR" ]; then + MODULESDIR=$PREFIX/lib/gcsd +fi + if [ -z "$MANDIR" ]; then MANDIR=$PREFIX/share/man fi @@ -291,6 +300,7 @@ cat > config.h <<EOF #define PREFIX "$PREFIX" #define BINDIR "$BINDIR" #define ETCDIR "$ETCDIR" +#define MODULESDIR "$MODULESDIR" #endif EOF @@ -39,6 +39,7 @@ #include <lauxlib.h> #include "datatypes.h" +#include "config.h" #include "options.h" #include "string_list.h" #include "log.h" @@ -104,6 +105,10 @@ int init_defines(lua_State *L) lua_pushinteger(L, 4); lua_settable(L, -3); + lua_pushliteral(L, "MODULES_PATH"); + lua_pushstring(L, MODULESDIR); + lua_settable(L, -3); + lua_setglobal(L, "defines"); return 0; } diff --git a/src/module_list.lua b/src/module_list.lua index 053d9db..b5766aa 100644 --- a/src/module_list.lua +++ b/src/module_list.lua @@ -33,7 +33,6 @@ module_list = {} module_list.classes = {} -module_list.classes.__path = "./modules" local mt = {} function mt.__index(table, key) local value = rawget(table, key) @@ -41,7 +40,7 @@ function mt.__index(table, key) log.printf(log.DEBUG, "load module class: %s", key) - local filename = table.__path .. "/" .. key .. ".lua" + local filename = defines.MODULES_PATH .. "/" .. key .. ".lua" local chunk, err = loadfile(filename) if (not chunk) then error("failed to load module: " .. err) |