1#!/bin/bash 2# vim: tabstop=4 expandtab shiftwidth=4 autoindent 3 4# This file will build the cleanfeed tarball based on the svn samples files 5# and the cleanfeed file in /var/www/cleanfeed. This is kind of messy but it 6# works for now. 7 8#################################### 9# Run this *after* running cfsign. # 10#################################### 11 12BASEDIR='/usr/local/news/tmp' 13BUILDDIR="${BASEDIR}/cleanfeed" 14SAMPLESOURCE='/usr/local/news/dev/cleanfeed/trunk/samples' 15CFSOURCE='/var/www/cleanfeed' 16DATE=`date +%Y%m%d` 17DESTFILE="/var/www/cleanfeed/cleanfeed-$DATE.tar" 18 19# Check if the build directory exists. If it does then empty it, else create 20# it along with the required subdirs which cannot exist without a parent. 21if [ -d $BUILDDIR ]; then 22 echo "Using existing $BUILDDIR" 23 find "$BUILDDIR" -type f -exec rm {} \; 24 if [ -d ${BUILDDIR}/etc ]; then 25 echo "Using existing ${BUILDDIR}/etc" 26 find "${BUILDDIR}/etc" -type f -exec rm {} \; 27 else 28 echo "Creating ${BUILDDIR}/etc" 29 mkdir ${BUILDDIR}/etc 30 fi 31 32 if [ -d ${BUILDDIR}/log ]; then 33 echo "Using existing ${BUILDDIR}/log" 34 find "${BUILDDIR}/log" -type f -exec rm {} \; 35 else 36 echo "Creating ${BUILDDIR}/log" 37 mkdir ${BUILDDIR}/log 38 fi 39 40else 41 echo "Creating $BUILDDIR and its subdirectories." 42 mkdir $BUILDDIR 43 mkdir $BUILDDIR/etc 44 mkdir $BUILDDIR/log 45fi 46 47 48echo "Copying files from ${SAMPLESOURCE}/bad_* to ${BUILDDIR}/etc" 49cp ${SAMPLESOURCE}/bad_* ${BUILDDIR}/etc 50 51echo "Copying file from ${SAMPLESOURCE}/cleanfeed.local to ${BUILDDIR}/etc" 52cp ${SAMPLESOURCE}/cleanfeed.local ${BUILDDIR}/etc 53 54echo "Copying file from ${CFSOURCE}/cleanfeed to $BUILDDIR" 55cp ${CFSOURCE}/cleanfeed $BUILDDIR 56 57if [ -f $DESTFILE ]; then 58 echo "Deleting old $DESTFILE" 59 rm $DESTFILE 60fi 61 62if [ -f ${DESTFILE}.gz ]; then 63 echo "Deleting old ${DESTFILE}.gz" 64 rm $DESTFILE.gz 65fi 66 67cd $BASEDIR 68echo "Creating $DESTFILE" 69tar -cf $DESTFILE cleanfeed 70echo "Compressing $DESTFILE" 71gzip $DESTFILE 72