aports.lua: try get vars from env var before parsing abuild.conf
This commit is contained in:
parent
bbd9f10d24
commit
94c7dfa6b9
14
aports.lua
14
aports.lua
|
@ -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
|
||||||
|
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..'"')
|
local f = io.popen(" . "..abuild_conf_file..' ; echo -n "$'..var..'"')
|
||||||
abuild_conf[var] = f:read("*all")
|
abuild_conf[var] = f:read("*all")
|
||||||
f:close()
|
f:close()
|
||||||
end
|
|
||||||
return abuild_conf[var]
|
return abuild_conf[var]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue