I set up a cron job at ibiblio to get the snapshots
Here is the script:

--------------------------------------------------
#!/bin/bash

# CVS tree 
CVSDIR=<path to local cvs copy>

# Where should all the snapshots go
SNPDIR=<path to ftp>

# We keep logs in case
LOGDIR=<path to log>

# The modules that need snapshots. If a module is to be added,
# it must be imported from cvs manually first.
MODULES="ggi-core lowlevel"

# how long before we trash the snapshots
HISTORY=30

BIN=/bin

TODAY=`$BIN/date +%Y%m%d`

makesnapshot() {
    if [ -f $LOGDIR/$1-$TODAY ]; then
        echo `$BIN/date` : Snapshot for $1 already done today >> $LOGDIR/log
    else
        echo `$BIN/date` : Making snapshot for $1 >> $LOGDIR/log
        $BIN/rm -f $LOGDIR/$1*
        # stamp
        $BIN/touch $LOGDIR/$1-$TODAY
        cd $CVSDIR

        # duplicate the current tree
        $BIN/cp -R $1 $1-pre

        #update the package
        cd $1; /usr/bin/cvs -Q update >> $LOGDIR/log; cd ..

        #create the diff
        /usr/bin/diff -ur $1-pre $1 > $SNPDIR/$1-diff-$TODAY

        #erase the old tree
        $BIN/rm -rf $1-pre
        if test -s $SNPDIR/$1-diff-$TODAY; then
            #build the snapshot
            $BIN/tar cvfz $SNPDIR/$1-$TODAY.tgz $1
            $BIN/gzip $SNPDIR/$1-diff-$TODAY
        else
            # no diff
            $BIN/rm $SNPDIR/$1-diff-$TODAY
        fi
    fi
}

for I in $MODULES; do
        makesnapshot $I
done
#erase all snapshots that are too old.
/usr/bin/find $SNPDIR/ -ctime $HISTORY -exec /bin/rm {};

##############################################################

Reply via email to