#!/bin/sh
# DocBook XML build script
# specifically for m0n0wall as is, but can easily be suited to other DocBook XML sources
#
# Chris Buechler
# http://chrisbuechler.com
# 4/10/05
#

########################################################################################
# CONFIGURATION
# 
#  this section contains configuration variables specific to your system
#
# ROOTPATH exists only for the sake of clarity, because I like to create a 
#  root directory 
ROOTPATH=/Library/docbook/m0n0wall

# CVSPATH is the directory where the files from CVS will be checked out, must 
#   exist prior to running this
CVSPATH=$ROOTPATH/cvsroot

# CVS root info
CVSROOT=:pserver:user@cvs.example.org:/cvsroot

# Parent directory for the web server, actual output will go 
#  into docbook/ directory under this path
WWWPATH=/usr/local/www/m0n0wall

# directory containing the xsltproc binary.  /usr/local/bin on FreeBSD, 
#  /opt/local/bin on OS X, probably something else on Linux
XSLTPROCPATH=/opt/local/bin

# directory containing the chunk.xsl file 
CHUNKXSLPATH=/opt/local/share/xsl/docbook-xsl/html

# the CSS file that will be used
CSSFILE=m0n0doc.css

#########################################################################################

# update from CVS
cd $CVSPATH && cvs -d $CVSROOT co docbook

# build html files
$XSLTPROCPATH/xsltproc \
        --stringparam section.autolabel 1 \
        --stringparam section.label.includes.component.label 1 \
        --stringparam toc.max.depth 2 \
        --stringparam html.stylesheet $CSSFILE \
        --stringparam chunker.output.indent yes \
        --stringparam base.dir $WWWPATH/docbook/ \
        $CHUNKXSLPATH/chunk.xsl \
        $CVSPATH/docbook/book.xml

#  copy files from CVS into place for www, including images, the CSS file, and extra html 
#   files put into CVS
cp $CVSPATH/docbook/m0n0doc.css $WWWPATH/docbook
cp $CVSPATH/docbook/*.png $WWWPATH/docbook
cp $CVSPATH/docbook/*.html $WWWPATH/docbook
cp -R $CVSPATH/docbook/screens/* $WWWPATH/docbook/screens/
cp -R $CVSPATH/docbook/icons/* $WWWPATH/docbook/icons/
cp -R $CVSPATH/docbook/networkdiagrams/* $WWWPATH/docbook/networkdiagrams/


