summaryrefslogtreecommitdiff
path: root/src/share/ma/remove_certifier
blob: 6ec9a2d8bee07217e4e7ea774eecb2f4158789e9 (plain)
  1. # -*-shell-script-*-
  2. # This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
  3. # Monkeysphere authentication remove-certifier subcommand
  4. #
  5. # The monkeysphere scripts are written by:
  6. # Jameson Rollins <jrollins@finestructure.net>
  7. # Jamie McClelland <jm@mayfirst.org>
  8. # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
  9. #
  10. # They are Copyright 2008-2009, and are all released under the GPL,
  11. # version 3 or later.
  12. # delete a certifiers key from the host keyring
  13. remove_certifier() {
  14. local keyID
  15. local fingerprint
  16. keyID="$1"
  17. if [ -z "$keyID" ] ; then
  18. failure "You must specify the key ID of a key to remove."
  19. fi
  20. # FIXME: should we be doing a fancier list_certifier output here?
  21. gpg_core --list-key --fingerprint "0x${keyID}!" || failure
  22. if [ "$PROMPT" != "false" ] ; then
  23. printf "Really remove the above listed identity certifier? (Y/n) " >&2
  24. read OK; OK=${OK:-Y}
  25. if [ "${OK/y/Y}" != 'Y' ] ; then
  26. failure "Identity certifier not removed."
  27. fi
  28. else
  29. log debug "certifier removed without prompting."
  30. fi
  31. # delete the requested key from the sphere keyring
  32. if gpg_sphere --delete-key --batch --yes "'0x${keyID}!'" ; then
  33. # delete key from core keyring as well
  34. gpg_core --delete-key --batch --yes "0x${keyID}!"
  35. # update the trustdb for the authentication keyring
  36. gpg_sphere --check-trustdb
  37. log info "Identity certifier removed."
  38. else
  39. failure "Problem removing identity certifier."
  40. fi
  41. }