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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26