#! /bin/sh

# Script to build the Exim FAQ in text and HTML formats.

/bin/rm -f FAQ.txt* html/FAQ* FAQ-html/* FAQ-html.tar.*
/bin/rm -f config.samples.tar.gz config.samples.tar.bz2

# The FAQchk Perl script checks for the numbers being in order and for the
# right number of blank lines at various places.

faqchk FAQ.src
if [ $? != 0 ]; then exit 1; fi

# HTML version

f2h FAQ.src html
echo "html/FAQ*.html made"

fc2k
echo "html/FAQ-KWIC*.html made"

cp html/FAQ* html/*.txt FAQ-html
echo "copied to FAQ-html"

tar cf FAQ-html.tar FAQ-html
gzip FAQ-html.tar
echo "FAQ-html.tar.gz made"

tar cf FAQ-html.tar FAQ-html
bzip2 -9 FAQ-html.tar
echo "FAQ-html.tar.gz2 made"

# ASCII version

f2txt FAQ.src FAQ.txt
echo "FAQ.txt made"

cp FAQ.txt FAQ.txt-t
gzip -v --best FAQ.txt-t
mv FAQ.txt-t.gz FAQ.txt.gz
echo "FAQ.txt.gz made"

cp FAQ.txt FAQ.txt-t
bzip2 -v -9 FAQ.txt-t
mv FAQ.txt-t.bz2 FAQ.txt.bz2
echo "FAQ.txt.bz2 made"

# Configuration samples

tar -chf config.samples.tar config.samples
gzip config.samples.tar
echo "config.samples.tar.gz made"

tar -chf config.samples.tar config.samples
bzip2 -9 config.samples.tar
echo "config.samples.tar.bz2 made"

# End