/[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 42 - (show annotations)
Tue May 18 14:22:00 2010 UTC (11 years, 6 months ago) by sng
File size: 12137 byte(s)
- Moving the scripts used to create the documentation
under their own directory (trunk/www/working/scripts)
- Deleting onepage.php (replaced by onepage.html)

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

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26