| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
if [ "$1" = "--help" ]; then
|
| 4 |
echo "$0: Generate the HTML version of the Debian Installer Manual"
|
| 5 |
echo "Usage: $0 [arch] [lang] [format]"
|
| 6 |
exit 1
|
| 7 |
fi
|
| 8 |
|
| 9 |
arch=${1:-i386}
|
| 10 |
language=${2:-en}
|
| 11 |
format=${3:-html}
|
| 12 |
|
| 13 |
## Function to check result of executed programs and exit on error
|
| 14 |
checkresult () {
|
| 15 |
if [ ! "$1" = "0" ]; then
|
| 16 |
exit $1
|
| 17 |
fi
|
| 18 |
}
|
| 19 |
|
| 20 |
create_profiled () {
|
| 21 |
|
| 22 |
dynamic="${tempdir}/dynamic.ent"
|
| 23 |
|
| 24 |
if [ ! "$official_build" ]; then
|
| 25 |
unofficial_build="FIXME;unofficial-build"
|
| 26 |
else
|
| 27 |
unofficial_build=""
|
| 28 |
fi
|
| 29 |
|
| 30 |
## Now we source the profiling information for the selected architecture
|
| 31 |
if [ ! -f arch-options/${arch} ]
|
| 32 |
then
|
| 33 |
echo "Unknown architecture ${arch}! Please elaborate."
|
| 34 |
exit 1 ;
|
| 35 |
fi
|
| 36 |
. arch-options/${arch}
|
| 37 |
|
| 38 |
## Join all gathered info into one big variable
|
| 39 |
cond="$fdisk;$network;$boot;$smp;$other;$goodies;$unofficial_build"
|
| 40 |
|
| 41 |
## Write dynamic non-profilable entities into the file
|
| 42 |
echo "<!-- arch- and lang-specific non-profilable entities -->" > $dynamic
|
| 43 |
echo "<!ENTITY langext \".${language}\">" >> $dynamic
|
| 44 |
echo "<!ENTITY architecture \"${arch}\">" >> $dynamic
|
| 45 |
echo "<!ENTITY kernelversion \"${kernelversion}\">" >> $dynamic
|
| 46 |
echo "<!ENTITY altkernelversion \"${altkernelversion}\">" >> $dynamic
|
| 47 |
|
| 48 |
sed "s/\"en/\"..\/..\/..\/${language}/" entities/docstruct.ent >> $dynamic
|
| 49 |
|
| 50 |
sed "s/##LANG##/${language}/" templates/install.xml.template > $tempdir/install.${language}.xml
|
| 51 |
|
| 52 |
## Create the profiles xml file
|
| 53 |
$xsltprocessor \
|
| 54 |
--xinclude \
|
| 55 |
--stringparam profile.arch "$archspec" \
|
| 56 |
--stringparam profile.condition "$cond" \
|
| 57 |
--output $tempdir/install.${language}.profiled.xml \
|
| 58 |
$stylesheet_profile \
|
| 59 |
$tempdir/install.${language}.xml
|
| 60 |
|
| 61 |
checkresult $?
|
| 62 |
|
| 63 |
}
|
| 64 |
|
| 65 |
create_html () {
|
| 66 |
|
| 67 |
create_profiled
|
| 68 |
$xsltprocessor \
|
| 69 |
--xinclude \
|
| 70 |
--stringparam base.dir ./$basedir/html/ \
|
| 71 |
$stylesheet_html \
|
| 72 |
$tempdir/install.${language}.profiled.xml
|
| 73 |
checkresult $?
|
| 74 |
|
| 75 |
}
|
| 76 |
|
| 77 |
create_dvi () {
|
| 78 |
|
| 79 |
create_profiled
|
| 80 |
# And use openjade to convert generate a .tex file
|
| 81 |
export SP_ENCODING="utf-8"
|
| 82 |
openjade -t tex \
|
| 83 |
-b utf-8 \
|
| 84 |
-o $tempdir/install.${language}.tex \
|
| 85 |
-d $stylesheet_dsssl \
|
| 86 |
-V tex-backend \
|
| 87 |
$tempdir/install.${language}.profiled.xml
|
| 88 |
|
| 89 |
# Next we use jadetext to generate a .dvi file
|
| 90 |
# This needs three passes to properly generate the index (pagenumbering)
|
| 91 |
|
| 92 |
cd $tempdir
|
| 93 |
jadetex install.${language}.tex >/dev/null
|
| 94 |
jadetex install.${language}.tex >/dev/null
|
| 95 |
jadetex install.${language}.tex >/dev/null
|
| 96 |
cd ..
|
| 97 |
}
|
| 98 |
|
| 99 |
create_pdf() {
|
| 100 |
|
| 101 |
create_profiled
|
| 102 |
create_dvi
|
| 103 |
mkdir -p $basedir/pdf
|
| 104 |
dvipdf $tempdir/install.${language}.dvi
|
| 105 |
mv install.${language}.pdf $basedir/pdf
|
| 106 |
}
|
| 107 |
|
| 108 |
create_ps() {
|
| 109 |
|
| 110 |
create_profiled
|
| 111 |
create_dvi
|
| 112 |
mkdir -p $basedir/ps
|
| 113 |
dvips $tempdir/install.${language}.dvi
|
| 114 |
mv install.${language}.ps $basedir/ps
|
| 115 |
}
|
| 116 |
|
| 117 |
stylesheet_dir="stylesheets"
|
| 118 |
stylesheet_profile="$stylesheet_dir/style-profile.xsl"
|
| 119 |
stylesheet_html="$stylesheet_dir/style-html.xsl"
|
| 120 |
stylesheet_fo="$stylesheet_dir/style-fo.xsl"
|
| 121 |
stylesheet_dsssl="$stylesheet_dir/style-print.dsl"
|
| 122 |
|
| 123 |
xsltprocessor=/usr/bin/xsltproc
|
| 124 |
|
| 125 |
|
| 126 |
if [ -z $destination ]; then
|
| 127 |
destination="results/unofficial-manual"
|
| 128 |
fi
|
| 129 |
|
| 130 |
tempdir=${language}.temp
|
| 131 |
mkdir -p $tempdir
|
| 132 |
|
| 133 |
basedir=$destination/${language}/${arch}
|
| 134 |
|
| 135 |
## Create the profiled XML file...
|
| 136 |
|
| 137 |
## Create the requested format...
|
| 138 |
case ${format} in
|
| 139 |
|
| 140 |
html) create_html;;
|
| 141 |
ps) create_ps;;
|
| 142 |
pdf) create_pdf;;
|
| 143 |
*) echo "Format unknown or not supported yet!";;
|
| 144 |
|
| 145 |
esac
|