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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5