2 # This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
4 # Monkeysphere host publish-key subcommand
6 # The monkeysphere scripts are written by:
7 # Jameson Rollins <jrollins@finestructure.net>
8 # Jamie McClelland <jm@mayfirst.org>
9 # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
11 # They are Copyright 2008-2010, and are all released under the GPL,
14 # publish keys to keyserver
21 if [ "$PROMPT" != "false" ] ; then
22 printf "Really publish key '$keyID' to $KEYSERVER? (Y/n) " >&2
24 if [ "${OK/y/Y}" != 'Y' ] ; then
25 failure "key not published."
28 log debug "publishing key '$keyID' without prompting."
31 # create a temporary gnupg directory from which to publish the key
32 export GNUPGHOME=$(msmktempdir)
33 chmod 0700 "$GNUPGHOME"
34 chown "$MONKEYSPHERE_USER":"$MONKEYSPHERE_GROUP" "$GNUPGHOME"
36 # trap to remove tmp dir if break
37 trap "rm -rf $GNUPGHOME" EXIT
39 # import the key into the tmp dir
40 su_monkeysphere_user \
41 "gpg --quiet --import" <"$HOST_KEY_FILE"
44 su_monkeysphere_user \
45 "gpg --keyserver $KEYSERVER --send-keys '0x${keyID}!'"