#!/bin/bash # written by Thimo Neubauer set -e ### settings # your login-data for buildd.net # CHANGE THIS! HOST=`hostname` PASSWD=password # where does your buildd put his progress file? PROGRESSFILE=/home/buildd/build/build-progress # you won't need to configure this :) BASEURL='http://www.buildd.net/cgi/status.phtml?' usage () { echo "Usage: update-buildd.net [status|heartbeat]" echo echo "status sends the name of the package currently building." echo " Should be called every 10 minutes" echo echo "heartbeat updates host entry" echo " Should be called hourly" } if [ $# != 1 ] ; then usage exit 0 fi case $1 in status) ACTION="name" ;; heartbeat) ACTION="update" ;; *) echo Unknown parameter echo usage exit 1;; esac # trick: the CGI-script doesn't change the package name if an empty # one is supplied. Set to a space so that package vanishes when buildd is idle PACKAGE=" " # check for current package if [ -f $PROGRESSFILE ] ; then # is the buildd running? If not, the content of the progress file is wrong if ps axww | grep -qs 'sbuild.*--dist=unstable' >& /dev/null ; then # ok, analyze content of file PACKAGE=`sed -ne 's/\: currently.*//p' < $PROGRESSFILE` fi fi # ok, we're prepared: send data FULLURL="$BASEURL$ACTION=$HOST&p=$PASSWD&building=$PACKAGE" wget -q -O /dev/null "$FULLURL"