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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5