#!/bin/sh 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 () { dynamic="${tempdir}/dynamic.ent" 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/\"en/\"..\/..\/..\/${language}/" entities/docstruct.ent >> $dynamic sed "s/##LANG##/${language}/" templates/install.xml.template > $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 ./$destination/${language}.${arch}/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 $destination/${language}.${arch}/pdf dvipdf $tempdir/install.${language}.dvi mv install.${language}.pdf $destination/${language}.${arch}/pdf } create_ps() { create_profiled create_dvi mkdir -p $destination/${language}.${arch}/ps dvips $tempdir/install.${language}.dvi mv install.${language}.ps $destination/${language}.${arch}/ps } 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" xml_decl="/usr/share/sgml/declaration/xml.dcl" xsltprocessor=/usr/bin/xsltproc if [ -z $destination ]; then destination="results" fi tempdir=${language}.temp mkdir -p $tempdir ## Create the profiled XML file... ## Create the requested format... case ${format} in html) create_html;; ps) create_ps;; pdf) create_pdf;; *) echo "Format unknown or not supported yet!";; esac