PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 32ms app.codeStats 0ms

/cron.weekly/cvs

http://github.com/brinkman83/bashrc
Shell | 68 lines | 40 code | 7 blank | 21 comment | 9 complexity | 399d8deb045fc6def684999341e91011 MD5 | raw file
 1#!/bin/sh
 2
 3# $Debian: cron.weekly,v 1.1 2001/04/20 16:00:54 epg Exp $
 4
 5# CVS cron.weekly script - rotate history files in registered CVS dirs.
 6
 7# rotate <dir>
 8rotate ()
 9{
10	DIR="$1"
11	if [ ! -d $DIR ] || [ ! -d $DIR/CVSROOT ] || [ ! -f $DIR/CVSROOT/history ]; then
12		return
13	fi
14	if [ "$ROTKEEP" = "yes" ]; then
15		#db_get cvs/rotatekeep
16		#KEEPTIME="$RET"
17		KEEPTIME="$OTHER_ROTKEEP"
18	elif [ "$ROTKEEP" = "individual" ]; then
19		RNAME="`echo "$DIR" | sed -e 's:/:_:g'`"
20		#db_get "cvs/rotatekeep/$RNAME"
21		#KEEPTIME="$RET"
22		eval KEEPTIME="\${ROTKEEP_${RNAME}}"
23	else	# no
24		KEEPTIME="7"
25	fi
26	savelog -p -t -c $KEEPTIME $DIR/CVSROOT/history >/dev/null 2>&1
27}
28
29# Uncomment these if you want to use debconf to get the variables directly
30#. /usr/share/debconf/confmodule
31if [ -e /etc/cvs-cron.conf ] ; then
32    . /etc/cvs-cron.conf
33fi
34
35# Retrieve some useful variables
36#db_get cvs/rotatehistory
37#ROT_HIST="$RET"
38#db_get cvs/repositories
39#REPOS="$RET"
40#db_get cvs/rotatekeep_nondefault
41#ROTKEEP="$RET"
42
43# Do the rotation
44if [ "$ROT_HIST" = "no" ]; then
45	exit 0
46elif [ "$ROT_HIST" = "individual" ]; then
47	IFS=':'
48	for i in $REPOS; do
49		IFS=' 	\
50'
51		RNAME="`echo "$i" | sed -e 's:/:_:g'`"
52		#db_get "cvs/rotate/$RNAME"
53		#if [ "$RET" = "true" ]; then
54		eval T="\${ROT_${RNAME}}"
55		if [ "$T" = "true" ]; then
56			rotate $i
57		fi
58	done
59else	# yes
60	IFS=':'
61	for i in $REPOS; do
62		IFS=' 	\
63'
64		rotate $i
65	done
66fi
67
68# End of file.