#!/bin/sh

sgmlfmt="/kfug/bin/sgmlfmt.doc-kr"

prefixdir="/kfug/www/htdocs/projects/doc-kr/docs/handbook"
osgmlko="/kfug/ftp/pub/FreeBSD-kr/doc/handbook/sgml"
sgml="$prefixdir/sgml"
sgmlen="$prefixdir/sgml-en"
sgmlko="$prefixdir/sgml-ko"
html="$prefixdir/html"

statusprg="/kfug/www/htdocs/projects/doc-kr/docs/make-status-handbook.pl"
statusfile="/kfug/www/htdocs/projects/doc-kr/handbook-status.html"

#echo "Getting new SGMLs..."
#cvs co doc/handbook
#echo "" 

echo "Getting SGML-KOs..."
rm -rf "$sgmlko"
mkdir "$sgmlko"
cp $osgmlko/*.sgml $sgmlko/
echo ""

echo "Removing old files & copying SGMLs..."
rm -rf "$sgml"
mkdir "$sgml"
cp $sgmlen/*.sgml $sgml/
cp $sgmlko/*.sgml $sgml/
echo ""

echo "Removing old htmls & generating HTMLs..." 
rm -rf "$html"
mkdir "$html"
cd $html

$sgmlfmt -f html -links -e EUC-KR "$sgml/handbook.sgml"
sh handbook.ln
if [ ! -f index.shtml ]; then
	echo "Symlink handbook.shtml -> index.shtml"
	ln -s handbook.shtml index.shtml
fi
echo ""

echo "Generating status file..."
$statusprg > $statusfile

echo "Done..."

