2007-07-05 Marcus Brinkmann <marcus@g10code.de>
[gnupg.git] / tools / lspgpot
blobf406392ebb35e238e8937a435d3ed9659b1a42e3
1 #!/bin/sh
2 # lspgpot - script to extract the ownertrust values
3 # from PGP keyrings and list them in GnuPG ownertrust format.
5 # This file is free software; as a special exception the author gives
6 # unlimited permission to copy and/or distribute it, with or without
7 # modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
11 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 if ! gpg --version > /dev/null 2>&1 ; then
14 echo "GnuPG not available!"
15 exit 1
18 gpg --dry-run --with-fingerprint --with-colons $* | awk '
19 BEGIN { FS=":"
20 printf "# Ownertrust listing generated by lspgpot\n"
21 printf "# This can be imported using the command:\n"
22 printf "# gpg --import-ownertrust\n\n" }
23 $1 == "fpr" { fpr = $10 }
24 $1 == "rtv" && $2 == 1 && $3 == 2 { printf "%s:3:\n", fpr; next }
25 $1 == "rtv" && $2 == 1 && $3 == 5 { printf "%s:4:\n", fpr; next }
26 $1 == "rtv" && $2 == 1 && $3 == 6 { printf "%s:5:\n", fpr; next }