summaryrefslogtreecommitdiff
path: root/aports.lua
diff options
context:
space:
mode:
Diffstat (limited to 'aports.lua')
-rwxr-xr-xaports.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/aports.lua b/aports.lua
index a553c60..1959097 100755
--- a/aports.lua
+++ b/aports.lua
@@ -5,11 +5,21 @@ abuild_conf_file = "/etc/abuild.conf"
local abuild_conf = {}
function get_abuild_conf(var)
- if abuild_conf[var] == nil then
- local f = io.popen(" . "..abuild_conf_file..' ; echo -n "$'..var..'"')
- abuild_conf[var] = f:read("*all")
- f:close()
+ -- 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(" . "..abuild_conf_file..' ; echo -n "$'..var..'"')
+ abuild_conf[var] = f:read("*all")
+ f:close()
return abuild_conf[var]
end