Files
blackbox/bin/blackbox_removeadmin
Joseph Herlant 7e3eb624f5 Remove the key from the keyring when removing an admin (#173)
Thanks for the submission!
2018-04-13 13:31:52 -04:00

35 lines
867 B
Bash
Executable File

#!/usr/bin/env bash
#
# blackbox_removeadmin -- Remove an admin to the system
# NOTE: Does not remove admin from the keyring.
#
# Example:
# blackbox_removeadmin tal@example.com
#
set -e
source "${0%/*}/_blackbox_common.sh"
fail_if_not_in_repo
KEYNAME="$1"
: "${KEYNAME:?ERROR: First argument must be a keyname (email address)}" ;
# Remove the email address from the BB_ADMINS file.
remove_line "$BB_ADMINS" "$KEYNAME"
# remove the admin key from the pubring
$GPG --no-permission-warning --homedir="$KEYRINGDIR" --delete-key "$KEYNAME"
pubring_path=$(get_pubring_path)
vcs_add "$pubring_path" "$KEYRINGDIR/trustdb.gpg" "$BB_ADMINS"
# Make a suggestion:
echo
echo
echo 'NEXT STEP: Check these into the repo. Probably with a command like...'
echo $VCS_TYPE commit -m\'REMOVED ADMIN: $KEYNAME\' "$BLACKBOXDATA/trustdb.gpg" "$BLACKBOXDATA/$BB_ADMINS_FILE"