From 0a50add8ccd40cd425f93db39e0d7bbee9fc8880 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 26 Jan 2012 20:53:19 +0000 Subject: [PATCH] add show-download-count.sh to git --- show-download-count.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 show-download-count.sh diff --git a/show-download-count.sh b/show-download-count.sh new file mode 100644 index 00000000..95b955a0 --- /dev/null +++ b/show-download-count.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# © 2012 Han Boetes (see also: LICENSE) + +YEAR=`date "+%Y"` +weblog=$(mktemp) +zcat $(find /var/log/lighttpd/build.i3wm.org -type f -name "access.log.*.gz" | sort | tail -5) > $weblog +# this will match the latest logfile, which is not yet gzipped +find /var/log/lighttpd/build.i3wm.org/log$YEAR -type f \! -name "access.log.*.gz" -exec cat '{}' \; >> $weblog +cat /var/log/lighttpd/build.i3wm.org/access.log >> $weblog +gitlog=$(mktemp) + +# create a git output logfile. Only keep the first 6 chars of the release hash +git log -150 --pretty=' %h %s' next > $gitlog + +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 + set -- $line + # $1 is the number of downloads, $2 is the release md5sum + sed -i "/$2/s|^ |$(printf '%3i' $1) d/l |" $gitlog +done + +cat $gitlog +rm $gitlog +rm $weblog -- 2.39.5