| 1 |
pronik-guest |
21971 |
#!/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 |
|
|
if [ ! "$official_build" ]; then |
| 23 |
|
|
unofficial_build="FIXME;unofficial-build" |
| 24 |
|
|
else |
| 25 |
|
|
unofficial_build="" |
| 26 |
|
|
fi |
| 27 |
|
|
|
| 28 |
|
|
if [ ! -f arch-options/${arch} ] |
| 29 |
|
|
then |
| 30 |
|
|
echo "Unknown architecture ${arch}! Please elaborate." |
| 31 |
|
|
exit 1 ; |
| 32 |
|
|
fi |
| 33 |
|
|
|
| 34 |
|
|
. arch-options/${arch} |
| 35 |
|
|
|
| 36 |
|
|
cond="$fdisk;$network;$boot;$smp;$other;$goodies;$unofficial_build" |
| 37 |
|
|
|
| 38 |
|
|
echo "<!-- arch- and lang-specific non-profilable entities -->" > $dynamic |
| 39 |
|
|
echo "<!ENTITY langext \".${language}\">" >> $dynamic |
| 40 |
|
|
echo "<!ENTITY architecture \"${arch}\">" >> $dynamic |
| 41 |
|
|
echo "<!ENTITY kernelversion \"${kernelversion}\">" >> $dynamic |
| 42 |
|
|
echo "<!ENTITY altkernelversion \"${altkernelversion}\">" >> $dynamic |
| 43 |
|
|
|
| 44 |
|
|
sed "s/\"en/\"..\/..\/..\/${language}/" entities/docstruct.ent >> $dynamic |
| 45 |
|
|
|
| 46 |
|
|
sed "s/##LANG##/${language}/" templates/install.xml.template > $tempdir/install.${language}.xml |
| 47 |
|
|
|
| 48 |
|
|
$xsltprocessor \ |
| 49 |
|
|
--xinclude \ |
| 50 |
|
|
--stringparam profile.arch "$archspec" \ |
| 51 |
|
|
--stringparam profile.condition "$cond" \ |
| 52 |
|
|
--output $tempdir/install.${language}.profiled.xml \ |
| 53 |
|
|
$stylesheet_profile \ |
| 54 |
|
|
$tempdir/install.${language}.xml |
| 55 |
|
|
|
| 56 |
|
|
checkresult $? |
| 57 |
|
|
|
| 58 |
|
|
} |
| 59 |
|
|
|
| 60 |
|
|
create_html () { |
| 61 |
|
|
|
| 62 |
|
|
$xsltprocessor \ |
| 63 |
|
|
--xinclude \ |
| 64 |
|
|
--stringparam chunker.output.encoding "UTF-8" \ |
| 65 |
|
|
--stringparam base.dir ./${language}.${arch}.html/ \ |
| 66 |
|
|
$stylesheet_html \ |
| 67 |
|
|
$tempdir/install.${language}.xml |
| 68 |
|
|
checkresult $? |
| 69 |
|
|
|
| 70 |
|
|
} |
| 71 |
|
|
|
| 72 |
|
|
## First we define some paths to various xsl stylesheets |
| 73 |
|
|
|
| 74 |
|
|
stylesheet_dir="stylesheets" |
| 75 |
|
|
stylesheet_profile="$stylesheet_dir/style-profile.xsl" |
| 76 |
|
|
stylesheet_html="$stylesheet_dir/style-html.xsl" |
| 77 |
|
|
stylesheet_fo="$stylesheet_dir/style-fo.xsl" |
| 78 |
|
|
|
| 79 |
|
|
xsltprocessor=/usr/bin/xsltproc |
| 80 |
|
|
|
| 81 |
|
|
tempdir=${language}.temp |
| 82 |
|
|
mkdir -p $tempdir |
| 83 |
|
|
|
| 84 |
|
|
dynamic="${tempdir}/dynamic.ent" |
| 85 |
|
|
|
| 86 |
|
|
create_profiled |
| 87 |
|
|
|
| 88 |
|
|
case ${format} in |
| 89 |
|
|
|
| 90 |
|
|
html) create_html;; |
| 91 |
|
|
*) echo "Format unknown or not supported yet!";; |
| 92 |
|
|
|
| 93 |
|
|
esac |