]> git.donarmstrong.com Git - wannabuild.git/blob - libtrigger.sh
catch-up commit
[wannabuild.git] / libtrigger.sh
1 ARCHS_oldstable="alpha amd64 arm hppa i386 ia64 mips mipsel powerpc s390 sparc"
2 ARCHS_stable="alpha amd64 arm armel hppa i386 ia64 mips mipsel powerpc s390 sparc"
3 ARCHS_testing="alpha amd64 armel hppa i386 ia64 mips mipsel powerpc s390 sparc"
4 ARCHS_unstable="$ARCHS_testing kfreebsd-amd64 kfreebsd-i386"
5 CURLOPT="-q -s -S -R -f -Y 10 -y 120 -K /srv/wanna-build/trigger.curlrc"
6
7 curl_index () {
8     local url tmpname destname appendname curlopt
9     url="$1"
10     destname="$2"
11     appendname="$3"
12     tmpname=".$destname"
13     rc=0
14     rm -f "$tmpname"
15     if [ -e "$destname" ]; then
16         refdate=`perl -e "print scalar gmtime(((stat ('$destname'))[9]))"`
17         curl $CURLOPT -z "$refdate" "$url" -o "$tmpname"
18         rc=$?
19     else
20         curl $CURLOPT "$url" -o "$tmpname"
21         rc=$?
22     fi
23     if [ $rc -eq 0 -a -e "$tmpname" ]; then
24         if gzip -t "$tmpname"; then
25             mv "$tmpname" "$destname"
26         else
27             rc=$?
28         fi
29     fi
30     gzip -dc "$destname" >> "$appendname"
31     return $rc
32 }
33