2 # This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
4 # Monkeysphere host add-hostname 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 # add servicename user ID to server key
26 failure "You must specify a service name to add."
31 keyID=$(check_key_input "$@")
33 # test that the desired user ID does not already exist
34 check_key_userid "$keyID" "$serviceName" && \
35 failure "Service name '$serviceName' already exists on key '$keyID'."
37 # test that a key with that user ID does not already exist
38 prompt_userid_exists "$serviceName"
40 check_service_name "$serviceName"
42 if [ "$PROMPT" != "false" ] ; then
43 printf "The following service name will be added to key '$keyID':\n %s\nAre you sure you would like to add this service name? (Y/n) " "$serviceName" >&2
45 if [ "${OK/y/Y}" != 'Y' ] ; then
46 failure "Service name not added."
49 log debug "adding service name without prompting."
52 # execute edit-key script
53 if PEM2OPENPGP_USAGE_FLAGS=authenticate \
54 <"$GNUPGHOME_HOST/secring.gpg" \
55 "$SYSSHAREDIR/keytrans" adduserid "$keyID" "$serviceName" \
56 | gpg_host --import ; then
58 gpg_host --check-trustdb
65 echo "NOTE: Service name added to key, but key not published."
66 echo "Run '$PGRM publish-key' to publish the new service name."
68 failure "Problem adding service name."