#!/bin/bash ############################################################################## # # # 2site, (C) 2007-2010 S. Georgaras # # # # This file is part of Clonezilla-SysRescCD. # # # # Clonezilla-SysRescCD is free software: you can redistribute it and/or # # modify it under the terms of the GNU General Public License as published # # by the Free Software Foundation, either version 2 of the License, or # # (at your option) any later version. # # # # Clonezilla-SysRescCD is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License along # # with Clonezilla-SysRescCD. If not, see . # # # ############################################################################## pushd "$PWD" ############################################################################## # Configuration section # # Set whereIsTheISO to the location of current Clonezilla-SysRescCD ISO file # Set whereIsTheTarBall to the location of current Clonezilla-SysRescCD TGZ file whereIsTheISO=/e/clonezilla-sysresccd-"$myVersion" ############################################################################## # Script starts here # ############################################################################## noDoc=1 while getopts "d:n" Option do case $Option in d) thisDate="$OPTARG" ;; n) unset noDoc;; esac done ./pack-them # Go to www/ directory cd .. cd .. echo 'Creating files' echo -n " template.html... " myDate=`sed -n '1p' working/release-data ` myVersion=`sed -n '2p' working/release-data ` if [ -z "$thisDate" ];then thisDate=`date '+%d/%m/%Y'` fi whereIsTheISO="$whereIsTheISO""$myVersion" whereIsTheTarBall="$whereIsTheISO"/create-clonezilla-sysresccd-"$myVersion".tar.gz ISO_I686_SIZE=`du -h "$whereIsTheISO"/clonezilla-sysresccd-i686-"$myVersion"/clonezilla-sysresccd-i686-"$myVersion".iso | sed 's|[ \t].*||'` ISO_I686_MD5=`cat "$whereIsTheISO"/clonezilla-sysresccd-i686-"$myVersion"/md5sum.txt | sed 's|[ \t].*||'` ISO_AMD64_SIZE=`du -h "$whereIsTheISO"/clonezilla-sysresccd-amd64-"$myVersion"/clonezilla-sysresccd-amd64-"$myVersion".iso | sed 's|[ \t].*||'` ISO_AMD64_MD5=`cat "$whereIsTheISO"/clonezilla-sysresccd-amd64-"$myVersion"/md5sum.txt | sed 's|[ \t].*||'` ISO_I486_SIZE=`du -h "$whereIsTheISO"/clonezilla-sysresccd-i486-"$myVersion"/clonezilla-sysresccd-i486-"$myVersion".iso | sed 's|[ \t].*||'` ISO_I486_MD5=`cat "$whereIsTheISO"/clonezilla-sysresccd-i486-"$myVersion"/md5sum.txt | sed 's|[ \t].*||'` tarballSize=$(du -h "$whereIsTheTarBall" | sed "s|/.*||" |sed 's|\([kMG]\).*| \1|') isoSizeEN=$(echo "$isoSize" | sed 's|,|.|') # isoSizeGR=$(echo "$isoSize" | sed 's|\.|,|') tarballSizeEN=$(echo "$tarballSize" | sed 's|,|.|') # tarballSizeGR=$(echo "$tarballSize" | sed 's|\.|,|') ############################################################################# # # Copy RSS feed to trunk. No manipulation!!! # ############################################################################# cd working cp clonezilla-sysresccd.rss .. cd .. ############################################################################# # # Create template.html # ############################################################################# tr -d '\n' < working/clonezilla-sysresccd.rss | sed 's|<[tT][iI][tT][lL][eE]>|\n|g' | sed 's|</[pP][uU][bB][Dd][aA][tT][eE]>|</pubDate>\n|g' | grep '<title>' > /tmp/iaa.$$ rm /tmp/aai.$$ 2>/dev/null while read line;do 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| s|Feb|02| s|Mar|03| s|Apr|04| s|May|05| s|Jun|06| s|Jul|07| s|Aug|08| s|Sep|09| s|Oct|10| s|Nov|11| s|Dec|12| ')" tit="$(echo "$line" | sed 's|</[Tt][iI][tT][lL][eE]>.*||' | sed 's|<title>||')" echo "$dt - $tit" | grep '^[0-9]' >> /tmp/aai.$$ done < /tmp/iaa.$$ rm /tmp/iaa.$$ 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|$| \\|')" rm /tmp/aai.$$ sed "/<H1[^>]*>What's New<.H1>/a \ $l " working/.template.html | sed "s|\"myDate\"|$myDate|" | sed "s|\"myVersion\"|$myVersion|g" | sed "s|Last update: [^<]*<|Last update: $thisDate<|" > template.html echo 'done' ############################################################################# # # # Create news.php # # # ############################################################################# echo -n ' news.php... ' sed -n '1,/<div id="content">/p' template.html > 1.$$ cat working/.news.php >> 1.$$ sed '1,/<div id="content">/d' template.html | sed '/<div id="menu">/,/<.div>/d' >> 1.$$ sed '/#content/s/width: 750px;/width: 950px/' 1.$$ | sed "s|background-image: url('images/line.png'); background-repeat:repeat-y;|| s|class=\"here\" || s|<a href=\"news.php\">|<a class=\"here\" href=\"news.php\">| s|\"myTitle\"|What's New| /<div id=\"header\">/a \ <a name=\"news-top\"></a>" > news.php echo 'done' ############################################################################# # # # Create 404.html # # # ############################################################################# echo -n ' 404.html... ' sed -n '1,/<div id="content">/p' template.html > 1.$$ sed '1,/<div id="content">/d' template.html | sed '/<div id="menu">/,/<.div>/d' >> 1.$$ sed '/#content/s/width: 750px;/width: 950px/' 1.$$ | sed "s|background-image: url('images/line.png'); background-repeat:repeat-y;|| s|class=\"here\" || s|\"myTitle\"|Error| s|#content { float: left;|#content { | " > xxx.html rm 1.$$ sed -n '1,/<.[hH][eE][aA][dD]>/p' xxx.html | sed '$d' > p1.$$ sed -n '1,/<!--seperator-->/p' working/.404.html >> p1.$$ sed -n '/<.[hH][eE][aA][dD]>/,$p' xxx.html >> p1.$$ mv p1.$$ xxx.html sed -n '1,/<[dD][iI][vV] [iI][dD]="content">/p' xxx.html> p1.$$ sed '1,/<!--seperator-->/d' working/.404.html >> p1.$$ sed -n '/<[dD][iI][vV] [iI][dD]="content">/,$p' xxx.html | sed '1d' >> p1.$$ sed '/<!--seperator-->/d' p1.$$ | sed "s|myVersion|"$myVersion"|g" > 404.html rm *.$$ xxx.html echo 'done' ############################################################################# # # # Create files (main menu) # # # ############################################################################# # for n in index.html features.html doc.html download.html screenshots.html credits.html links.html;do echo 'Creating menu files' # for n in index.html screenshots.html help.html doc.html;do for n in working/*.html;do # for n in working/boot-params.html;do echo -n " ${n/working\//}... " myTitle=`sed -n '/<[hH]3>/p' "$n" | sed ' 2,$d s/<[^<]*<[bB][rR] *\/*>\([^<]*\)<[bB][rR].*/\1/ s|<\/*[hH]3>||g'` # fix first H2 sed ' s|<[hH]2[^>]*>|<H2>|g 0,/<[hH]2[^>]*><[aA] [nN][aA][mM][eE]/s//<H2 style="margin-top: 0;"><a name/ 1,/<div id="content">/d /<div id="footer">/,$d /<div id="menu">/,$d $d' "$n" > "$n".$$ # # echo "myTitle = $myTitle" # X=`sed '1,/<[bB][oO][dD][yY]/d' "$n".$$ | sed '/<.[bB][oO][dD][yY]>/,$d'` # X=`echo "$X" | sed 's|$| \\\\|'` # sed "/<div id=\"content\">/a \ # $X # " template.html > tpm.$$ sed "/<div id=\"content\">/ r "$n".$$" template.html > tpm.$$ fonly="$n" fonly="${fonly/working\//}" sed '/<!--txt-only-->/!b :a /<!--end-txt-only-->/!{ N ba } s/<!--txt-only-->.*<!--end-txt-only-->//' tpm.$$ | sed 's| $||' | sed "s|\"myTitle\"|$myTitle| s|\"myVersion\"|$myVersion|g s|TARBALL_SIZE|$tarballSizeEN|g s{ISO_I686_SIZE{$ISO_I686_SIZE{g s{ISO_I686_MD5{$ISO_I686_MD5{g s{ISO_I486_SIZE{$ISO_I486_SIZE{g s{ISO_I486_MD5{$ISO_I486_MD5{g s{ISO_AMD64_SIZE{$ISO_AMD64_SIZE{g s{ISO_AMD64_MD5{$ISO_AMD64_MD5{g /<[hH]1>.*<[bB][rR]/d s|class=\"here\" || s|<a href=\"$fonly\">|<a class=\"here\" href=\"$fonly\">| s|</div><div id=\"menu\">|<div id=\"menu\">|" > "${n/working\//}" rm tpm.$$ "$n".$$ echo 'done' done ############################################################################# # # # Fix doc.html - Documentation menu # # # ############################################################################# # num=`grep -n '<div id="linkline">' doc.html | sed 's|:.*||'` # # ' # s|class=\"here\" || # s|<a href=\"$n\">|<a class=\"here\" href=\"$n\">|' doc.html > doc.html.$$ # mv doc.html.$$ doc.html echo '<H2 style="margin-top: 0;">Contents</H2> <p>' >list echo 'Fixing documentation files' count=0 # for n in project.html \ # custom-cd.html \ # usb.html \ # boot-params.html \ # clonezilla.html \ # backup.html \ # backup-smb.html \ # restoration.html \ # restore.html \ # restore-burn.html \ # reloc-img.html \ # supergrubdisk.html \ # oldboot.html \ # sysresccd.html \ # partitions.html \ # recover.html \ # own-scripts.html \ # annex-a-devices.html theFiles="usb.html boot-params.html clonezilla.html backup.html backup-smb.html restoration.html restore.html restore-burn.html reloc-img.html supergrubdisk.html oldboot.html sysresccd.html partitions.html recover.html own-scripts.html annex-a-devices.html basic-vi.html" for n in $theFiles do html[count]="$n" ((count++)) done count=0 while [ -n "${html[$count]}" ] do if [ $count -eq 0 ];then unset prev else prev="${html[$((count-1))]}" fi n="${html[$count]}" next="${html[$((count+1))]}" # # for n in boot-params.html # do echo -n " $n... " sed 's| $||' "$n" | sed " /<[hH]1>.*<[bB][rR]/d s|class=\"here\" || s|<a href=\"doc.html\">|<a class=\"here\" href=\"doc.html\">| /#content/s/width: 750px;/width: 950px;/ /<div id=\"menu\">/,/<.div>/d s|background-image: url('images/line.png'); background-repeat:repeat-y;|| " > "$n".$$ mv "$n".$$ "$n" sed "/<!-- docline-top-->/a \ <div id=\"docline-top\">\ <a href=\"$prev\">< PREV</a>\ <a href=\"doc.html\">UP</a>\ <a href=\"$next\">NEXT ></a>\ </div>" "$n" | sed "/<div id=.footer.>/a \ <div id=\"docline-bottom\">\ <a href=\"$prev\">< PREV</a>\ <a href=\"doc.html\">UP</a>\ <a href=\"$next\">NEXT ></a>\ </div>" > "$n".$$ mv "$n".$$ "$n" ############################################################################# # # # contents list for doc.html # # # ############################################################################# sed -n '/<[Hh][23]/p' "$n" | sed "1d /<[Hh][0-9]>Clonezilla-SysRescCD<\/[Hh][0-9]>/d s|<[sS][pP][aA][nN].*</[sS][pP][aA][nN]>|| s|\[.*\]|| s|<[hH][13]>\([^<]\)|<a href=\"$n\">\1| s|<[hH]2[^>]*>|\ \ \ \ \ \ | s|<[hH]3[^>]*>|\ \ \ \ \ \ \ \ \ \ \ \ | s|</[aA]>|| s|<[aA] [nN][aA][mM][eE]=\"|<a href=\"$n#| s|</[Hh][0-9]>|</a>| s| [-]*[>]*</a>|</a>| s|</a>|</a><br>| s|Documentation: || ">> list echo 'done' ((count++)) done echo '</p>' >> list sed '/Identifying devices in Linux/i \ </p> \ <H2 >Annex</H2> \ <p>' list >list.$$ && mv list.$$ list sed '/<div id="content">/ r list' < template.html |sed 's|class=\"here\" || s|<a href=\"doc.html\">|<a class=\"here\" href=\"doc.html\">| s|\"myTitle\"|Documentation|g'> doc.html rm *~ list template.html 2>/dev/null ############################################################################# # # # Creating onepage.html # # # ############################################################################# echo "Creating onepage.html" sed '1,/<div id="menu">/!d /<div id="menu">/d s|<!--.*-->||g s/margin-top: 0;/margin-top: 0; font-size: 2em;/ /^$/d' < index.html | sed '$d' > onepage.html rm onepage-tmp.html 2>/dev/null # exit #for n in doc.html $theFiles for n in $theFiles screenshots.html help.html do echo -n " $n... " title=`sed '/<[tT][iI][tT][lL][eE]>/!d s|<[^>]*>||g s|Documentation: || s|Clonezilla-SysRescCD - ||' "$n"` sed '1,/<div id="content">/d /<div id="menu">/,$d /<div id="footer">/,$d' "$n" | sed "s|</[aA]>Intro|</a>$title| /<H2 style=\"margin-top: 0;\">/s|margin-top: 0;|font-size: 2em;| s|<!--.*-->||g /^$/d" | sed '$d' >> onepage-tmp.html echo 'done' done cat onepage-tmp.html >> onepage.html echo '</div>' >> onepage.html sed '/<div id="menu">/,$!d' index.html |sed '/<div id="menu">/,/<.div>/d' >> onepage.html sed '/#content/s/width: 750px;/width: 950px;/ s|background-image: url('images/line.png'); background-repeat:repeat-y;||g s|images/line.png||g' onepage.html > o && mv o onepage.html rm onepage-tmp.html 2>/dev/null ############################################################################# # # # Fix download.html warning versions # # # ############################################################################# 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'` CLONEZILLA_VERSION=`echo "$verLineIndex" | sed 's|.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-[0-9][0-9]*\).*|\1|'` verLineIndex=`echo "$verLineIndex" | sed "s|.*$CLONEZILLA_VERSION||"` SYSRESCCD_VERSION=`echo "$verLineIndex" | sed 's|.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|'` sed " s/CLONEZILLA_VERSION/$CLONEZILLA_VERSION/ s/SYSRESCCD_VERSION/$SYSRESCCD_VERSION/ " download.html > download.html.$$ && mv download.html.$$ download.html popd if [ -z "$noDoc" ];then ./html2doc ./html2txt else echo echo " **** NOT HANDLING DOCS ****" fi