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
...@@ -5,11 +5,21 @@ abuild_conf_file = "/etc/abuild.conf" ...@@ -5,11 +5,21 @@ abuild_conf_file = "/etc/abuild.conf"
local abuild_conf = {} local abuild_conf = {}
function get_abuild_conf(var) function get_abuild_conf(var)
if abuild_conf[var] == nil then -- check cache
local f = io.popen(" . "..abuild_conf_file..' ; echo -n "$'..var..'"') if abuild_conf[var] ~= nil then
abuild_conf[var] = f:read("*all") return abuild_conf[var]
f:close()
end 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] return abuild_conf[var]
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment