summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-07-25 08:58:54 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-07-26 03:46:53 +0000
commitfc77b3af1fd0606343a1d9a3694a64853396e43f (patch)
tree1b7872f58bbf6a5890a5f90e77b332861a38fe38
parentAdding reference to manpage in 'no such container command' error message. (diff)
downloadcompute-tools-fc77b3af1fd0606343a1d9a3694a64853396e43f.tar.xz
compute-tools-fc77b3af1fd0606343a1d9a3694a64853396e43f.zip
Adding check for writable gpg directory in container key command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
-rwxr-xr-xlibexec/container/key9
1 files changed, 9 insertions, 0 deletions
diff --git a/libexec/container/key b/libexec/container/key
index 5f76fb2..679e636 100755
--- a/libexec/container/key
+++ b/libexec/container/key
@@ -87,6 +87,15 @@ then
Usage
fi
+if [ ! -w "${KEYS}" ]
+then
+ if [ "$(id -u)" -ne 0 ]
+ then
+ echo "'${COMMAND}': need root privileges (or write permissions to '${KEYS}')" >&2
+ exit 1
+ fi
+fi
+
# Pre hooks
for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
do