diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-09-30 11:56:43 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-09-30 11:56:43 +0000 |
commit | 94c7dfa6b90082b90c8efd88e2fa178ef28ab47b (patch) | |
tree | d666481ae00fb34232256c990a1df6b8a9022a5a /aports.lua | |
parent | bbd9f10d249f107453a12ee5dc912b68e41c5b76 (diff) | |
download | abuild-94c7dfa6b90082b90c8efd88e2fa178ef28ab47b.tar.gz abuild-94c7dfa6b90082b90c8efd88e2fa178ef28ab47b.tar.bz2 abuild-94c7dfa6b90082b90c8efd88e2fa178ef28ab47b.tar.xz abuild-94c7dfa6b90082b90c8efd88e2fa178ef28ab47b.zip |
aports.lua: try get vars from env var before parsing abuild.conf
Diffstat (limited to 'aports.lua')
-rwxr-xr-x | aports.lua | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -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 |