]> git.sur5r.net Git - i3/i3/blob - contrib/show-download-count.sh
dump-asy.pl: use correct tmp dirname instead of hardcoded /tmp
[i3/i3] / contrib / show-download-count.sh
1 #!/bin/sh
2 # © 2012 Han Boetes <han@mijncomputer.nl> (see also: LICENSE)
3  
4 YEAR=`date "+%Y"`
5 weblog=$(mktemp)
6 zcat $(find /var/log/lighttpd/build.i3wm.org -type f -name "access.log.*.gz" | sort | tail -5) > $weblog
7 # this will match the latest logfile, which is not yet gzipped
8 find /var/log/lighttpd/build.i3wm.org/log$YEAR -type f \! -name "access.log.*.gz" -exec cat '{}' \; >> $weblog
9 cat /var/log/lighttpd/build.i3wm.org/access.log >> $weblog
10 gitlog=$(mktemp)
11  
12 # create a git output logfile. Only keep the first 6 chars of the release hash
13 git log -150 --pretty='        %h %s' next > $gitlog
14
15 awk '/i3-wm_.*\.deb/ {print $7}' $weblog|awk -F'/' '{print $NF}'|awk -F'_' '{print $2 }'|awk -F'-' '{print $NF}' |cut -c 2-8|sort |uniq -c | while read line; do
16     set -- $line
17     # $1 is the number of downloads, $2 is the release md5sum
18     sed -i "/$2/s|^        |$(printf '%3i' $1) d/l |" $gitlog
19 done
20
21 cat $gitlog
22 rm $gitlog
23 rm $weblog