summaryrefslogtreecommitdiff
path: root/source3/lib/ldb/docs/builddocs.sh
blob: 449dcb26815aff58cc11553ec526c762b2d53806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
# build ldb docs
# tridge@samba.org August 2006

XSLTPROC="$1"
SRCDIR="$2"

if [ -z "$XSLTPROC" ] || [ ! -x "$XSLTPROC" ]; then
    echo "xsltproc not installed"
    exit 0
fi

MANXSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
HTMLXSL="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"

mkdir -p man

for f in $SRCDIR/man/*.xml; do
    base=`basename $f .xml`
    out=man/"`basename $base`"
    if [ ! -f "$out" ] || [ "$f" -nt "$out" ]; then
	echo Processing manpage $f
	$XSLTPROC --nonet -o "$out" "$MANXSL" $f
	ret=$?
	if [ "$ret" = "4" ]; then
	    echo "ignoring stylesheet error 4 for $MANXSL"
	    exit 0
	fi
	if [ "$ret" != "0" ]; then
	    echo "xsltproc failed with error $ret"
	    exit $ret
	fi
    fi
done

for f in $SRCDIR/man/*.xml; do
    base=`basename $f .xml`
    out=man/"`basename $base`".html
    if [ ! -f "$out" ] || [ "$f" -nt "$out" ]; then
	echo Processing html $f
	$XSLTPROC --nonet -o "$out" "$HTMLXSL" $f
	ret=$?
	if [ "$ret" = "4" ]; then
	    echo "ignoring stylesheet error 4 for $HTMLXSL"
	    exit 0
	fi
	if [ "$ret" != "0" ]; then
	    echo "xsltproc failed with error $ret"
	    exit $ret
	fi
    fi
done