diff options
Diffstat (limited to 'gpg/remove-keys.sh')
-rwxr-xr-x | gpg/remove-keys.sh | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gpg/remove-keys.sh b/gpg/remove-keys.sh index 80ae1573..d5fd93c3 100755 --- a/gpg/remove-keys.sh +++ b/gpg/remove-keys.sh @@ -1,9 +1,16 @@ #!/bin/bash if [ -z "$1" ]; then + echo "Usage: $0 <environment> [ <key-id> [ <key-id> [ .. ] ] ]" + exit 1 +fi +NAME="$1" +shift + +if [ -z "$1" ]; then echo "Please specify at least one key ID!" echo "" - echo "You can find out the key ID using the command: gpg/list-keys.sh" + echo "You can find out the key ID using the command: ${0%/*}/list-keys.sh $NAME" echo "" echo " Here is an example output:" echo "" @@ -18,18 +25,18 @@ if [ -z "$1" ]; then exit 1 fi -"${BASH_SOURCE%/*}/gpg2.sh" --delete-keys $@ +"${BASH_SOURCE%/*}/gpg2.sh" $NAME --delete-keys $@ if [ $? -ne 0 ]; then - echo -e "\nERROR: removing key(s) failed. Please revert any changes of the file gpg/vault-keyring.gpg." + echo -e "\nERROR: removing key(s) failed. Please revert any changes of the file gpg/vault-keyring-$NAME.gpg." exit 1 fi echo "" -"${BASH_SOURCE%/*}/get-vault-pass.sh" | "${BASH_SOURCE%/*}/set-vault-pass.sh" +"${BASH_SOURCE%/*}/get-vault-pass-$NAME" | "${BASH_SOURCE%/*}/set-vault-pass.sh" "$NAME" 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!!" + echo " You might want to revert any changes on gpg/vault-pass-$NAME.gpg and gpg/vault-keyring-$NAME.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." +echo " Don't forget to commit the changes in gpg/vault-pass-$NAME.gpg and gpg/vault-keyring-$NAME.gpg." |