#!/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 curl-autocompile@haxx.se" # 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