/[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 43735 - (hide annotations) (download) (as text)
Mon Jan 1 10:56:08 2007 UTC (6 years, 5 months ago) by fjp
File MIME type: application/x-sh
File size: 9394 byte(s)
- Update number of developers, packages and mailing lists
- General revision of minimum hardware requirements throughout the manual
- Update of installed/download size of tasks
- Delete some unused entities in build/entities/common.ent
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    
94 fjpop-guest 24560 sed "s:##SRCPATH##:$source_path:" templates/docstruct.ent >> $dynamic
95 pronik-guest 21971
96 fjpop-guest 23368 sed "s:##LANG##:$language:g" templates/install.xml.template | \
97 fjpop-guest 24560 sed "s:##TEMPDIR##:$tempdir:g" | \
98     sed "s:##ENTPATH##:$entities_path:g" | \
99     sed "s:##SRCPATH##:$source_path:" > $tempdir/install.${language}.xml
100 pronik-guest 21971
101 fjpop-guest 23368 # Create the profiled xml file
102 joeyh 41850 xsltproc \
103 fjpop-guest 23368 --xinclude \
104     --stringparam profile.arch "$archspec" \
105     --stringparam profile.condition "$condition" \
106     --output $tempdir/install.${language}.profiled.xml \
107     $stylesheet_profile \
108     $tempdir/install.${language}.xml
109 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
110    
111     return 0
112 pronik-guest 21971 }
113    
114     create_html () {
115    
116 fjpop-guest 24223 echo "Info: creating .html files..."
117 fjpop-guest 23368
118 joeyh 41850 xsltproc \
119 fjpop-guest 21976 --xinclude \
120 fjpop-guest 24560 --stringparam base.dir $destdir/html/ \
121 fjpop-guest 21976 $stylesheet_html \
122 fjpop-guest 21995 $tempdir/install.${language}.profiled.xml
123 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
124    
125 fjpop-guest 27855 # Copy the custom css stylesheet to the destination directory
126     cp $stylesheet_css $destdir/html/
127    
128 fjpop-guest 24223 return 0
129 pronik-guest 21971 }
130    
131 fjpop-guest 24214 create_text () {
132    
133 joeyh 41850 [ -x "`which w3m 2>/dev/null`" ] || return 9
134 fjpop-guest 24214
135 fjpop-guest 24223 echo "Info: creating temporary .html file..."
136 fjpop-guest 24214
137 joeyh 41850 xsltproc \
138 fjpop-guest 24214 --xinclude \
139     --output $tempdir/install.${language}.html \
140     $stylesheet_html_single \
141     $tempdir/install.${language}.profiled.xml
142 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
143 fjpop-guest 24214
144     # Replace some unprintable characters
145 fjpop-guest 24330 sed "s:–:-:g # n-dash
146     s:—:--:g # m-dash
147     s:“:\&quot;:g # different types of quotes
148     s:”:\&quot;:g
149     s:„:\&quot;:g
150     s:…:...:g # ellipsis
151     s:™: (tm):g # trademark" \
152 fjpop-guest 24223 $tempdir/install.${language}.html >$tempdir/install.${language}.corr.html
153     RET=$?; [ $RET -ne 0 ] && return $RET
154 fjpop-guest 24214
155 fjpop-guest 24223 echo "Info: creating .txt file..."
156 fjpop-guest 24214
157     # Set encoding for output file
158 fjpop-guest 24560 case "$language" in
159 fjpop-guest 24214 ja)
160 fjpop-guest 26533 CHARSET=EUC-JP ;;
161     ko)
162     CHARSET=EUC-KR ;;
163 fjpop-guest 24214 ru)
164 fjpop-guest 26533 CHARSET=KOI8-R ;;
165 fjp 39480 cs|el|hu|ro|zh_CN|zh_TW)
166 fjpop-guest 26971 CHARSET=UTF-8 ;;
167 fjpop-guest 24214 *)
168 fjpop-guest 26533 CHARSET=ISO-8859-1 ;;
169 fjpop-guest 24214 esac
170    
171 joeyh 41850 HOME=$tempdir w3m -dump $tempdir/install.${language}.corr.html \
172 fjpop-guest 24214 -o display_charset=$CHARSET \
173 fjpop-guest 24560 >$destdir/install.${language}.txt
174 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
175 fjpop-guest 26533
176 fjpop-guest 24223 return 0
177 fjpop-guest 24214 }
178    
179 fjpop-guest 23385 create_dvi () {
180 pronik-guest 22108
181 joeyh 41850 [ -x "`which openjade 2>/dev/null`" ] || return 9
182     [ -x "`which jadetex 2>/dev/null`" ] || return 9
183 fjpop-guest 24223
184 fjpop-guest 23368 # Skip this step if the .dvi file already exists
185 fjpop-guest 24560 [ -f "$tempdir/install.${language}.dvi" ] && return
186 fjpop-guest 23368
187 fjpop-guest 24223 echo "Info: creating temporary .tex file..."
188 fjpop-guest 21976
189 fjpop-guest 23381 # And use openjade to generate a .tex file
190 fjpop-guest 23368 export SP_ENCODING="utf-8"
191 joeyh 41850 openjade -t tex \
192 fjpop-guest 23368 -b utf-8 \
193     -o $tempdir/install.${language}.tex \
194     -d $stylesheet_dsssl \
195 fjp 34676 -V tex-backend declaration/xml.dcl \
196 fjpop-guest 23368 $tempdir/install.${language}.profiled.xml
197 fjpop-guest 25031 RET=$?; [ $RET -ne 0 ] && return $RET
198 fjpop-guest 23368
199 fjp 40073 # some languages need additional macro
200     case "$language" in
201     ko)
202     mv $tempdir/install.${language}.tex \
203     $tempdir/install.${language}.orig.tex
204     cat templates/header.${language}.tex \
205     $tempdir/install.${language}.orig.tex \
206     > $tempdir/install.${language}.tex
207     rm $tempdir/install.${language}.orig.tex
208     ;;
209     esac
210    
211 fjpop-guest 24223 echo "Info: creating temporary .dvi file..."
212 fjpop-guest 23368
213 fjp 38466 # Next we use jadetex to generate a .dvi file
214 fjpop-guest 24223 # This needs three passes to properly generate the index (page numbering)
215 fjpop-guest 23368 cd $tempdir
216     for PASS in 1 2 3 ; do
217 joeyh 41850 jadetex install.${language}.tex >/dev/null
218 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && break
219 fjpop-guest 23368 done
220     cd ..
221 fjpop-guest 24223 [ $RET -ne 0 ] && return $RET
222    
223     return 0
224 pronik-guest 22108 }
225 pronik-guest 21971
226 pronik-guest 22108 create_pdf() {
227    
228 joeyh 41850 [ -x "`which dvipdf 2>/dev/null`" ] || return 9
229 fjpop-guest 24223
230 pronik-guest 22108 create_dvi
231 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
232 fjpop-guest 23368
233 fjpop-guest 24223 echo "Info: creating .pdf file..."
234 fjpop-guest 23368
235 joeyh 41850 dvipdf $tempdir/install.${language}.dvi
236 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
237 fjpop-guest 24560 mv install.${language}.pdf $destdir/
238 fjpop-guest 24223
239     return 0
240 pronik-guest 22108 }
241    
242     create_ps() {
243    
244 joeyh 41850 [ -x "`which dvips 2>/dev/null`" ] || return 9
245 fjpop-guest 24223
246 pronik-guest 22108 create_dvi
247 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
248 fjpop-guest 23368
249 fjpop-guest 24223 echo "Info: creating .ps file..."
250 fjpop-guest 23368
251 joeyh 41850 dvips -q $tempdir/install.${language}.dvi
252 fjpop-guest 24223 RET=$?; [ $RET -ne 0 ] && return $RET
253 fjpop-guest 24560 mv install.${language}.ps $destdir/
254 fjpop-guest 24223
255     return 0
256 pronik-guest 22108 }
257    
258 fjpop-guest 23368 ## MAINLINE
259    
260     # Clean old builds
261     rm -rf $tempdir
262 fjpop-guest 24560 rm -rf $destdir
263 fjpop-guest 23368
264 fjpop-guest 24560 [ -d "$manual_path/$language" ] || {
265     echo "Error: unknown language '$language'"
266 fjpop-guest 23368 exit 1
267     }
268    
269 pronik-guest 21971 mkdir -p $tempdir
270 fjpop-guest 24560 mkdir -p $destdir
271 pronik-guest 21971
272 fjpop-guest 24223 # Create profiled XML. This is needed for all output formats.
273     create_profiled
274     RET=$?; [ $RET -ne 0 ] && exit 1
275    
276     BUILD_OK=""
277     BUILD_FAIL=""
278 fjpop-guest 23368 for format in $formats ; do
279 fjpop-guest 27015 case "$language" in
280 fjp 40073 el|ja|vi|zh_CN|zh_TW)
281 fjpop-guest 27015 if [ "$format" = "pdf" -o "$format" = "ps" ] ; then
282 fjp 40073 echo "Warning: pdf and ps formats are currently not supported for Chinese, Greek, Japanese and Vietnamese"
283 fjpop-guest 27015 BUILD_SKIP="$BUILD_SKIP $format"
284     continue
285     fi
286     ;;
287     esac
288 fjpop-guest 24223
289 fjpop-guest 23368 case $format in
290 fjpop-guest 23385 html) create_html;;
291     ps) create_ps;;
292     pdf) create_pdf;;
293 fjpop-guest 24214 txt) create_text;;
294 fjpop-guest 24223 *)
295     echo "Error: format $format unknown or not yet supported!"
296     exit 1
297     ;;
298     esac
299 pronik-guest 21971
300 fjpop-guest 24223 RET=$?
301     case $RET in
302     0)
303     BUILD_OK="$BUILD_OK $format"
304     ;;
305     9)
306     BUILD_FAIL="$BUILD_FAIL $format"
307     echo "Error: build of $format failed because of missing build dependencies"
308     ;;
309     *)
310     BUILD_FAIL="$BUILD_FAIL $format"
311     echo "Error: build of $format failed with error code $RET"
312     ;;
313 fjpop-guest 23368 esac
314     done
315 pronik-guest 21971
316 fjpop-guest 23368 # Clean up
317 fjp 42358 rm -r $tempdir
318 fjpop-guest 23368
319 fjpop-guest 24223 # Evaluate the overall results
320     [ -n "$BUILD_SKIP" ] && echo "Info: The following formats were skipped:$BUILD_SKIP"
321     [ -z "$BUILD_FAIL" ] && exit 0 # Build successful for all formats
322     echo "Warning: The following formats failed to build:$BUILD_FAIL"
323     [ -n "$BUILD_OK" ] && exit 2 # Build failed for some formats
324     exit 1 # Build failed for all formats

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5