/[fai]/branches/experimental/mailprocessing-for-thomas
ViewVC logotype

Contents of /branches/experimental/mailprocessing-for-thomas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5762 - (show annotations) (download)
Mon Apr 12 11:31:30 2010 UTC (3 years, 1 month ago) by lange
File size: 1190 byte(s)
move experimental branch to make it more visible
1 #!/bin/bash
2
3 set -v -x
4
5 mailtext=`mktemp -t faiXXX`
6 cat > $mailtext
7
8 log=`mktemp -t faiXXX`
9 date > $log
10
11 LAST_RUN_FILE="/var/run/fai_experimental_latest"
12
13 {
14
15 set -e
16
17 subject="`cat $mailtext | formail -X Subject: | sed 's/^Subject: //'`"
18 if ! echo $subject | egrep -q "^FAI:[[0-9]b~\.]+:[0-9]+$" ; then
19 echo "Subject line $subject does not match pattern" 1>&2
20 exit 1
21 fi
22 rev="`echo $subject | cut -f3 -d:`"
23 if [ -s $LAST_RUN_FILE ] ; then
24 if [ "$(<LAST_RUN_FILE)" -ge $rev ] ; then
25 echo "Already downloaded same or newer version $(<LAST_RUN_FILE)!" 1>&2
26 exit 1
27 fi
28 fi
29
30 cat $mailtext | formail -I "" | while read md5 pkg ; do
31 wget "http://fai.alioth.debian.org/$pkg"
32 our_sum="`md5sum $pkg | awk '{ print $1 }'`"
33 if [ "$md5" != "$our_sum" ] ; then
34 echo "md5sum of $pkg does not match!" 1>&2
35 exit 1
36 fi
37 done
38
39 echo "STATUS: download exit status 0"
40
41 } 2>&1 | tee $log
42
43 date >> $log
44
45 err_found=0
46 if ! grep -q "^STATUS: download exit status 0" $log ; then
47 err_found=1
48 fi
49
50 if [ $err_found -eq 1 ] ; then
51 mail -s "FAI download processing failed!" mt@debian.org < $log
52 else
53 mail -s "FAI download processing successful" mt@debian.org < $log
54 fi
55
56 rm -f $log $mailtext
57

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5