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

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26