More options and flags.
authorLove Hörnquist Åstrand <lha@kth.se>
Thu, 5 Oct 2006 15:57:38 +0000 (15:57 +0000)
committerLove Hörnquist Åstrand <lha@kth.se>
Thu, 5 Oct 2006 15:57:38 +0000 (15:57 +0000)
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18240 ec53bebd-3082-4978-b11e-865c3cabbd6b

tools/heimdal-build.sh

index 748596423b8e102a9c77829b562e5775a7ec037b..b5983accc3f1d04f4e5bc2986bca1acda70858a3 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Fetches, builds and store the result of a heimdal build
-# $Id$
+# Version: $Id$
 
 fetchmethod=curl          #options are: wget, curl, ftp, afs
 resultdir=
@@ -8,23 +8,31 @@ email=heimdal-build-log@it.su.se
 baseurl=ftp://ftp.pdc.kth.se/pub/heimdal/src
 afsdir=/afs/pdc.kth.se/public/ftp/pub/heimdal/src
 keeptree=no
+passhrase=
+noemail=
 
 # no more use configurabled part below (hopefully)
 
-usage="[--current] [--release version] [--cvs] [--cvs-flags] [--result-directory dir] [--fetch-method method --keep-tree] [--autotools]"
+usage="[--current] [--release version] [--cvs SourceRepository] [--cvs-flags] [--result-directory dir] [--fetch-method wget|ftp|curl|cvs] --keep-tree] [--autotools] [--passhrase string] [--no-email]"
 
 date=`date +%Y%m%d`
-if test "$?" != 0; then
+if [ "$?" != 0 ]; then
     echo "have no sane date, punting"
     exit 1
 fi
 
 hostname=`hostname`
-if test "$?" != 0; then
+if [ "$?" != 0 ]; then
     echo "have no sane hostname, punting"
     exit 1
 fi
 
+version=`grep "^# Version: " "$0" | cut -f2- -d:`
+if [ "X${version}" = X ]; then
+    echo "Can not figure out what version I am"
+    exit 1
+fi
+
 dir=
 hversion=
 cvsroot=
@@ -72,6 +80,18 @@ do
                keeptree=yes
                shift
                ;;
+       --passhrase)
+               passhrase="$2"
+               shift 2
+               ;;
+       --no-email)
+               noemail="yes"
+               shift
+               ;;
+       --version)
+               echo "Version: $version"
+               exit 0
+               ;;
        -*)
                echo "unknown option: $1"
                break
@@ -156,14 +176,22 @@ if [ "X${resultdir}" != X ] ; then
        cp ab.txt "${resultdir}/ab-${hversion}-${hostname}-${date}.txt"
 fi
 
-if [ "X${email}" != X ] ; then
-       cat >> email-header <<EOF
+if [ "X${noemail}" = X ] ; then
+       cat > email-header <<EOF
 From: ${USER:-unknown-user}@${hostname}
 To: <heimdal-build-log@it.su.se>
 Subject: heimdal-build-log SPAM COOKIE
 X-heimdal-build: kaka-till-love
 
+Version: $version
+
 EOF
+
+       if [ "X$passhrase" != X ] ; then
+               cat >> email-header <<EOF
+autobuild-passphrase: ${passhrase}
+EOF
+
        cat email-header ab.txt | sendmail "${email}"
 fi