%conffiles%
/etc/cfengine/cfengine.conf
/etc/cron.daily/cfengine
/etc/cron.weekly/cfengine
%dirs%
var/backups/cfengine
usr/share/doc/cfengine/examples
etc/cfengine
usr/share/man/man8
%docs%
build-tree/cfengine-1.5.3/README
build-tree/cfengine-1.5.3/Cfengine-survey.README.PLEASE
build-tree/cfengine-1.5.3/contrib/cfemacs.el
%postinst%
#! /bin/sh -e

if [ -f /etc/cfengine.conf ]
then
    echo "- Moving '/etc/cfengine.conf' to new home under '/etc/cfengine/'..."
    mv /etc/cfengine.conf /etc/cfengine
fi

#DEBHELPER#
%prerm%
#! /bin/sh -e

#DEBHELPER#
%undocumented%
cfd.8
cfrun.8
cfkey.8
%cron.weekly%
#! /bin/sh
#
# cron script to rotate cfengine log files
#
# Written by Brian White <bcwhite@pobox.com>

cd /var/log
LOG=cfengine.log
KEEP=4

if [ -f $LOG ]; then
    savelog -u root -g adm -m 644 -c $KEEP $LOG >/dev/null
fi
%cron.daily%
#! /bin/sh
#
# Run cfengine if both the executable and config file are available.
# Support for retrieving admin files from CVS or RCS is included.
#
# Written by Brian White <bcwhite@pobox.com>

# Set run_cvs to "1" if you want to call CVS to get the latest version
# of the admin files.
run_cvs=0
CVSROOT=/var/cvs;

# Set run_rcs to "1" if you want to call RCS to get the latest version
# of the admin files
run_rcs=0

CFENGINE=/usr/bin/cfengine
CFINPUTS=/etc/cfengine
CFCONF=cfengine.conf
CFLOG=/var/log/cfengine.log

export CVSROOT
export CFINPUTS

if [ -x $CFENGINE ]
then

    echo "===============================================================================" >> $CFLOG
    date >> $CFLOG
    echo "" >> $CFLOG

    if [ $run_cvs = 1 ]
    then
        cd /etc
	echo "----- Begin CVS Checkout -----" >>$CFLOG
        cvs -q checkout -P -A cfengine >>$CFLOG 2>&1
	echo "-----  End  CVS Checkout -----" >>$CFLOG
	echo "" >>$CFLOG
    fi


    if [ $run_rcs = 1 ]
    then
	echo "----- Begin RCS Checkout -----" >>$CFLOG
        find $CFINPUTS -type d -name RCS -exec "cd {}/..; co -q RCS/*" \; >>$CFLOG 2>&1
	echo "-----  End  RCS Checkout -----" >>$CFLOG
	echo "" >>$CFLOG
    fi


    if [ -f $CFINPUTS/$CFCONF ]
    then
	$CFENGINE -v -f $CFINPUTS/$CFCONF >> $CFLOG
    fi

    echo "" >> $CFLOG
fi
