#!/bin/bash # # Create a snapshot copy of K2 Nightly Build # http://zeo.unic.net.my/notes/nightly-build-script/ # Last updated: 06/14/2006 # # (CC) 2006 Safirul Alredha. # Show me the current date date=`date +%Y-%m-%d` # K2 SVN server SVN='http://getk2.com/svn/' # Change to working space directory. This where all the magic happens. cd /var/workspace # Get local snapshot copies revision number OLD=`svn info local | grep -r Revision | cut -f 2 -d " "` # Get current development revision number NEW=`svn info $SVN | grep -r Revision | cut -f 2 -d " "` # Compare for OLD and NEW revision if [ $NEW -gt $OLD ] ; then # update local copies svn update local # create another local copies cp -r local k2 # Recursively remove all .svn directories from folder k2 find k2 -name .svn -print0 | xargs -0 rm -rf # Create archive tar czf /var/www/k2/k2-Beta.2-revision-$NEW-$date.tar.gz k2 zip -r /var/www/k2/k2-Beta.2-revision-$NEW-$date.zip k2 # Dumping svn commit log svn log -v local > /var/www/k2/CHANGELOG # Delete folder k2 rm -rf k2 echo "New revision available on $date. Current is Revision $NEW" >> log else # If there's no commit been made echo "No new revision available on $date. Current is Revision $OLD" >> log fi