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