:
cd /pgsgmlbuild
[ -f /tmp/pgsql_sgml.lock ] && exit
TRAPEXTRAFILE="/tmp/pgsql_sgml.lock"
. traprm
touch /tmp/pgsql_sgml.lock
> $TMP/1
while :
do
CONT="N"
if [ "X$1" = "X-f" ]
then CONT="Y"
shift
else pgcvs update sgml > $TMP/2 2>&1 &
BG="$!"; export BG
(sleep 300; kill "$BG" > /dev/null 2>&1) &
BG2="$!"; export BG2
wait "$BG"
if ! kill0 "$BG2"
then CONT="N"
else kill "$BG2" > /dev/null 2>&1
CONT="Y"
cat $TMP/2 |
grep '^[A-Z] sgml/' > $TMP/1
[ "$?" -ne 0 ] && CONT="N"
fi
fi
if [ "$CONT" = "N" ]
then break
fi
# continue
echo "\nBuild: `date`" >> build.dates
cat $TMP/1 >> build.dates
echo "PostgreSQL CVS Documentation Build" > $TMP/0
echo "----------------------------------\n" >> $TMP/0
echo "Build started: `date`" >> $TMP/0
gmake postgres.tar.gz 2>&1 | grep -v DTDDECL > $TMP/2
echo "Build completed: `date`\n" >> $TMP/0
echo "Changes in this build:" >> $TMP/0
cat $TMP/1 >> $TMP/0
echo "\nA full copy of this documenation is at ftp://candle.pha.pa.us/pub/postgresql/postgresql-docs.tar.gz\n" >> $TMP/0
if grep -qi 'error' $TMP/2 || grep -qi ':E:' $TMP/2
then echo "\nThere were errors in this build. They appear in red.\n" >> $TMP/0
cat $TMP/2 >> $TMP/0
else echo "\nBuild completed successfully." >> $TMP/0
fi
pipe sed 's;HTML.manifest:;HTML.manifest :;g' $TMP/0
txt2html -m -s 100 -p 100 --title "PostgreSQL CVS Docs built `date`" \
--link /u/txt2html/txt2html.dict \
--append_head /u/txt2html/BODY $TMP/0 > build.html
pipe sed 's;^.*[Ee]rror.*$;&;' build.html
pipe sed 's;^.*:E:.*$;&;' build.html
rm -f /var/www/docs/main/writings/pgsql/sgml/*
mv sgml/*.html build.html /var/www/docs/main/writings/pgsql/sgml
cp sgml/*.css sgml/*.gif /var/www/docs/main/writings/pgsql/sgml
cp postgres.tar.gz /pgftp/postgresql-docs.tar.gz
gmake clean > /dev/null 2>&1
[ "X$1" = "X-f" ] && break
done