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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5