]> git.sthu.org Git - pgp-tools.git/blob - keyanalyze/willy/report
* debian.control: added ${misc:Depends} as Depends for the keyanalyze
[pgp-tools.git] / keyanalyze / willy / report
1 #!/bin/sh
2
3 input=${1%%/}
4 output=$1/output
5
6 if [ ! -e $input ]; then
7 echo Directory $input not found
8 exit 1
9 fi
10
11 # functions
12
13 update() {
14 if [ -e $input/pubring.ids ]; then
15 grep -v '^#' $input/pubring.ids | xargs \
16 gpg --options $input/options --recv-keys
17 fi
18 test -e $input/pubring.gpg && chmod 644 $input/pubring.gpg
19 rm -f $input/pubring.gpg~
20 }
21
22 analyse() {
23 rm -rf $output
24 pgpring -S -k $input/pubring.gpg \
25 | grep "\(pub\|sig\|rev\|uid\)" \
26 | sed -e "s/^\([a-z]*\).*:\([0-9A-F]\{16\}\):.*/\1 \2/g" \
27 -e "s/^uid:.*/uid/" \
28 | process_keys > $input/preprocess.keys
29 keyanalyze -i $input/preprocess.keys -o $output/
30 rm $input/preprocess.keys
31
32 sort -n -k 3 < $output/msd.txt | nl -s ' ' > $output/msd-sorted.txt
33
34 ./unsign $input
35 cat $output/msd-sorted.txt | ./msd2html $input/options \
36 > $output/top50table.html
37 cp $input/pubring.ids $input/pubring.gpg $output/
38 gpg --options $input/options --export -a >$output/pubring.asc
39 }
40
41 graph() {
42 if [ -e $input/showall ]; then
43 ALL=-a
44 fi
45
46 if [ -e $input/nograph ]; then
47 RSYNC_DELETE=no
48 else
49 echo -n "Graph generation started at "
50 date
51 gpg --options $input/options --list-sigs | \
52 sig2dot $ALL 2>/dev/null | \
53 neato -Tps > $output/graph.ps
54 echo -n "Finished at "
55 date
56 convert $output/graph.ps $output/graph.jpg
57 convert -geometry 320x240 $output/graph.ps \
58 $output/graph-small.jpg
59 fi
60 }
61
62 party() {
63 if [ -e $input/party.ids ]; then
64 gpg --options $input/options --export \
65 `grep -v '^#' $input/party.ids` >$output/party.gpg
66 ./party-table.pl $output/party.gpg >$output/party.html
67 gpg --options $input/options --fingerprint \
68 `grep -v '^#' $input/party.ids` >$output/sassaman.txt
69 md5sum $output/sassaman.txt >$output/sassaman.md5
70 sha1sum $output/sassaman.txt >$output/sassaman.sha1
71 fi
72 }
73
74 report() {
75 if [ -e $input/report_top.$1.in ]; then
76 date=$(date '+%d %B %Y')
77 sed "s/&date;/$date/" <$input/report_top.$1.in \
78 > $output/report.$1
79 cat $output/top50table.html $input/report_bottom.$1.in \
80 >> $output/report.$1
81 rm $output/top50table.html
82 fi
83 if [ -e $input/index.$1 ]; then
84 cp -a $input/index.$1 $output/
85 fi
86 }
87
88 nonrecip() {
89 if [ -e $input/non-recip.in ]; then
90 ./cosign $output/*/* | \
91 grep -E 'has not signed ([1-9][0-9]|[5-9])' | \
92 sort -g -k 1.28 |tac | \
93 ./non-recip $input >$output/non-recip.html
94 fi
95 }
96
97 upload() {
98 if [ -e $input/destination ]; then
99 dest=$(sed -e "s/\$input/$input/" < $input/destination)
100 if [ "$RSYNC_DELETE" = "no" ]; then
101 rsync -az $output/ $dest
102 else
103 rsync -az --delete $output/ $dest
104 fi
105 fi
106 }
107
108 # program
109
110 update
111 analyse
112 graph
113 party
114 report html
115 report php
116 nonrecip
117
118 if [ -x $input/update.sh ]; then
119 $input/update.sh $input $output
120 fi
121
122 upload