github.com/StackExchange/blackbox/v2@v2.0.1-0.20220331193400-d84e904973ab/bin/blackbox_removeadmin (about) 1 #!/usr/bin/env bash 2 3 # 4 # blackbox_removeadmin -- Remove an admin to the system 5 # NOTE: Does not remove admin from the keyring. 6 # 7 8 # Example: 9 # blackbox_removeadmin tal@example.com 10 # 11 12 set -e 13 source "${0%/*}/_blackbox_common.sh" 14 15 fail_if_not_in_repo 16 17 KEYNAME="$1" 18 : "${KEYNAME:?ERROR: First argument must be a keyname (email address)}" ; 19 20 # Remove the email address from the BB_ADMINS file. 21 remove_line "$BB_ADMINS" "$KEYNAME" 22 23 24 # remove the admin key from the pubring 25 $GPG --no-permission-warning --homedir="$KEYRINGDIR" --batch --yes --delete-key "$KEYNAME" || true 26 pubring_path=$(get_pubring_path) 27 vcs_add "$pubring_path" "$KEYRINGDIR/trustdb.gpg" "$BB_ADMINS" 28 29 30 # Make a suggestion: 31 echo 32 echo 33 echo 'NEXT STEP: Check these into the repo. Probably with a command like...' 34 echo $VCS_TYPE commit -m\'REMOVED ADMIN: $KEYNAME\' "$BLACKBOXDATA/$(basename ${pubring_path})" "$BLACKBOXDATA/trustdb.gpg" "$BLACKBOXDATA/$BB_ADMINS_FILE"