aa3d3ea0785492ecce5bea1ce4dc069c4b2fe5c5
[dotfiles/scripts.git] / uploaded.sh
1 #!/bin/sh
2
3 set -e
4
5 MAILTO="debian-uploads@lists.kirya.net"
6
7 BASEDIR="/var/www/packages.kirya.net/debian"
8
9 TMPF=`mktemp --tmpdir=$BASEDIR/tmp`
10 cp $1 $TMPF
11
12 reprepro -b $BASEDIR processincoming kirya
13
14 if [ $? = 0 -a -r $TMPF ]; then
15
16         Source=$(grep -m1 ^Source: $TMPF  | awk '{print $2}')
17     Version=$(grep -m1 ^Version: $TMPF  | awk '{print $2}')
18     Architecture=$(grep -m1 ^Architecture: $TMPF  | sed 's/Architecture: //')
19
20         Uploader=$(grep -m1 ^Changed-By: $TMPF | sed 's/Changed-By: //')
21         [ -z "$Uploader" ] && Uploader=$(grep -m1 ^Maintainer: $TMPF | sed 's/Maintainer: //')
22
23     cat $TMPF | mail -a"From: $Uploader" -s"Uploaded $Source $Version ($Architecture) to packages.kirya.net" $MAILTO
24
25 fi
26
27 rm -f $TMPF