summaryrefslogtreecommitdiffstats
path: root/aports/abuild.lua
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-12-31 09:16:00 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-12-31 09:16:00 +0000
commitbf7667ecdfd084fc062333ee52f9b96e694d6de0 (patch)
treeae90e671251d1c553ceefd10938e690c7975dd57 /aports/abuild.lua
parent10769cccbfe6b06d8f957377afaabeeacbc53891 (diff)
downloadlua-aports-bf7667ecdfd084fc062333ee52f9b96e694d6de0.tar.bz2
lua-aports-bf7667ecdfd084fc062333ee52f9b96e694d6de0.tar.xz
abuild: split out abuild conf related functions
Diffstat (limited to 'aports/abuild.lua')
-rw-r--r--aports/abuild.lua26
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