#!/bin/sh
#
# Author: Petter Reinholdtsen <pere@hungry.com>
# Date:   2001-11-25
#
# Run cfengine on config files in /etc/cfengine/debian-edu/.  Used by the
# Debian Edu project.

basedir=/etc/cfengine/debian-edu
masterhost=cfengine
if [ -x /usr/sbin/cfagent ] ; then 
  binary=/usr/sbin/cfagent
else
  binary=/usr/bin/cfengine
fi

cd $basedir || exit 1

test -x $binary || exit 2

CFINPUTS="$basedir"
export CFINPUTS

# make sure all installation logs are kept in /var/log/installer/
if [ -d /var/log/installer ] && [ ! -f /var/log/cfengine-debian-edu-1.log ] ; then
    logdir=/var/log/installer
else
    logdir=/var/log
fi

$binary -v -f cfengine.conf $@ 2>&1 | tee $logdir/cfengine-debian-edu-1.log
