aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Mortier <mort@cantab.net>2019-05-01 10:34:24 +0100
committerRichard Mortier <mort@cantab.net>2019-05-01 10:39:00 +0100
commit6794fcbad2ec6666b3face12d24eafd7d36029bf (patch)
treeef93a3b5d15c16525188f67c3877bc456507d29a
parentfcadb0a44470c96830a42f4b56100f27c2b8fe9b (diff)
downloaddocker-abuild-6794fcbad2ec6666b3face12d24eafd7d36029bf.tar.bz2
docker-abuild-6794fcbad2ec6666b3face12d24eafd7d36029bf.tar.xz
dabuild: nicer error handling
-rwxr-xr-xdabuild.in9
1 files 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