From 6794fcbad2ec6666b3face12d24eafd7d36029bf Mon Sep 17 00:00:00 2001 From: Richard Mortier Date: Wed, 1 May 2019 10:34:24 +0100 Subject: dabuild: nicer error handling --- dabuild.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dabuild.in b/dabuild.in index 91b2c50..05e7dfd 100755 --- a/dabuild.in +++ b/dabuild.in @@ -5,6 +5,11 @@ set -e +die () { + printf "%s\n" "$*" >&2 + exit 1 +} + ## debug if [ "$DABUILD_DEBUG" = "true" ]; then set -x @@ -13,8 +18,8 @@ fi ## check running from within an `aports` tree if [ "${PWD%*/aports*}" = "$PWD" ]; then - echo "Error: expecting to be run from within an aports tree!" - echo "Could not find '/aports' in the current path ($PWD)" + die "Error: expecting to be run from within an aports tree!" \ + "Could not find '/aports' in the current path ($PWD)" exit 1 fi -- cgit v1.2.3