#!/bin/bash # # build-alpha: build release of TWiki code from CVS # # Copyright (C) 2002-2003 Richard Donkin # http://twiki.org/cgi-bin/view/Main/RichardDonkin # # For licensing info read license.txt file in the TWiki root. # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details, published at # http://www.gnu.org/copyleft/gpl.html # This script runs from a SF shell server, using the following crontab # - requires a ~/.cvslogin file for pserver access to CVS # # # Build TWiki Alpha every night (Pacific time) # 45 23 * * * $HOME/build/build-alpha set -u # Note use of cvs1 from shell servers export CVSROOT=:pserver:rdonkin@cvs1:/cvsroot/twiki live=/home/groups/t/tw/twiki/htdocs # http://twiki.org/ dir keepdays=7 # No. of days to keep old alphas alpha=$live/alpha unset TZ date=`date +'%Y%m%d'` tag=${date}alpha echo Building release $tag cd $HOME/temp-build zip=twiki-$tag.zip tar=twiki-$tag.tar.gz rm -f $zip $tar # Remove old versions (testing only) # Export HEAD revision files and build .tar.gz and .zip files in current # directory $HOME/build/cvsrelease -z -t HEAD -r $tag twiki # Test the files if tar tzf $tar >/dev/null 2>&1 ; then if unzip -t $zip >/dev/null 2>&1 ; then : else echo Bad zip file exit 2 fi else echo Bad tar file exit 1 fi # Rename files to TWiki* ls $tar $zip | sed 's/.*/mv & ZZ&/; s/ZZtwiki-/TWiki/' | sh # Get 2 most recent files files=`ls -t TWiki* | head -2` # Copy files to web visible directory and remove temp files cp -p $files $alpha && rm -f $files # Purge old files cd $alpha && ( set -x find . -name 'TWiki*[zp]' -mtime +$keepdays -print | xargs rm -f )