Skip to content
Snippets Groups Projects
Commit 94c7dfa6 authored by Natanael Copa's avatar Natanael Copa
Browse files

aports.lua: try get vars from env var before parsing abuild.conf

parent bbd9f10d
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment