/[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 44 - (show annotations)
Wed May 19 11:49:25 2010 UTC (11 years, 4 months ago) by sng
File size: 12485 byte(s)
Fixing scripts and 'template' html page

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

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26