Merge commit 'dkg/master'
[monkeysphere.git] / src / share / common
index 96fea7721ac3fdc31e7b922b82871a1cf4c4acda..9630bf9adbb2827100c0a7a33f3c9e01e660fcdf 100644 (file)
@@ -21,7 +21,7 @@ SYSCONFIGDIR=${MONKEYSPHERE_SYSCONFIGDIR:-"/etc/monkeysphere"}
 export SYSCONFIGDIR
 
 # monkeysphere version
-VERSION=__VERSION__
+VERSION=0.23~pre
 
 # default log level
 LOG_LEVEL="INFO"
@@ -291,7 +291,7 @@ get_gpg_expiration() {
 
     keyExpire="$1"
 
-    if [ -z "$keyExpire" ]; then
+    if [ -z "$keyExpire" -a "$PROMPT" = 'true' ]; then
        cat >&2 <<EOF
 Please specify how long the key should be valid.
          0 = key does not expire
@@ -1144,3 +1144,14 @@ process_authorized_user_ids() {
 
     update_authorized_keys "${userIDs[@]}"
 }
+
+# takes a gpg key or keys on stdin, and outputs a list of
+# fingerprints, one per line:
+list_primary_fingerprints() {
+    local file="$1"
+    local fake=$(msmktempdir)
+    GNUPGHOME="$fake" gpg --no-tty --quiet --import
+    GNUPGHOME="$fake" gpg --with-colons --fingerprint --list-keys | \
+       awk -F: '/^fpr:/{ print $10 }'
+    rm -rf "$fake"
+}