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