summaryrefslogtreecommitdiff
path: root/src/kiki-export-stdout
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-10-21 20:43:54 -0400
committerAndrew Cady <d@jerkface.net>2019-10-21 20:45:19 -0400
commit0013a8b47a1cf2cdd4f50bba81c786155162825c (patch)
treee60adb7e334a40d2e95cf605464689d692763c8b /src/kiki-export-stdout
parent10e5efaa69c9f0c254db13a84d3312ebaebde5dc (diff)
add commands kiki-import-stdin & kiki-export-stdout
Diffstat (limited to 'src/kiki-export-stdout')
-rwxr-xr-xsrc/kiki-export-stdout35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/kiki-export-stdout b/src/kiki-export-stdout
new file mode 100755
index 0000000..e508a61
--- /dev/null
+++ b/src/kiki-export-stdout
@@ -0,0 +1,35 @@
1#!/bin/sh
2tempd=$(mktemp -d) || exit
3: ${sudo:=sudo}
4
5if [ "$USE_KIKI" ]
6then
7 USE_GPG=
8else
9 USE_GPG=y
10fi
11
12touch "$tempd"/ring.gpg
13key=$($sudo kiki | sed -n -e 's/^master-key \([A-Fa-f0-9]*\) -/\1/p')
14
15if [ "$USE_GPG" ]
16then
17 $sudo gpg --export "$key"
18else
19 $sudo kiki merge \
20 --flow=spill,match="$key" \
21 --home \
22 --flow=fill \
23 --type=keyring --access=public \
24 "$tempd"/ring.gpg
25fi
26r=$?
27
28if [ $r = 0 ]
29then
30 cat "$tempd"/ring.gpg || r=$?
31fi
32
33rm -rf "$tempd"
34exit $r
35