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 check_service_name "$serviceName"
39 if [ "$PROMPT" = "true" ] ; then
40 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
42 if [ "${OK/y/Y}" != 'Y' ] ; then
43 failure "Service name not added."
46 log debug "adding service name without prompting."
49 # execute edit-key script
50 if PEM2OPENPGP_USAGE_FLAGS=authenticate \
51 <"$GNUPGHOME_HOST/secring.gpg" \
52 "$SYSSHAREDIR/keytrans" adduserid "$keyID" "$serviceName" \
53 | gpg_host --import ; then
55 gpg_host --check-trustdb
62 echo "NOTE: Service name added to key, but key not published."
63 echo "Run '$PGRM publish-key' to publish the new service name."
65 failure "Problem adding service name."