diff --git a/aports.lua b/aports.lua index a553c60b314552a76905820d9189ea9456a38db4..1959097a3a6e5338fe991a790ecb3cd281613964 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