summaryrefslogtreecommitdiff
path: root/src/share/ma/remove_certifier
blob: 95f6dffe8d5cc4accee8cbf0c78c39055a831ec6 (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" = "true" ] ; then
  23. read -p "Really remove above listed identity certifier? (Y/n) " OK; OK=${OK:-Y}
  24. if [ "${OK/y/Y}" != 'Y' ] ; then
  25. failure "Identity certifier not removed."
  26. fi
  27. else
  28. log debug "certifier removed without prompting."
  29. fi
  30. # delete the requested key from the sphere keyring
  31. if gpg_sphere "--delete-key --batch --yes 0x${keyID}!" ; then
  32. # delete key from core keyring as well
  33. gpg_core --delete-key --batch --yes "0x${keyID}!"
  34. # update the trustdb for the authentication keyring
  35. gpg_sphere "--check-trustdb"
  36. log info "Identity certifier removed."
  37. else
  38. failure "Problem removing identity certifier."
  39. fi
  40. }