Merge commit 'dkg/master'
[monkeysphere.git] / src / subcommands / mh / import-key
old mode 100755 (executable)
new mode 100644 (file)
index d60e982..386e02d
@@ -1,14 +1,17 @@
-#!/usr/bin/env bash
+# -*-shell-script-*-
+# This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
 
 # Monkeysphere host import-key subcommand
 #
 # The monkeysphere scripts are written by:
-# Jameson Rollins <jrollins@fifthhorseman.net>
+# Jameson Rollins <jrollins@finestructure.net>
 # Jamie McClelland <jm@mayfirst.org>
 # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
 #
-# They are Copyright 2008, and are all released under the GPL, version 3
-# or later.
+# They are Copyright 2008-2009 and are all released under the GPL,
+# version 3 or later.
+
+import_key() {
 
 local hostName=$(hostname -f)
 local keyFile="/etc/ssh/ssh_host_rsa_key"
@@ -23,10 +26,6 @@ fingerprint_server_key >/dev/null \
 # get options
 while true ; do
        case "$1" in
-           -h|--hostname)
-               hostName="$2"
-               shift 2
-               ;;
            -f|--keyfile)
                keyFile="$2"
                shift 2
@@ -40,6 +39,9 @@ while true ; do
                    failure "Unknown option '$1'.
 Type '$PGRM help' for usage."
                fi
+               hostName="$1"
+               shift
+               ;;
                break
                ;;
        esac
@@ -83,3 +85,5 @@ log info "SSH host public key in OpenPGP form: ${SYSDATADIR}/ssh_host_rsa_key.pu
 
 # show info about new key
 show_key
+
+}