diff options
Diffstat (limited to 'aports/abuild.lua')
-rw-r--r-- | aports/abuild.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/aports/abuild.lua b/aports/abuild.lua new file mode 100644 index 0000000..a9fe8cc --- /dev/null +++ b/aports/abuild.lua @@ -0,0 +1,26 @@ + +local M = {} +local abuild_conf = {} +M.conf_file = "/etc/abuild.conf" +M.functions = "/usr/share/abuild/functions.sh" + +function M.get_conf(var) + -- check cache + if abuild_conf[var] ~= nil then + return abuild_conf[var] + end + + -- use os env var + abuild_conf[var] = os.getenv(var) + if abuild_conf[var] ~= nil then + return abuild_conf[var] + end + + -- parse config file + local f = io.popen(" . "..M.conf_file..' ; echo -n "$'..var..'"') + abuild_conf[var] = f:read("*all") + f:close() + return abuild_conf[var] +end + +return M |