From 781a4537341035238ae6b6f5e63ca1e991b9642c Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 6 Jul 2011 06:30:42 +0000 Subject: 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 --- ap.in | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ap.in') diff --git a/ap.in b/ap.in index bc9d075..81b11f6 100755 --- a/ap.in +++ b/ap.in @@ -1,6 +1,7 @@ #!/usr/bin/lua require("aports") +require("lfs") local db @@ -105,6 +106,14 @@ if cmd == nil then return 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 db = aports.new(repodirs) subcmd[cmd].run(opts) -- cgit v1.2.3-70-g09d2