-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathautocurl.txt
78 lines (65 loc) · 1.74 KB
/
autocurl.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
# Auto-build the daily git extract of curl. Parameters are:
# 1: email address to notify when this script runs
# 2: proxy url (if required)
# 3: proxy userid (if required)
# Run $CURLDIR/tests/testcurl.pl once manually to generate a file called
# 'setup' in the build directory.
if [ $1 ]; then
NOTIFY=$1
fi
if [ $2 ]; then
PROXY=$2
fi
if [ $3 ]; then
PROXYUSER=$3
fi
# A few configurable bits
# How and where to send the results
mail="mail -s autobuild [email protected]"
# Where to find the latest source
URL="https://curl.se/snapshots/"
# Where to find a curl binary to use to download the source code
CURL=curl
# Where to run the auto-build
BUILD="`dirname $0`"
# A bunch of standard options, to start with...
CURLOPTS="-s -S -L -b cookies -c cookies"
# Got proxy?
if [ $PROXY ]; then
CURLOPTS="$CURLOPTS -x $PROXY"
fi
# Need authentication?
if [ $PROXYUSER ]; then
CURLOPTS="$CURLOPTS -U $PROXYUSER"
fi
notify () {
if [ $NOTIFY ]; then
echo "$1" | mail -s "curl autobuild" $NOTIFY
fi
}
# The new file is ready around 0200h UTC
TODAY=`env TZ=Etc/GMT+2 date +%Y%m%d`
cd "$BUILD"
# Parse the daily builds index page for today's file name
NEWCURLURL=`$CURL $CURLOPTS $URL | grep "href=.*$TODAY.tar.bz2" | sed -e 's/^.*href="//' -e 's/".*//'`
NEWCURL=`basename $NEWCURLURL`
if [ ! -r "$NEWCURL" ] ; then
$CURL $CURLOPTS -o $NEWCURL $URL$NEWCURL
fi
ret=$?
if [ "$ret" -eq "0" ]; then
LIST=`bzip2 -dc $NEWCURL | tar xvf - | wc -l`
ret=$?
if [ $LIST -eq 0 -o $ret -gt 0 ]; then
notify "Empty tar file?"
exit
fi
CURLDIR=`echo $NEWCURL | sed -e 's/.tar.bz2//'`
$CURLDIR/tests/testcurl.pl $CURLDIR | $mail
notify "build OK: $NEWCURL"
rm -r "$CURLDIR"
rm -f "$NEWCURL"
else
notify "build failed: $NEWCURL"
fi