aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Mortier <mort@cantab.net>2019-09-13 14:19:10 +0100
committerRichard Mortier <mort@cantab.net>2019-09-13 14:19:10 +0100
commiteed1a4d608fdb061a9f3e9d06bc10dfc3db6d8c9 (patch)
treed02bc204401a69d981c65fe4aac003c6f466fda2
parent55dbf2a7257bc0d7c44b37e98e26036c9032eb39 (diff)
downloaddocker-abuild-eed1a4d608fdb061a9f3e9d06bc10dfc3db6d8c9.tar.bz2
docker-abuild-eed1a4d608fdb061a9f3e9d06bc10dfc3db6d8c9.tar.xz
entrypoint: test if `~/.abuild` writable, fail if not
Signed-off-by: Richard Mortier <mort@cantab.net>
-rwxr-xr-xentrypoint.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/entrypoint.sh b/entrypoint.sh
index 9aa1adb..c9dfc55 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -2,12 +2,22 @@
set -e
+die () {
+ printf >&2 "%s\n" "$@"
+ exit 1
+}
+
## debug
if [ "$DABUILD_DEBUG" = "true" ]; then
set -x
PS4='$LINENO: '
fi
+## check can write to ~/.abuild
+if [ ! -w "$HOME/.abuild/" ]; then
+ die "Error: unwritable ~/.abuild [$(ls -lad ~/.abuild | cut -d " " -f 1)]"
+fi
+
## generate signing keys on first run
if [ ! -r "$HOME/.abuild/abuild.conf" ]; then
abuild-keygen -n -a