#!/bin/sh

# run-time variables here

DOXYGEN_DEST_PATH=/your/webserver/docroot/FreeBSDdox
export DOXYGEN_DEST_PATH

cd /your/source/to/process
SOURCE_LOCATION=$(pwd)/sys

EMAIL=you@example.net
OWN=webuser:webgroup

#############################################################################
#
# no changes after this part are necessary
#
#############################################################################

/usr/local/bin/svn update >/dev/null 2>&1
if [ $? -ne 0 ]; then
	/usr/bin/mail -s 'svn update for doxygen: failure' ${EMAIL} </dev/null
	exit 1
fi

cd tools/kerneldoc/subsys
S=${SOURCE_LOCATION}
export S

DOXYGEN_DEST_PATH= /usr/bin/make clean >/dev/null 2>&1
/usr/bin/make all >/dev/null 2>&1
if [ $? -ne 0 ]; then
	/usr/bin/mail -s 'doxygen run: failure' ${EMAIL} </dev/null
	# no exit, we want the chown/chmod in any case
fi

/usr/sbin/chown -R ${OWN} ${DOXYGEN_DEST_PATH}
/bin/chmod a+r,og-w ${DOXYGEN_DEST_PATH}

