/[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 43782 - (hide annotations) (download) (as text)
Wed Jan 3 07:29:48 2007 UTC (6 years, 4 months ago) by fjp
File MIME type: application/x-sh
File size: 9492 byte(s)
Document the graphical installer, including the main known issues
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 fjpop-guest 27855 stylesheet_css="$stylesheet_dir/install.css"
32 pronik-guest 22121
33 fjpop-guest 23368 entities_path="$build_path/entities"
34     source_path="$manual_path/$language"
35 pronik-guest 22121
36 fjpop-guest 24560 if [ -z "$destdir" ]; then
37     destdir="build.out"
38 pronik-guest 22121 fi
39    
40 fjpop-guest 23368 tempdir="build.tmp"
41 pronik-guest 22121 dynamic="${tempdir}/dynamic.ent"
42    
43 pronik-guest 21971 create_profiled () {
44    
45 joeyh 41850 [ -x "`which xsltproc 2>/dev/null`" ] || return 9
46 fjpop-guest 23368
47 fjpop-guest 24223 echo "Info: creating temporary profiled .xml file..."
48 fjpop-guest 23368
49 pronik-guest 21971 if [ ! "$official_build" ]; then
50 fjpop-guest 21976 unofficial_build="FIXME;unofficial-build"
51 pronik-guest 21971 else
52 fjpop-guest 21976 unofficial_build=""
53 pronik-guest 21971 fi
54    
55 fjpop-guest 27074 if [ -z "$manual_release" ]; then
56 fjp 33725 manual_release="etch"
57 fjpop-guest 27074 fi
58 fjp 30374 if [ -z "$manual_target" ]; then
59     manual_target="for_cd"
60     fi
61 fjpop-guest 27074
62 fjpop-guest 23368 # Now we source the profiling information for the selected architecture
63 fjpop-guest 24560 [ -f "arch-options/${arch}" ] || {
64     echo "Error: unknown architecture '$arch'"
65 fjpop-guest 24223 return 1
66 fjpop-guest 23368 }
67     . arch-options/$arch
68 pronik-guest 21971
69 fjp 36879 # Now we source the profiling information for the current language
70     if [ -f "lang-options/${language}" ]; then
71     . lang-options/$language
72     fi
73    
74 fjpop-guest 23368 # Join all architecture options into one big variable
75 fjp 43642 condition="$fdisk;$network;$boot;$smp;$frontend;$other;$goodies;$unofficial_build;$status;$manual_release"
76 fjp 36879 # Add language options
77     condition="$condition;$optional_paras"
78 fjp 29683 # Add build options for the manual
79 fjp 30374 condition="$condition;$unofficial_build;$status;$manual_release;$manual_target"
80 fjp 40980 # TODO: Obsoleted, but keep until translations have been updated
81 fjp 43585 condition="$condition;common-kpkg;supports-dhcp"
82 pronik-guest 21971
83 fjpop-guest 23368 # Write dynamic non-profilable entities into the file
84 pronik-guest 21971 echo "<!-- arch- and lang-specific non-profilable entities -->" > $dynamic
85     echo "<!ENTITY langext \".${language}\">" >> $dynamic
86     echo "<!ENTITY architecture \"${arch}\">" >> $dynamic
87     echo "<!ENTITY kernelversion \"${kernelversion}\">" >> $dynamic
88 fjp 35329 echo "<!ENTITY arch-listname \"${arch_listname}\">" >> $dynamic
89 pronik-guest 21971 echo "<!ENTITY altkernelversion \"${altkernelversion}\">" >> $dynamic
90 fjp 28997 echo "<!ENTITY smp-config-section \"${smp_config_section}\">" >> $dynamic
91     echo "<!ENTITY smp-config-option \"${smp_config_option}\">" >> $dynamic
92 fjp 43735 echo "<!ENTITY minimum-memory \"${minimum_memory}&notation-megabytes;\">" >> $dynamic
93 fjp 43782 echo "<!ENTITY minimum-memory-gtk \"${minimum_memory_gtk}&notation-megabytes;\">" >> $dynamic
94 fjp 43735
95 fjpop-guest 24560 sed "s:##SRCPATH##:$source_path:" templates/docstruct.ent >> $dynamic
96 pronik-guest 21971
97 fjpop-guest 23368 sed "s:##LANG##:$language:g" templates/install.xml.template | \
98 fjpop-guest 24560 sed "s:##TEMPDIR##:$tempdir:g" | \
99     sed "s:##ENTPATH##:$entities_path:g" | \
100     sed "s:##SRCPATH##:$source_path:" > $tempdir/install.${language}.xml
101 pronik-guest 21971
102 fjpop-guest 23368 # Create the profiled xml file
103 joeyh 41850 xsltproc \
104 fjpop-guest 23368 --xinclude \
105     --stringparam profile.arch "$archspec" \
106     --stringparam profile.condition "$condition" \
107     --output $tempdir/install.${language}.profiled.xml \
108     $stylesheet_profile \
109     $tempdir/install.${language}.xml
110 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
111    
112     return 0
113 pronik-guest 21971 }
114    
115     create_html () {
116    
117 fjpop-guest 24223 echo "Info: creating .html files..."
118 fjpop-guest 23368
119 joeyh 41850 xsltproc \
120 fjpop-guest 21976 --xinclude \
121 fjpop-guest 24560 --stringparam base.dir $destdir/html/ \
122 fjpop-guest 21976 $stylesheet_html \
123 fjpop-guest 21995 $tempdir/install.${language}.profiled.xml
124 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
125    
126 fjpop-guest 27855 # Copy the custom css stylesheet to the destination directory
127     cp $stylesheet_css $destdir/html/
128    
129 fjpop-guest 24223 return 0
130 pronik-guest 21971 }
131    
132 fjpop-guest 24214 create_text () {
133    
134 joeyh 41850 [ -x "`which w3m 2>/dev/null`" ] || return 9
135 fjpop-guest 24214
136 fjpop-guest 24223 echo "Info: creating temporary .html file..."
137 fjpop-guest 24214
138 joeyh 41850 xsltproc \
139 fjpop-guest 24214 --xinclude \
140     --output $tempdir/install.${language}.html \
141     $stylesheet_html_single \
142     $tempdir/install.${language}.profiled.xml
143 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
144 fjpop-guest 24214
145     # Replace some unprintable characters
146 fjpop-guest 24330 sed "s:–:-:g # n-dash
147     s:—:--:g # m-dash
148     s:“:\&quot;:g # different types of quotes
149     s:”:\&quot;:g
150     s:„:\&quot;:g
151     s:…:...:g # ellipsis
152     s:™: (tm):g # trademark" \
153 fjpop-guest 24223 $tempdir/install.${language}.html >$tempdir/install.${language}.corr.html
154     RET=$?; [ $RET -ne 0 ] && return $RET
155 fjpop-guest 24214
156 fjpop-guest 24223 echo "Info: creating .txt file..."
157 fjpop-guest 24214
158     # Set encoding for output file
159 fjpop-guest 24560 case "$language" in
160 fjpop-guest 24214 ja)
161 fjpop-guest 26533 CHARSET=EUC-JP ;;
162     ko)
163     CHARSET=EUC-KR ;;
164 fjpop-guest 24214 ru)
165 fjpop-guest 26533 CHARSET=KOI8-R ;;
166 fjp 39480 cs|el|hu|ro|zh_CN|zh_TW)
167 fjpop-guest 26971 CHARSET=UTF-8 ;;
168 fjpop-guest 24214 *)
169 fjpop-guest 26533 CHARSET=ISO-8859-1 ;;
170 fjpop-guest 24214 esac
171    
172 joeyh 41850 HOME=$tempdir w3m -dump $tempdir/install.${language}.corr.html \
173 fjpop-guest 24214 -o display_charset=$CHARSET \
174 fjpop-guest 24560 >$destdir/install.${language}.txt
175 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
176 fjpop-guest 26533
177 fjpop-guest 24223 return 0
178 fjpop-guest 24214 }
179    
180 fjpop-guest 23385 create_dvi () {
181 pronik-guest 22108
182 joeyh 41850 [ -x "`which openjade 2>/dev/null`" ] || return 9
183     [ -x "`which jadetex 2>/dev/null`" ] || return 9
184 fjpop-guest 24223
185 fjpop-guest 23368 # Skip this step if the .dvi file already exists
186 fjpop-guest 24560 [ -f "$tempdir/install.${language}.dvi" ] && return
187 fjpop-guest 23368
188 fjpop-guest 24223 echo "Info: creating temporary .tex file..."
189 fjpop-guest 21976
190 fjpop-guest 23381 # And use openjade to generate a .tex file
191 fjpop-guest 23368 export SP_ENCODING="utf-8"
192 joeyh 41850 openjade -t tex \
193 fjpop-guest 23368 -b utf-8 \
194     -o $tempdir/install.${language}.tex \
195     -d $stylesheet_dsssl \
196 fjp 34676 -V tex-backend declaration/xml.dcl \
197 fjpop-guest 23368 $tempdir/install.${language}.profiled.xml
198 fjpop-guest 25031 RET=$?; [ $RET -ne 0 ] && return $RET
199 fjpop-guest 23368
200 fjp 40073 # some languages need additional macro
201     case "$language" in
202     ko)
203     mv $tempdir/install.${language}.tex \
204     $tempdir/install.${language}.orig.tex
205     cat templates/header.${language}.tex \
206     $tempdir/install.${language}.orig.tex \
207     > $tempdir/install.${language}.tex
208     rm $tempdir/install.${language}.orig.tex
209     ;;
210     esac
211    
212 fjpop-guest 24223 echo "Info: creating temporary .dvi file..."
213 fjpop-guest 23368
214 fjp 38466 # Next we use jadetex to generate a .dvi file
215 fjpop-guest 24223 # This needs three passes to properly generate the index (page numbering)
216 fjpop-guest 23368 cd $tempdir
217     for PASS in 1 2 3 ; do
218 joeyh 41850 jadetex install.${language}.tex >/dev/null
219 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && break
220 fjpop-guest 23368 done
221     cd ..
222 fjpop-guest 24223 [ $RET -ne 0 ] && return $RET
223    
224     return 0
225 pronik-guest 22108 }
226 pronik-guest 21971
227 pronik-guest 22108 create_pdf() {
228    
229 joeyh 41850 [ -x "`which dvipdf 2>/dev/null`" ] || return 9
230 fjpop-guest 24223
231 pronik-guest 22108 create_dvi
232 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
233 fjpop-guest 23368
234 fjpop-guest 24223 echo "Info: creating .pdf file..."
235 fjpop-guest 23368
236 joeyh 41850 dvipdf $tempdir/install.${language}.dvi
237 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
238 fjpop-guest 24560 mv install.${language}.pdf $destdir/
239 fjpop-guest 24223
240     return 0
241 pronik-guest 22108 }
242    
243     create_ps() {
244    
245 joeyh 41850 [ -x "`which dvips 2>/dev/null`" ] || return 9
246 fjpop-guest 24223
247 pronik-guest 22108 create_dvi
248 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
249 fjpop-guest 23368
250 fjpop-guest 24223 echo "Info: creating .ps file..."
251 fjpop-guest 23368
252 joeyh 41850 dvips -q $tempdir/install.${language}.dvi
253 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
254 fjpop-guest 24560 mv install.${language}.ps $destdir/
255 fjpop-guest 24223
256     return 0
257 pronik-guest 22108 }
258    
259 fjpop-guest 23368 ## MAINLINE
260    
261     # Clean old builds
262     rm -rf $tempdir
263 fjpop-guest 24560 rm -rf $destdir
264 fjpop-guest 23368
265 fjpop-guest 24560 [ -d "$manual_path/$language" ] || {
266     echo "Error: unknown language '$language'"
267 fjpop-guest 23368 exit 1
268     }
269    
270 pronik-guest 21971 mkdir -p $tempdir
271 fjpop-guest 24560 mkdir -p $destdir
272 pronik-guest 21971
273 fjpop-guest 24223 # Create profiled XML. This is needed for all output formats.
274     create_profiled
275     RET=$?; [ $RET -ne 0 ] && exit 1
276    
277     BUILD_OK=""
278     BUILD_FAIL=""
279 fjpop-guest 23368 for format in $formats ; do
280 fjpop-guest 27015 case "$language" in
281 fjp 40073 el|ja|vi|zh_CN|zh_TW)
282 fjpop-guest 27015 if [ "$format" = "pdf" -o "$format" = "ps" ] ; then
283 fjp 40073 echo "Warning: pdf and ps formats are currently not supported for Chinese, Greek, Japanese and Vietnamese"
284 fjpop-guest 27015 BUILD_SKIP="$BUILD_SKIP $format"
285     continue
286     fi
287     ;;
288     esac
289 fjpop-guest 24223
290 fjpop-guest 23368 case $format in
291 fjpop-guest 23385 html) create_html;;
292     ps) create_ps;;
293     pdf) create_pdf;;
294 fjpop-guest 24214 txt) create_text;;
295 fjpop-guest 24223 *)
296     echo "Error: format $format unknown or not yet supported!"
297     exit 1
298     ;;
299     esac
300 pronik-guest 21971
301 fjpop-guest 24223 RET=$?
302     case $RET in
303     0)
304     BUILD_OK="$BUILD_OK $format"
305     ;;
306     9)
307     BUILD_FAIL="$BUILD_FAIL $format"
308     echo "Error: build of $format failed because of missing build dependencies"
309     ;;
310     *)
311     BUILD_FAIL="$BUILD_FAIL $format"
312     echo "Error: build of $format failed with error code $RET"
313     ;;
314 fjpop-guest 23368 esac
315     done
316 pronik-guest 21971
317 fjpop-guest 23368 # Clean up
318 fjp 42358 rm -r $tempdir
319 fjpop-guest 23368
320 fjpop-guest 24223 # Evaluate the overall results
321     [ -n "$BUILD_SKIP" ] && echo "Info: The following formats were skipped:$BUILD_SKIP"
322     [ -z "$BUILD_FAIL" ] && exit 0 # Build successful for all formats
323     echo "Warning: The following formats failed to build:$BUILD_FAIL"
324     [ -n "$BUILD_OK" ] && exit 2 # Build failed for some formats
325     exit 1 # Build failed for all formats

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5