summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-03-26 20:26:31 +0000
committerLars Wirzenius <liw@liw.fi>2014-03-26 20:26:31 +0000
commite96e7543c4e759281e8a2d789ed2d2fd4f358ce2 (patch)
tree25cb5342d88042d42bdd723538c09b751b254220 /yarns
parent1645398749e4a833fe836cb4bd3c1471eb068649 (diff)
downloadobnam-e96e7543c4e759281e8a2d789ed2d2fd4f358ce2.tar.gz
Add helpr functions for getting keyid, fingerprint
Diffstat (limited to 'yarns')
-rw-r--r--yarns/obnam.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/yarns/obnam.sh b/yarns/obnam.sh
index 50080d2b..54d76c02 100644
--- a/yarns/obnam.sh
+++ b/yarns/obnam.sh
@@ -158,6 +158,25 @@ manifest()
}
+# Get a GPG fingerprint given a username.
+
+get_fingerprint()
+{
+ gpg --fingerprint "$1" |
+ sed -n '/^ *Key fingerprint = /s///p' |
+ sed 's/ *//g'
+}
+
+
+# Get a GPG keyid given a username.
+
+get_keyid()
+{
+ get_fingerprint "$1" |
+ awk '{ print substr($0, length-8) }'
+}
+
+
# Create a dummy $HOME that actually exists.
export HOME="$DATADIR/home"
mkdir -p "$HOME"