diff options
author | Christian Pointner <equinox@spreadspace.org> | 2017-11-21 22:28:39 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2017-11-21 22:28:39 +0100 |
commit | 91cd5480b5a1ca1103d5e239af3d331477c41c2c (patch) | |
tree | b495bf31e2d5da50b045838a1e8d0455db09ee65 /gpg/add-key.sh |
initial commit as copy from helsinki ansible repo
Diffstat (limited to 'gpg/add-key.sh')
-rwxr-xr-x | gpg/add-key.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gpg/add-key.sh b/gpg/add-key.sh new file mode 100755 index 00000000..98e29174 --- /dev/null +++ b/gpg/add-key.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "no keyfile specified, reading from stdin ..." +fi + +"${BASH_SOURCE%/*}/gpg2.sh" --import $@ +if [ $? -ne 0 ]; then + echo -e "\nERROR: import key(s) failed. Please revert any changes of the file gpg/vault-keyring.gpg." + exit 1 +fi + +echo "" +"${BASH_SOURCE%/*}/get-vault-pass.sh" | "${BASH_SOURCE%/*}/set-vault-pass.sh" +if [ $? -ne 0 ]; then + echo -e "\nERROR: reencrypting vault password file failed!" + echo " You might want to revert any changes on gpg/vault-pass.gpg and gpg/vault-keyring.gpg!!" + exit 1 +fi +echo "Successfully reencrypted vault password file!" +echo " Don't forget to commit the changes in gpg/vault-pass.gpg and gpg/vault-keyring.gpg." |