summaryrefslogtreecommitdiffstats
path: root/bin/buildrepo.lua
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2019-01-09 11:30:52 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2019-01-09 13:49:24 +0000
commitba89aa5a3f0d7632327d83f1deadc8d03f020c08 (patch)
tree5c3febd96ec72a8ac33d46515073b49675bbbb69 /bin/buildrepo.lua
parent10d9b456afb0f9eba3c24a68b2861f94dc129e07 (diff)
downloadlua-aports-ba89aa5a3f0d7632327d83f1deadc8d03f020c08.tar.bz2
lua-aports-ba89aa5a3f0d7632327d83f1deadc8d03f020c08.tar.xz
buildrepo: add support for config file
Diffstat (limited to 'bin/buildrepo.lua')
-rwxr-xr-xbin/buildrepo.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/bin/buildrepo.lua b/bin/buildrepo.lua
index e8f58ce..0b9f494 100755
--- a/bin/buildrepo.lua
+++ b/bin/buildrepo.lua
@@ -6,6 +6,7 @@ local lfs = require("lfs")
local optarg = require("optarg")
local pluginsdir = "/etc/buildrepo/plugins.d"
+local conf = {}
local function warn(formatstr, ...)
io.stderr:write(("WARNING: %s\n"):format(formatstr:format(...)))
@@ -117,6 +118,7 @@ end
-----------------------------------------------------------------
local opthelp = [[
-a, --aports=DIR Set the aports base dir to DIR instead of $HOME/aports
+ -c, --config=FILE Use FILE as config instead of /etc/buildrepo/config.lua
-d, --destdir=DIR Set destination repository base to DIR instead of
$HOME/packages
-h, --help Show this help and exit
@@ -145,10 +147,16 @@ if opts.h then
usage(0)
end
+local configfile = opts.c or "/etc/buildrepo/config.lua"
+local f = loadfile(configfile, "t", conf)
+if f then
+ f()
+end
+
local homedir = os.getenv("HOME")
-local aportsdir = opts.a or ("%s/aports"):format(homedir)
-local repodest = opts.d or abuild.repodest or ("%s/packages"):format(homedir)
-local logdirbase = opts.l
+local aportsdir = opts.a or conf.aportsdir or ("%s/aports"):format(homedir)
+local repodest = opts.d or conf.repodest or abuild.repodest or ("%s/packages"):format(homedir)
+local logdirbase = opts.l or conf.logdir
if opts.n then
build_aport = function() return true end