#!/bin/sh # Configuration stylesheet_dir="stylesheets" stylesheet_profile="$stylesheet_dir/style-profile.xsl" stylesheet_html="$stylesheet_dir/style-html.xsl" stylesheet_fo="$stylesheet_dir/style-fo.xsl" stylesheet_dsssl="$stylesheet_dir/style-print.dsl" main_path="$PWD/`dirname $0`" entities_path="$main_path/entities" source_path="$main_path/../../${language}" xsltprocessor=/usr/bin/xsltproc if [ -z $destination ]; then destination="results/unofficial-manual" fi tempdir=${language}.temp dynamic="${tempdir}/dynamic.ent" if [ "$1" = "--help" ]; then echo "$0: Generate the HTML version of the Debian Installer Manual" echo "Usage: $0 [arch] [lang] [format]" exit 1 fi arch=${1:-i386} language=${2:-en} format=${3:-html} ## Function to check result of executed programs and exit on error checkresult () { if [ ! "$1" = "0" ]; then exit $1 fi } create_profiled () { if [ ! "$official_build" ]; then unofficial_build="FIXME;unofficial-build" else unofficial_build="" fi ## Now we source the profiling information for the selected architecture if [ ! -f arch-options/${arch} ] then echo "Unknown architecture ${arch}! Please elaborate." exit 1 ; fi . arch-options/${arch} ## Join all gathered info into one big variable cond="$fdisk;$network;$boot;$smp;$other;$goodies;$unofficial_build" ## Write dynamic non-profilable entities into the file echo "" > $dynamic echo "" >> $dynamic echo "" >> $dynamic echo "" >> $dynamic echo "" >> $dynamic sed "s:##SRCPATH##:$source_path:" templates/docstruct.ent >> $dynamic sed "s/##LANG##/$language/g" templates/install.xml.template | \ sed "s:##ENTPATH##:$entities_path:g" | \ sed "s:##SRCPATH##:$source_path:" > $tempdir/install.${language}.xml ## Create the profiles xml file $xsltprocessor \ --xinclude \ --stringparam profile.arch "$archspec" \ --stringparam profile.condition "$cond" \ --output $tempdir/install.${language}.profiled.xml \ $stylesheet_profile \ $tempdir/install.${language}.xml checkresult $? } create_html () { create_profiled $xsltprocessor \ --xinclude \ --stringparam base.dir ./$basedir/html/ \ $stylesheet_html \ $tempdir/install.${language}.profiled.xml checkresult $? } create_dvi () { create_profiled # And use openjade to convert generate a .tex file export SP_ENCODING="utf-8" openjade -t tex \ -b utf-8 \ -o $tempdir/install.${language}.tex \ -d $stylesheet_dsssl \ -V tex-backend \ $tempdir/install.${language}.profiled.xml # Next we use jadetext to generate a .dvi file # This needs three passes to properly generate the index (pagenumbering) cd $tempdir jadetex install.${language}.tex >/dev/null jadetex install.${language}.tex >/dev/null jadetex install.${language}.tex >/dev/null cd .. } create_pdf() { create_profiled create_dvi mkdir -p $basedir/pdf dvipdf $tempdir/install.${language}.dvi mv install.${language}.pdf $basedir/pdf } create_ps() { create_profiled create_dvi mkdir -p $basedir/ps dvips $tempdir/install.${language}.dvi mv install.${language}.ps $basedir/ps } mkdir -p $tempdir basedir=$destination/${language}/${arch} case ${format} in html) create_html;; ps) create_ps;; pdf) create_pdf;; *) echo "Format unknown or not supported yet!";; esac