summaryrefslogtreecommitdiffstats
path: root/functions.sh.in
diff options
context:
space:
mode:
authorDubiousjim <dubiousjim@gmail.com>2013-07-05 00:21:38 -0400
committerNatanael Copa <ncopa@alpinelinux.org>2013-07-09 07:13:13 +0000
commit89afa4179287af307e298f6027dc4eee44bcf481 (patch)
treebfac8308d9f8769e0b076301f0b9c811a1de9742 /functions.sh.in
parentb2d6b47be1ae42ff6271cfa31283a518ea5949ef (diff)
downloadabuild-89afa4179287af307e298f6027dc4eee44bcf481.tar.bz2
abuild-89afa4179287af307e298f6027dc4eee44bcf481.tar.xz
apkgrel, functions: refactor calculation of APKBUILD's path
Diffstat (limited to 'functions.sh.in')
-rw-r--r--functions.sh.in13
1 files changed, 13 insertions, 0 deletions
diff --git a/functions.sh.in b/functions.sh.in
index a25c39a..ab4dff5 100644
--- a/functions.sh.in
+++ b/functions.sh.in
@@ -30,6 +30,19 @@ aports_buildscript() {
fi
}
+# expects $1 to be a file, or a directory containing an APKBUILD, or a package directory in the aports tree
+# outputs APKBUILD's path if successful (doesn't verify that it's a valid APKBUILD)
+any_buildscript() {
+ if [ -f "$1" ]; then
+ echo "$1"
+ elif [ -d "$1" ]; then
+ [ -f "$1/APKBUILD" ] || return 1
+ echo "$1/APKBUILD"
+ else
+ aports_buildscript "$1" || return 1
+ fi
+}
+
# output functions
case $prog in