diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-26 03:57:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-26 03:57:11 +0000 |
commit | f277567cc45fc61cfca8ba30d89813855440eb93 (patch) | |
tree | 2268932e0e1cb4bdd65cc17b1c3b0070d6db10d7 /libexec/container/key | |
parent | Adding upstream version 20210725. (diff) | |
download | open-infrastructure-compute-tools-upstream/20210726.tar.xz open-infrastructure-compute-tools-upstream/20210726.zip |
Adding upstream version 20210726.upstream/20210726
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libexec/container/key')
-rwxr-xr-x | libexec/container/key | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/libexec/container/key b/libexec/container/key index 5f76fb2..19b7fa9 100755 --- a/libexec/container/key +++ b/libexec/container/key @@ -76,7 +76,7 @@ Parameters () Usage () { - echo "Usage: ${PROGRAM} ${COMMAND} [-a|--add KEY] [-l|--list] [-r|--remove KEY]" >&2 + echo "Usage: ${PROGRAM} ${COMMAND} [-a|--add KEY_FILE|KEY_ID] [-l|--list] [-r|--remove KEY|KEY_ID]" >&2 exit 1 } @@ -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 @@ -105,7 +114,7 @@ then chmod 0700 "${KEYS}" cat > "${KEYS}/gnupg.conf" << EOF -keyserver hkps://hkps.pool.sks-keyservers.net +keyserver hkps://keys.openpgp.org keyserver-options include-revoked keyserver-options no-honor-keyserver-url @@ -131,7 +140,18 @@ fi case "${ACTION}" in add) - gpg --homedir "${KEYS}" --import "${ADD}" + if [ -e "${ADD}" ] + then + gpg --homedir "${KEYS}" --import "${ADD}" + elif [ -e "/usr/share/compute-tools/keys/${ADD}" ] + then + gpg --homedir "${KEYS}" --import "/usr/share/compute-tools/keys/${ADD}" + elif [ -e "/usr/share/compute-tools/keys/${ADD}.pub" ] + then + gpg --homedir "${KEYS}" --import "/usr/share/compute-tools/keys/${ADD}.pub" + else + gpg --homedir "${KEYS}" --recv "${ADD}" + fi ;; list) |