From db1314ac55df59e1fbecdae280cf2b4c1784dd5a Mon Sep 17 00:00:00 2001 From: Dubiousjim Date: Fri, 5 Jul 2013 00:21:16 -0400 Subject: various: move conf-loading and i/o to functions --- checkapk.in | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'checkapk.in') diff --git a/checkapk.in b/checkapk.in index 9c1d9fd..e95249e 100644 --- a/checkapk.in +++ b/checkapk.in @@ -6,24 +6,22 @@ # Distributed under GPL-2 # -die() { - echo "$@" >&2 +abuild_ver=@VERSION@ +datadir=@datadir@ + +if ! [ -f "$datadir/functions.sh" ]; then + echo "$datadir/functions.sh: not found" >&2 exit 1 -} +fi +. "$datadir/functions.sh" + -msg() { - echo "$@" -} -have_abuild_conf= -for conf in /etc/abuild.conf ~/.abuild/abuild.conf; do - if [ -f "$conf" ]; then - . $conf && have_abuild_conf=yes - fi -done -[ -z "$have_abuild_conf" ] && die "no abuild.conf found" +if ! [ -f "$abuild_conf" ] && ! [ -f "$abuild_userconf" ]; then + die "no abuild.conf found" +fi if ! [ -f APKBUILD ]; then die 'This must be run in the directory of a built package.' -- cgit v1.2.3