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