#!/bin/sh

#
# CVS cron.weekly script
#

# Get the configuration file
if test ! -f /etc/cvs.conf; then
	exit 0
fi

. /etc/cvs.conf

# Should we rotate any logfiles?
if test "$CVS_ROTATE" = "no"; then
	exit 0
fi

# Simple syntax
if test "$CVS_ROTATE" = "yes"; then
	OLDIFS="$IFS"
	IFS=": 	"
	for i in $CVS_ROTDIRS; do
		/usr/bin/savelog -c 7 $i/CVSROOT/history >/dev/null 2>&1
	done
	IFS="$OLDIFS"
else
	# Advanced syntax
	OLDIFS="$IFS"
	IFS=": 	"
	for i in $CVS_ROTATE; do
		DIR="`echo $CVS_ROTDIRS | sed 's/\([^:]*\):.*/\1/'`"
		CVS_ROTDIRS="`echo $CVS_ROTDIRS | sed 's/[^:]*:\(.*\)/\1/'`"
		case "$i" in
			n)
			continue
			;;
			
			[0-9]*)
			savelog -c $i $DIR/CVSROOT/history >/dev/null 2>&1
			;;
		esac
	done
fi

# End of file.
