/[clonezilla-sysresccd]/trunk/www/working/scripts/update-boot-params
ViewVC logotype

Diff of /trunk/www/working/scripts/update-boot-params

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 42 by sng, Tue May 18 14:22:00 2010 UTC revision 44 by sng, Wed May 19 11:49:25 2010 UTC
# Line 95  s{<h[23]>{<p><b><br>{g Line 95  s{<h[23]>{<p><b><br>{g
95  s{<\/h[23]>{</b></p>{g  s{<\/h[23]>{</b></p>{g
96  1s{<p><b><br>{<p><b>{  1s{<p><b><br>{<p><b>{
97  s{href="/{href="http://www.sysresccd.org/{g  s{href="/{href="http://www.sysresccd.org/{g
98    s{<span[^>]*>{{
99    s{<.span>{{
100  '  '
101    
102  # Configuration for kernels documentation section  # Configuration for kernels documentation section
# Line 102  name[1]=kernels Line 104  name[1]=kernels
104  webPage[1]=''  webPage[1]=''
105  startTAG[1]='Default for 32bit systems,'  startTAG[1]='Default for 32bit systems,'
106  endTAG[1]='an alternative kernel for 64bit systems.'  endTAG[1]='an alternative kernel for 64bit systems.'
107  sectionPrepend[1]='<ul class="otherpage" style="padding: 0px 10px 20px 40px">'  sectionPrepend[1]=''
108  sectionAppend[1]='</li></ul>'  sectionAppend[1]='</li>'
109  tokenStart[1]='<!--kernels-Documentation-->'  tokenStart[1]='<!--kernels-Documentation-->'
110  tokenEnd[1]='</ul>'  tokenEnd[1]='</ul>'
111  sedScript[1]='  sedScript[1]='
112  s{^<ul>{{  s{^<ul>{{
113    s{^</ul>{{
114  '  '
115    
116  # Configuration for initramfs documentation section  # Configuration for initramfs documentation section
# Line 115  name[2]=initramfs Line 118  name[2]=initramfs
118  webPage[2]='http://clonezilla.org/clonezilla-live/live-initramfs.en.7.txt'  webPage[2]='http://clonezilla.org/clonezilla-live/live-initramfs.en.7.txt'
119  startTAG[2]=''  startTAG[2]=''
120  endTAG[2]=''  endTAG[2]=''
121  sectionPrepend[2]='<a name="live-initramfs"></a><div class="otherpage"><pre>'  sectionPrepend[2]='<a name="live-initramfs"></a><div class="otherpage" style="overflow: auto;"><pre>'
122  sectionAppend[2]=''  sectionAppend[2]=''
123  tokenStart[2]='<!--initramfs-Documentation-->'  tokenStart[2]='<!--initramfs-Documentation-->'
124  tokenEnd[2]='</pre>'  tokenEnd[2]='</pre>'
# Line 159  s{You can refer to this <a [^>]*>\([^>]* Line 162  s{You can refer to this <a [^>]*>\([^>]*
162  #   funtion to make all happen  #   funtion to make all happen
163  #  #
164  function updateContent(){  function updateContent(){
 #set -x  
165  echo "Updating ${name[$1]} documentation"  echo "Updating ${name[$1]} documentation"
166  rm /tmp/webPage.$$ 2>/dev/null  # Fix varaibles for sed (sed syntax)
167  tokenEndReplace=`echo "${tokenEnd[$1]}" | sed 's|/|\\/|'`  tokenEndReplace=`echo "${tokenEnd[$1]}" | sed 's|/|\\/|'`
168  tokenEnd=`echo "${tokenEnd[$1]}" | sed 's|/|\.|'`  tokenEnd=`echo "${tokenEnd[$1]}" | sed 's|/|\.|'`
169    
170    # Download original web page/file
171  if [ -n "${webPage[$1]}" ];then  if [ -n "${webPage[$1]}" ];then
172    downloadFile $1    downloadFile $1
173  else  else
# Line 172  else Line 176  else
176          fi          fi
177  fi  fi
178    
 echo aaaaaaa  
 read  
   
 set -x  
179  echo -n "  Adding web content to file...   "  echo -n "  Adding web content to file...   "
180    # Extract and format content from original page
181    # if startTAG[$1] is empty, just copy the page
182    # new content file: /tmp/tmp.$$
183  if [ -n "${startTAG[$1]}" ];then  if [ -n "${startTAG[$1]}" ];then
184    sed -n "/${startTAG[$1]}/ , /${endTAG[$1]}/ p" /tmp/webPage.$$  > /tmp/tmp.$$    sed -n "/${startTAG[$1]}/ , /${endTAG[$1]}/ p" /tmp/webPage.$$  | sed '
185            s{/[tT][aA][rR][gG][eE][tT]="[^"]"{{g
186  #        s{[aA] [hH][rR][eE][fF]={a target="_blank" href={g
187  #       | sed '  s{/[tT][aA][rR][gG][eE][tT]="[^"]"{{g
188  # s{/[tT][aA][rR][gG][eE][tT]="[^"]"{{g  s{target=_blank{{g
189  # s{[aA] [hH][rR][eE][fF]={a target="_blank" href={g  s{[aA] [hH][rR][eE][fF]={a target="_blank" href={g
190  # s{/[tT][aA][rR][gG][eE][tT]="[^"]"{{g  ' > /tmp/tmp.$$
 # s{target=_blank{{g  
 # s{[aA] [hH][rR][eE][fF]={a target="_blank" href={g  
 # ' > /tmp/tmp.$$  
191  else  else
192    cp /tmp/webPage.$$ /tmp/tmp.$$    cp /tmp/webPage.$$ /tmp/tmp.$$
193  fi  fi
194    
195    # Apply page specific sed script to new content
 echo bbbbbbb  
 read  
   
   
   
196  if [ -n "${sedScript[$1]}" ];then  if [ -n "${sedScript[$1]}" ];then
197          echo "${sedScript[$1]}" > /tmp/sedScript.$$          echo "${sedScript[$1]}" > /tmp/sedScript.$$
198    sed -f /tmp/sedScript.$$ /tmp/tmp.$$ > /tmp/tmp-new.$$ && mv /tmp/tmp-new.$$ /tmp/tmp.$$    sed -f /tmp/sedScript.$$ /tmp/tmp.$$ > /tmp/tmp-new.$$ && mv /tmp/tmp-new.$$ /tmp/tmp.$$
199          rm /tmp/sedScript.$$          rm /tmp/sedScript.$$
200  fi  fi
201    
202    # Apply prepend text to new content
203  if [ -n "${sectionPrepend[$1]}" ];then  if [ -n "${sectionPrepend[$1]}" ];then
204    echo "${sectionPrepend[$1]}" > /tmp/tmp-new.$$    echo "${sectionPrepend[$1]}" > /tmp/tmp-new.$$
205          cat /tmp/tmp.$$ >> /tmp/tmp-new.$$          cat /tmp/tmp.$$ >> /tmp/tmp-new.$$
206          mv /tmp/tmp-new.$$ /tmp/tmp.$$          mv /tmp/tmp-new.$$ /tmp/tmp.$$
207  fi  fi
208    
209    # Applly append text to new content
210  if [ -n "${sectionAppend[$1]}" ];then  if [ -n "${sectionAppend[$1]}" ];then
211    echo "${sectionAppend[$1]}" >> /tmp/tmp.$$    echo "${sectionAppend[$1]}" >> /tmp/tmp.$$
212  fi  fi
213    
214    
215    # remove old content form current page
216  sed "/${tokenStart[$1]}/!b  sed "/${tokenStart[$1]}/!b
217  :a  :a
218  /"${tokenEnd}"/!{  /"${tokenEnd}"/!{
# Line 219  sed "/${tokenStart[$1]}/!b Line 220  sed "/${tokenStart[$1]}/!b
220          ba          ba
221  }  }
222  s[${tokenStart[$1]}.*${tokenEnd}[${tokenStart[$1]}\n${tokenEndReplace}[" boot-params.html > /tmp/page.$$    s[${tokenStart[$1]}.*${tokenEnd}[${tokenStart[$1]}\n${tokenEndReplace}[" boot-params.html > /tmp/page.$$  
223  sed "/${tokenStart[$1]}/r /tmp/tmp.$$" < /tmp/page.$$ > boot-params.html  
224  read  # insert new content to current page
225    if [ -n "$createTamplatePage" ];then
226      cp /tmp/page.$$ boot-params.html
227    else
228      sed "/${tokenStart[$1]}/r /tmp/tmp.$$" < /tmp/page.$$ > boot-params.html
229    fi
230    
231    # clean up
232  rm /tmp/page.$$ /tmp/tmp.$$ /tmp/tmp-new.$$ 2>/dev/null  rm /tmp/page.$$ /tmp/tmp.$$ /tmp/tmp-new.$$ 2>/dev/null
233  echo 'done'  echo 'done'
 set +x  
234  }  }
235    
236    
# Line 231  set +x Line 238  set +x
238  #   funtion to download the original web page  #   funtion to download the original web page
239  #  #
240  function downloadFile(){  function downloadFile(){
 set -x  
241    echo -n "  Downloading web page...   "    echo -n "  Downloading web page...   "
242      rm /tmp/webPage.$$ 2>/dev/null
243    wget -q "${webPage[$1]}" -O /tmp/webPage.$$ && echo 'done' || {    wget -q "${webPage[$1]}" -O /tmp/webPage.$$ && echo 'done' || {
     
244    echo "    echo "
245    Error downloading original web page"    Error downloading original web page"
246    exit 1    exit 1
247    }    }
 set +x  
248  }  }
249    
250  ##############################################################################  ##############################################################################
# Line 263  updateContent 0 || { Line 268  updateContent 0 || {
268  updateContent 1 || {  updateContent 1 || {
269    cleanUp;exit 2    cleanUp;exit 2
270  }  }
271    
272  updateContent 2 || {  updateContent 2 || {
273    cleanUp;exit 3    cleanUp;exit 3
274  }  }

Legend:
Removed from v.42  
changed lines
  Added in v.44

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26