/[d-i]/trunk/installer/doc/manual/build/buildone.sh
ViewVC logotype

Contents of /trunk/installer/doc/manual/build/buildone.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 24646 - (show annotations) (download) (as text)
Thu Dec 30 23:29:21 2004 UTC (8 years, 4 months ago) by fjpop-guest
File MIME type: application/x-sh
File size: 8220 byte(s)
Name correction
1 #!/bin/sh
2
3 if [ "$1" = "--help" ]; then
4 echo "$0: Generate the Debian Installer Manual in several different formats"
5 echo "Usage: $0 [arch] [lang] [format]"
6 echo "[format] may consist of multiple formats provided they are quoted (e.g. \"html pdf\")"
7 echo "Supported formats: html, ps, pdf, txt"
8 exit 0
9 fi
10
11 arch=${1:-i386}
12 language=${2:-en}
13 formats=${3:-html}
14
15 ## Configuration
16 basedir="$(cd "$(dirname $0)"; pwd)"
17 manual_path="$(echo $basedir | sed "s:/build$::")"
18 build_path="$manual_path/build"
19 cd $build_path
20
21 stylesheet_dir="$build_path/stylesheets"
22 stylesheet_profile="$stylesheet_dir/style-profile.xsl"
23 stylesheet_html="$stylesheet_dir/style-html.xsl"
24 stylesheet_html_single="$stylesheet_dir/style-html-single.xsl"
25 stylesheet_fo="$stylesheet_dir/style-fo.xsl"
26 stylesheet_dsssl="$stylesheet_dir/style-print.dsl"
27
28 entities_path="$build_path/entities"
29 source_path="$manual_path/$language"
30
31 if [ -z "$destdir" ]; then
32 destdir="build.out"
33 fi
34
35 tempdir="build.tmp"
36 dynamic="${tempdir}/dynamic.ent"
37
38 create_profiled () {
39
40 [ -x /usr/bin/xsltproc ] || return 9
41
42 echo "Info: creating temporary profiled .xml file..."
43
44 entity_l10n="$entities_path/l10n/$language.ent"
45 entity_master="$entities_path/l10n/master.ent"
46 [ -f "$entity_master" ] || {
47 echo "Error: file '$entity_master' is missing"
48 return 1
49 }
50
51 if [ ! "$official_build" ]; then
52 unofficial_build="FIXME;unofficial-build"
53 else
54 unofficial_build=""
55 fi
56
57 # Now we source the profiling information for the selected architecture
58 [ -f "arch-options/${arch}" ] || {
59 echo "Error: unknown architecture '$arch'"
60 return 1
61 }
62 . arch-options/$arch
63
64 # Join all architecture options into one big variable
65 condition="$fdisk;$network;$boot;$smp;$other;$goodies;$unofficial_build;$status"
66
67 # Write dynamic non-profilable entities into the file
68 echo "<!-- arch- and lang-specific non-profilable entities -->" > $dynamic
69 echo "<!ENTITY langext \".${language}\">" >> $dynamic
70 echo "<!ENTITY architecture \"${arch}\">" >> $dynamic
71 echo "<!ENTITY kernelversion \"${kernelversion}\">" >> $dynamic
72 echo "<!ENTITY altkernelversion \"${altkernelversion}\">" >> $dynamic
73 sed "s:##SRCPATH##:$source_path:" templates/docstruct.ent >> $dynamic
74 # Add translated and language specific entities, if a file for them exists
75 [ -f "$entity_lang" ] && cat $entity_lang >> $dynamic
76 # Add default (English) translatable entities
77 cat $entity_master >> $dynamic
78
79 sed "s:##LANG##:$language:g" templates/install.xml.template | \
80 sed "s:##TEMPDIR##:$tempdir:g" | \
81 sed "s:##ENTPATH##:$entities_path:g" | \
82 sed "s:##SRCPATH##:$source_path:" > $tempdir/install.${language}.xml
83
84 # Create the profiled xml file
85 /usr/bin/xsltproc \
86 --xinclude \
87 --stringparam profile.arch "$archspec" \
88 --stringparam profile.condition "$condition" \
89 --output $tempdir/install.${language}.profiled.xml \
90 $stylesheet_profile \
91 $tempdir/install.${language}.xml
92 RET=$?; [ $RET -ne 0 ] && return $RET
93
94 return 0
95 }
96
97 create_html () {
98
99 echo "Info: creating .html files..."
100
101 /usr/bin/xsltproc \
102 --xinclude \
103 --stringparam base.dir $destdir/html/ \
104 $stylesheet_html \
105 $tempdir/install.${language}.profiled.xml
106 RET=$?; [ $RET -ne 0 ] && return $RET
107
108 return 0
109 }
110
111 create_text () {
112
113 [ -x /usr/bin/w3m ] || return 9
114
115 echo "Info: creating temporary .html file..."
116
117 /usr/bin/xsltproc \
118 --xinclude \
119 --output $tempdir/install.${language}.html \
120 $stylesheet_html_single \
121 $tempdir/install.${language}.profiled.xml
122 RET=$?; [ $RET -ne 0 ] && return $RET
123
124 # Replace some unprintable characters
125 sed "s:–:-:g # n-dash
126 s:—:--:g # m-dash
127 s:“:\&quot;:g # different types of quotes
128 s:”:\&quot;:g
129 s:„:\&quot;:g
130 s:…:...:g # ellipsis
131 s:™: (tm):g # trademark" \
132 $tempdir/install.${language}.html >$tempdir/install.${language}.corr.html
133 RET=$?; [ $RET -ne 0 ] && return $RET
134
135 echo "Info: creating .txt file..."
136
137 # Set encoding for output file
138 case "$language" in
139 cs)
140 CHARSET=ISO-8859-2
141 ;;
142 ja)
143 CHARSET=EUC-JP
144 ;;
145 ru)
146 CHARSET=KOI8-R
147 ;;
148 *)
149 CHARSET=ISO-8859-1
150 ;;
151 esac
152
153 /usr/bin/w3m -dump $tempdir/install.${language}.corr.html \
154 -o display_charset=$CHARSET \
155 >$destdir/install.${language}.txt
156 RET=$?; [ $RET -ne 0 ] && return $RET
157
158 return 0
159 }
160
161 create_dvi () {
162
163 [ -x /usr/bin/openjade ] || return 9
164 [ -x /usr/bin/jadetex ] || return 9
165
166 # Skip this step if the .dvi file already exists
167 [ -f "$tempdir/install.${language}.dvi" ] && return
168
169 echo "Info: creating temporary .tex file..."
170
171 # And use openjade to generate a .tex file
172 export SP_ENCODING="utf-8"
173 /usr/bin/openjade -t tex \
174 -b utf-8 \
175 -o $tempdir/install.${language}.tex \
176 -d $stylesheet_dsssl \
177 -V tex-backend \
178 $tempdir/install.${language}.profiled.xml
179 RET=$?
180 if [ $RET -eq 1 ] && [ -s $tempdir/install.${language}.tex ] ; then
181 echo "Warning: recieved error $RET from 'openjade'; probably non-fatal so ignoring."
182 else
183 [ $RET -ne 0 ] && return $RET
184 fi
185
186 echo "Info: creating temporary .dvi file..."
187
188 # Next we use jadetext to generate a .dvi file
189 # This needs three passes to properly generate the index (page numbering)
190 cd $tempdir
191 for PASS in 1 2 3 ; do
192 /usr/bin/jadetex install.${language}.tex >/dev/null
193 RET=$?; [ $RET -ne 0 ] && break
194 done
195 cd ..
196 [ $RET -ne 0 ] && return $RET
197
198 return 0
199 }
200
201 create_pdf() {
202
203 [ -x /usr/bin/dvipdf ] || return 9
204
205 create_dvi
206 RET=$?; [ $RET -ne 0 ] && return $RET
207
208 echo "Info: creating .pdf file..."
209
210 /usr/bin/dvipdf $tempdir/install.${language}.dvi
211 RET=$?; [ $RET -ne 0 ] && return $RET
212 mv install.${language}.pdf $destdir/
213
214 return 0
215 }
216
217 create_ps() {
218
219 [ -x /usr/bin/dvips ] || return 9
220
221 create_dvi
222 RET=$?; [ $RET -ne 0 ] && return $RET
223
224 echo "Info: creating .ps file..."
225
226 /usr/bin/dvips -q $tempdir/install.${language}.dvi
227 RET=$?; [ $RET -ne 0 ] && return $RET
228 mv install.${language}.ps $destdir/
229
230 return 0
231 }
232
233 ## MAINLINE
234
235 # Clean old builds
236 rm -rf $tempdir
237 rm -rf $destdir
238
239 [ -d "$manual_path/$language" ] || {
240 echo "Error: unknown language '$language'"
241 exit 1
242 }
243
244 mkdir -p $tempdir
245 mkdir -p $destdir
246
247 # Create profiled XML. This is needed for all output formats.
248 create_profiled
249 RET=$?; [ $RET -ne 0 ] && exit 1
250
251 BUILD_OK=""
252 BUILD_FAIL=""
253 for format in $formats ; do
254 if [ "$language" = "ja" ] && [ "$format" = "pdf" -o "$format" = "ps" ] ; then
255 echo "Warning: pdf and ps formats are currently not supported for Japanese"
256 BUILD_SKIP="$BUILD_SKIP $format"
257 continue
258 fi
259
260 case $format in
261 html) create_html;;
262 ps) create_ps;;
263 pdf) create_pdf;;
264 txt) create_text;;
265 *)
266 echo "Error: format $format unknown or not yet supported!"
267 exit 1
268 ;;
269 esac
270
271 RET=$?
272 case $RET in
273 0)
274 BUILD_OK="$BUILD_OK $format"
275 ;;
276 9)
277 BUILD_FAIL="$BUILD_FAIL $format"
278 echo "Error: build of $format failed because of missing build dependencies"
279 ;;
280 *)
281 BUILD_FAIL="$BUILD_FAIL $format"
282 echo "Error: build of $format failed with error code $RET"
283 ;;
284 esac
285 done
286
287 # Clean up
288 rm -r $tempdir
289
290 # Evaluate the overall results
291 [ -n "$BUILD_SKIP" ] && echo "Info: The following formats were skipped:$BUILD_SKIP"
292 [ -z "$BUILD_FAIL" ] && exit 0 # Build successful for all formats
293 echo "Warning: The following formats failed to build:$BUILD_FAIL"
294 [ -n "$BUILD_OK" ] && exit 2 # Build failed for some formats
295 exit 1 # Build failed for all formats

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5