/[clonezilla-sysresccd]/trunk/www/working/scripts/2site
ViewVC logotype

Contents of /trunk/www/working/scripts/2site

Parent Directory Parent Directory | Revision Log Revision Log


Revision 49 - (show annotations)
Thu May 20 15:43:26 2010 UTC (11 years, 5 months ago) by sng
File size: 13078 byte(s)
Adding html2html script in trunk/www/working/scripts
Adding offline documentation html files in trunk/www/2doc

1 #!/bin/bash
2 ##############################################################################
3 # #
4 # 2site, (C) 2007-2010 S. Georgaras <sng@hellug.gr> #
5 # #
6 # This file is part of Clonezilla-SysRescCD. #
7 # #
8 # Clonezilla-SysRescCD is free software: you can redistribute it and/or #
9 # modify it under the terms of the GNU General Public License as published #
10 # by the Free Software Foundation, either version 2 of the License, or #
11 # (at your option) any later version. #
12 # #
13 # Clonezilla-SysRescCD is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU General Public License for more details. #
17 # #
18 # You should have received a copy of the GNU General Public License along #
19 # with Clonezilla-SysRescCD. If not, see <http://www.gnu.org/licenses/>. #
20 # #
21 ##############################################################################
22
23
24 ##############################################################################
25 # Configuration section
26 #
27 # Set whereIsTheISO to the location of current Clonezilla-SysRescCD ISO file
28 # Set whereIsTheTarBall to the location of current Clonezilla-SysRescCD TGZ file
29 whereIsTheISO=/e/clonezilla-sysresccd-full-mod-"$myVersion"/clonezilla-sysresccd-full-mod-"$myVersion".iso
30 whereIsTheISO=/e/clonezilla-sysresccd-full-mod-"$myVersion".iso
31
32 whereIsTheTarBall=/home/spiros/multibootcd/create-clonezilla-sysresccd-"$myVersion".tar.gz
33
34 ##############################################################################
35 # Script starts here #
36 ##############################################################################
37
38 # Go to www/ directory
39 cd ..
40 cd ..
41 echo 'Creating files'
42 echo -n " template.html... "
43 myDate=`sed -n '1p' working/release-data `
44 myVersion=`sed -n '2p' working/release-data `
45 thisDate=`date '+%d/%m/%Y'`
46 md5sum="$(echo "$whereIsTheISO" | sed 's|/[^/]*$|/md5sum.txt|')"
47 md5sum="$(cat "$md5sum")"
48
49 tarballSize=$(du -h "$whereIsTheTarBall" | sed "s|/.*||" |sed 's|\([kMG]\).*| \1|')
50 isoSizeEN=$(echo "$isoSize" | sed 's|,|.|')
51 # isoSizeGR=$(echo "$isoSize" | sed 's|\.|,|')
52 tarballSizeEN=$(echo "$tarballSize" | sed 's|,|.|')
53 # tarballSizeGR=$(echo "$tarballSize" | sed 's|\.|,|')
54
55
56
57
58 tr -d '\n' < working/clonezilla-sysresccd.rss | sed 's|<[tT][iI][tT][lL][eE]>|\n<title>|g' | sed 's|</[pP][uU][bB][Dd][aA][tT][eE]>|</pubDate>\n|g' | grep '<title>' > /tmp/iaa.$$
59
60 rm /tmp/aai.$$ 2>/dev/null
61 while read line;do
62 dt="$(echo "$line" | sed 's|.*<guid isPermaLink="false">.*, ||' |sed 's| [0-9][0-9]:.*||' | sed 's|.*<pubDate>..., ||'| sed 's|\([^ ]*\) \([^ ]*\) \(.*\)|\3 \2 \1|' | sed 's|Jan|01|
63 s|Feb|02|
64 s|Mar|03|
65 s|Apr|04|
66 s|May|05|
67 s|Jun|06|
68 s|Jul|07|
69 s|Aug|08|
70 s|Sep|09|
71 s|Oct|10|
72 s|Nov|11|
73 s|Dec|12|
74 ')"
75 tit="$(echo "$line" | sed 's|</[Tt][iI][tT][lL][eE]>.*||' | sed 's|<title>||')"
76 echo "$dt - $tit" | grep '^[0-9]' >> /tmp/aai.$$
77 done < /tmp/iaa.$$
78 rm /tmp/iaa.$$
79
80 l="$(cat /tmp/aai.$$ | sort -r | sed 's|^\([0-9][0-9][0-9][0-9]\) \([0-9][0-9]\) \([0-9][0-9]\) - \(.*\)|<p><a href="news.php#\4">\3/\2/\1 - \4</a></p>|' | sed -n '1,$p' | sed 's|$| \\|')"
81
82
83
84 rm /tmp/aai.$$
85
86 sed "/<H1[^>]*>What's New<.H1>/a \
87 $l
88 " working/.template.html | sed "s|\"myDate\"|$myDate|" | sed "s|\"myVersion\"|$myVersion|g" | sed "s|Last update: [^<]*<|Last update: $thisDate<|" > template.html
89
90
91 echo 'done'
92
93 #############################################################################
94 # #
95 # Create news.php #
96 # #
97 #############################################################################
98
99 echo -n ' news.php... '
100 sed -n '1,/<div id="content">/p' template.html > 1.$$
101 cat working/.news.php >> 1.$$
102 sed '1,/<div id="content">/d' template.html | sed '/<div id="menu">/,/<.div>/d' >> 1.$$
103
104 sed '/#content/s/width: 750px;/width: 950px/' 1.$$ | sed "s|background-image: url('images/line.png'); background-repeat:repeat-y;||
105 s|class=\"here\" ||
106 s|<a href=\"news.php\">|<a class=\"here\" href=\"news.php\">|
107 s|\"myTitle\"|What's New|
108 /<div id=\"header\">/a \
109 <a name=\"news-top\"></a>" > news.php
110 echo 'done'
111
112
113 #############################################################################
114 # #
115 # Create 404.html #
116 # #
117 #############################################################################
118 echo -n ' 404.html... '
119 sed -n '1,/<div id="content">/p' template.html > 1.$$
120 sed '1,/<div id="content">/d' template.html | sed '/<div id="menu">/,/<.div>/d' >> 1.$$
121 sed '/#content/s/width: 750px;/width: 950px/' 1.$$ | sed "s|background-image: url('images/line.png'); background-repeat:repeat-y;||
122 s|class=\"here\" ||
123 s|\"myTitle\"|Error|
124 s|#content { float: left;|#content { |
125 " > xxx.html
126 rm 1.$$
127
128 sed -n '1,/<.[hH][eE][aA][dD]>/p' xxx.html | sed '$d' > p1.$$
129 sed -n '1,/<!--seperator-->/p' working/.404.html >> p1.$$
130 sed -n '/<.[hH][eE][aA][dD]>/,$p' xxx.html >> p1.$$
131 mv p1.$$ xxx.html
132
133 sed -n '1,/<[dD][iI][vV] [iI][dD]="content">/p' xxx.html> p1.$$
134 sed '1,/<!--seperator-->/d' working/.404.html >> p1.$$
135 sed -n '/<[dD][iI][vV] [iI][dD]="content">/,$p' xxx.html | sed '1d' >> p1.$$
136 sed '/<!--seperator-->/d' p1.$$ > 404.html
137 rm *.$$ xxx.html
138 echo 'done'
139
140
141
142 #############################################################################
143 # #
144 # Create files (main menu) #
145 # #
146 #############################################################################
147 # for n in index.html features.html doc.html download.html screenshots.html credits.html links.html;do
148 echo 'Creating menu files'
149 # for n in index.html screenshots.html help.html doc.html;do
150
151
152
153 for n in working/*.html;do
154 # for n in working/boot-params.html;do
155 echo -n " ${n/working\//}... "
156 myTitle=`sed -n '/<[hH]3>/p' "$n" | sed '
157 2,$d
158 s/<[^<]*<[bB][rR] *\/*>\([^<]*\)<[bB][rR].*/\1/
159 s|<\/*[hH]3>||g'`
160
161
162 # fix first H2
163 sed '
164 s|<[hH]2[^>]*>|<H2>|g
165 0,/<[hH]2[^>]*><[aA] [nN][aA][mM][eE]/s//<H2 style="margin-top: 0;"><a name/
166 1,/<div id="content">/d
167 /<div id="footer">/,$d
168 /<div id="menu">/,$d
169 $d' "$n" > "$n".$$
170
171
172
173 # # echo "myTitle = $myTitle"
174 # X=`sed '1,/<[bB][oO][dD][yY]/d' "$n".$$ | sed '/<.[bB][oO][dD][yY]>/,$d'`
175 # X=`echo "$X" | sed 's|$| \\\\|'`
176 # sed "/<div id=\"content\">/a \
177 # $X
178 # " template.html > tpm.$$
179
180
181 sed "/<div id=\"content\">/ r "$n".$$" template.html > tpm.$$
182
183
184 fonly="$n"
185 fonly="${fonly/working\//}"
186 sed '/<!--txt-only-->/!b
187 :a
188 /<!--end-txt-only-->/!{
189 N
190 ba
191 }
192 s/<!--txt-only-->.*<!--end-txt-only-->//' tpm.$$ | sed 's| $||' | sed "s|\"myTitle\"|$myTitle|
193 s|\"myVersion\"|$myVersion|g
194 s|TARBALL_SIZE|$tarballSizeEN|g
195 s|ISO_SIZE|$isoSizeEN|g
196 s|\"MD5SUM\"|$md5sum|
197 /<[hH]1>.*<[bB][rR]/d
198 s|class=\"here\" ||
199 s|<a href=\"$fonly\">|<a class=\"here\" href=\"$fonly\">|
200 s|</div><div id=\"menu\">|<div id=\"menu\">|" > "${n/working\//}"
201
202 rm tpm.$$ "$n".$$
203 echo 'done'
204
205
206 done
207
208
209
210 #############################################################################
211 # #
212 # Fix doc.html - Documentation menu #
213 # #
214 #############################################################################
215 # num=`grep -n '<div id="linkline">' doc.html | sed 's|:.*||'`
216 #
217 # '
218 # s|class=\"here\" ||
219 # s|<a href=\"$n\">|<a class=\"here\" href=\"$n\">|' doc.html > doc.html.$$
220 # mv doc.html.$$ doc.html
221
222
223 echo '<H2 style="margin-top: 0;">Contents</H2>
224 <p>' >list
225
226 echo 'Fixing documentation files'
227 count=0
228
229
230
231 # for n in project.html \
232 # custom-cd.html \
233 # usb.html \
234 # boot-params.html \
235 # clonezilla.html \
236 # backup.html \
237 # backup-smb.html \
238 # restoration.html \
239 # restore.html \
240 # restore-burn.html \
241 # reloc-img.html \
242 # supergrubdisk.html \
243 # oldboot.html \
244 # sysresccd.html \
245 # partitions.html \
246 # recover.html \
247 # own-scripts.html \
248 # annex-a-devices.html
249
250 theFiles="usb.html
251 boot-params.html
252 clonezilla.html
253 backup.html
254 backup-smb.html
255 restoration.html
256 restore.html
257 restore-burn.html
258 reloc-img.html
259 supergrubdisk.html
260 oldboot.html
261 sysresccd.html
262 partitions.html
263 recover.html
264 own-scripts.html
265 annex-a-devices.html"
266 for n in $theFiles
267 do
268 html[count]="$n"
269 ((count++))
270 done
271
272
273 count=0
274 while [ -n "${html[$count]}" ]
275 do
276 if [ $count -eq 0 ];then
277 unset prev
278 else
279 prev="${html[$((count-1))]}"
280 fi
281 n="${html[$count]}"
282 next="${html[$((count+1))]}"
283 #
284 # for n in boot-params.html
285 # do
286
287 echo -n " $n... "
288
289 sed 's| $||' "$n" | sed "
290 /<[hH]1>.*<[bB][rR]/d
291 s|class=\"here\" ||
292 s|<a href=\"doc.html\">|<a class=\"here\" href=\"doc.html\">|
293 /#content/s/width: 750px;/width: 950px;/
294 /<div id=\"menu\">/,/<.div>/d
295 s|background-image: url('images/line.png'); background-repeat:repeat-y;||
296 " > "$n".$$
297 mv "$n".$$ "$n"
298
299
300 sed "/<!-- docline-top-->/a \
301 <div id=\"docline-top\">\
302 <a href=\"$prev\">&lt; PREV</a>\
303 <a href=\"doc.html\">UP</a>\
304 <a href=\"$next\">NEXT &gt;</a>\
305 </div>" "$n" | sed "/<div id=.footer.>/a \
306 <div id=\"docline-bottom\">\
307 <a href=\"$prev\">&lt; PREV</a>\
308 <a href=\"doc.html\">UP</a>\
309 <a href=\"$next\">NEXT &gt;</a>\
310 </div>" > "$n".$$
311 mv "$n".$$ "$n"
312
313
314
315 #############################################################################
316 # #
317 # contents list for doc.html #
318 # #
319 #############################################################################
320 sed -n '/<[Hh][23]/p' "$n" | sed "1d
321 /<[Hh][0-9]>Clonezilla-SysRescCD<\/[Hh][0-9]>/d
322 s|<[sS][pP][aA][nN].*</[sS][pP][aA][nN]>||
323 s|\[.*\]||
324 s|<[hH][13]>\([^<]\)|<a href=\"$n\">\1|
325 s|<[hH]2[^>]*>|\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;|
326 s|<[hH]3[^>]*>|\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;\&nbsp;|
327 s|</[aA]>||
328 s|<[aA] [nN][aA][mM][eE]=\"|<a href=\"$n#|
329 s|</[Hh][0-9]>|</a>|
330 s| [-]*[>]*</a>|</a>|
331 s|</a>|</a><br>|
332 s|Documentation: ||
333 ">> list
334
335
336
337 echo 'done'
338 ((count++))
339 done
340
341
342
343 echo '</p>' >> list
344 sed '/Identifying devices in Linux/i \
345 </p> \
346 <H2 >Annex</H2> \
347 <p>' list >list.$$ && mv list.$$ list
348
349 sed '/<div id="content">/ r list' < template.html |sed 's|class=\"here\" ||
350 s|<a href=\"doc.html\">|<a class=\"here\" href=\"doc.html\">|
351 s|\"myTitle\"|Documentation|g'> doc.html
352
353 rm *~ list template.html 2>/dev/null
354
355
356
357 #############################################################################
358 # #
359 # Creating onepage.html #
360 # #
361 #############################################################################
362
363 echo "Creating onepage.html"
364
365
366
367 sed '1,/<div id="menu">/!d
368 /<div id="menu">/d
369 s|<!--.*-->||g
370 s/margin-top: 0;/margin-top: 0; font-size: 2em;/
371 /^$/d' < index.html | sed '$d' > onepage.html
372
373
374 rm onepage-tmp.html 2>/dev/null
375 # exit
376 #for n in doc.html $theFiles
377 for n in $theFiles screenshots.html help.html
378 do
379 echo -n " $n... "
380 title=`sed '/<[tT][iI][tT][lL][eE]>/!d
381 s|<[^>]*>||g
382 s|Documentation: ||
383 s|Clonezilla-SysRescCD - ||' "$n"`
384
385 sed '1,/<div id="content">/d
386 /<div id="menu">/,$d
387 /<div id="footer">/,$d' "$n" | sed "s|</[aA]>Intro|</a>$title|
388 /<H2 style=\"margin-top: 0;\">/s|margin-top: 0;|font-size: 2em;|
389 s|<!--.*-->||g
390 /^$/d" | sed '$d' >> onepage-tmp.html
391 echo 'done'
392 done
393
394 cat onepage-tmp.html >> onepage.html
395 echo '</div>' >> onepage.html
396 sed '/<div id="menu">/,$!d' index.html |sed '/<div id="menu">/,/<.div>/d' >> onepage.html
397
398 sed '/#content/s/width: 750px;/width: 950px;/
399 s|background-image: url('images/line.png'); background-repeat:repeat-y;||g
400 s|images/line.png||g' onepage.html > o && mv o onepage.html
401
402 rm onepage-tmp.html 2>/dev/null
403

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26