diff options
| author | Natanael Copa <ncopa@alpinelinux.org> | 2013-12-31 09:16:00 +0000 |
|---|---|---|
| committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-12-31 09:16:00 +0000 |
| commit | bf7667ecdfd084fc062333ee52f9b96e694d6de0 (patch) | |
| tree | ae90e671251d1c553ceefd10938e690c7975dd57 /aports/abuild.lua | |
| parent | 10769cccbfe6b06d8f957377afaabeeacbc53891 (diff) | |
| download | lua-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.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 |
