ap: set default repodir
if there are an APKBUILD in current dir, then use ../ as repodir. Otherwise, use cwd as repodir. Introduces requirement of lua-filesystem
This commit is contained in:
parent
66501a24b4
commit
781a453734
9
ap.in
9
ap.in
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/lua
|
#!/usr/bin/lua
|
||||||
|
|
||||||
require("aports")
|
require("aports")
|
||||||
|
require("lfs")
|
||||||
|
|
||||||
local db
|
local db
|
||||||
|
|
||||||
@ -105,6 +106,14 @@ if cmd == nil then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if #repodirs == 0 then
|
||||||
|
if lfs.attributes("APKBUILD") then
|
||||||
|
repodirs[1] = string.gsub(lfs.currentdir(), "(.*)/.*", "%1")
|
||||||
|
else
|
||||||
|
repodirs[1] = lfs.currentdir()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if subcmd[cmd] and type(subcmd[cmd].run) == "function" then
|
if subcmd[cmd] and type(subcmd[cmd].run) == "function" then
|
||||||
db = aports.new(repodirs)
|
db = aports.new(repodirs)
|
||||||
subcmd[cmd].run(opts)
|
subcmd[cmd].run(opts)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user