#!/bin/sh # $Id: inn-snapshot,v 1.6 2008-12-01 19:31:17 eagle Exp $ # # inn-snapshot -- Generate nightly INN snapshots. # # This is my local script to generate nightly INN snapshots and save them into # the appropriate directory, only keeping the last seven valid snapshots. # Most of the work is done by the snapshot script in the INN distribution, but # a wrapper is needed to handle Subversion checkouts and putting the resulting # tarball in the right place. set -e if [ ! -d $HOME/snapshot ] ; then mkdir $HOME/snapshot fi # Trunk. cd $HOME/snapshot if [ -d inn ] ; then cd inn if [ -f inn/Makefile.global ] ; then make maintclean >/dev/null fi rm -rf inn-CURRENT-* README.snapshot snapshot.log svn -q update cd .. else svn co -q http://inn.eyrie.org/svn/trunk inn fi cd inn if support/mksnapshot CURRENT ; then cp inn-*.tar.gz /srv/archives/pub/software/inn/snapshots/ else echo 'CURRENT snapshot generation failed. Last 50 lines of the log file:' echo '' tail -50 snapshot.log echo '' fi # Stable branch. cd $HOME/snapshot if [ -d inn-2.4 ] ; then cd inn-2.4 if [ -f inn/Makefile.global ] ; then make maintclean >/dev/null fi rm -rf inn-STABLE-* README.snapshot snapshot.log svn -q update cd .. else svn co -q http://inn.eyrie.org/svn/branches/2.4 inn-2.4 fi cd inn-2.4 if support/mksnapshot STABLE ; then cp inn-*.tar.gz /srv/archives/pub/software/inn/snapshots/ else echo 'STABLE snapshot generation failed. Last 50 lines of the log file:' echo '' tail -50 snapshot.log echo '' fi # Now clean up the old snapshots. cd /srv/archives/pub/software/inn/snapshots bases=`/bin/ls inn-*.tar.gz | sed 's/-[0-9][0-9]*.tar.gz//' | sort | uniq` for base in $bases ; do /bin/ls $base-*.tar.gz | sort -r | sed '8,$!d' | xargs -r rm -f done