www.pudn.com > sswf-1.7.4-src.zip > sendweb
#!/bin/sh # # Script to send the data to the SourceForge and other websites. # Written by Alexis Wilke for Made to Order Software, Ltd. (c) 2002-2006 # # Copyright (c) 2002-2006 Made to Order Software, Ltd. # # Permission is hereby granted, free of charge, to any # person obtaining a copy of this software and # associated documentation files (the "Software"), to # deal in the Software without restriction, including # without limitation the rights to use, copy, modify, # merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom # the Software is furnished to do so, subject to the # following conditions: # # The above copyright notice and this permission notice # shall be included in all copies or substantial # portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF # ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO # EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # set -e ERR=0 VERSION=`grep "\\" include/sswf/libsswf-version.h | sed -e 's/.*\\([0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\).*/\\1/'` LOCAL_OUTPUT=/usr/clients/www/sswf.m2osw.com/public_html BACKUP=tmp/backup TMPHTML=tmp/temporary.html DOWNLOAD=tmp/download.html PACKAGES=/var/ftp/pub/sswf/current DST=tmp/web-page HELP=false SF=false REBUILD=true while test "x$1" != "x" do case "$1" in -h|--help) HELP=true; shift;; -sf|--sf) SF=true; shift;; -no-rebuild) REBUILD=false; shift;; *) HELP=true; echo "ERROR: unknown option $1"; shift;; esac done if $HELP then echo echo " Usage: $0 [-opt]" echo echo "Where -opt is one or more of the following:" echo echo " -h or --help print out this help screen" echo " -sf also publish the web site on SourceForge" echo " -no-rebuild do not rebuild the SWF movies" echo exit 1; fi # I now get the current release number dynamically; much easier! # and somehow always up to date... SF_PROJECT_GROUP=63702 PROJFILES=tmp/projfiles.xml rm -f $PROJFILES wget --quiet --output-document=$PROJFILES http://sourceforge.net/export/rss2_projfiles.php?group_id=$SF_PROJECT_GROUP SF_PROJECT_RELEASE=`grep 'release_id=' $PROJFILES \ | sed -e 's/.*release_id=\([0-9]\+\).*/\1/' | sort -rn | head -n 1` # we keep a copy of the documentation files so # we don't have to transfer them each time in # case it didn't change mkdir -p $BACKUP/doc/html/{images,tutorial/output} mkdir -p $BACKUP/dev/web-page/swf mkdir -p $DST/{images,swf,tutorial/output} echo "***" echo "*** Updating the SSWF $VERSION web site (Release $SF_PROJECT_RELEASE)" echo "***" ############################################################ # # COPY THE HTML & IMAGES OF THE DOCUMENTATION # # This includes the manual pages as well as the SSWF HTML docs. # and images coming with it. # ############################################################ echo " HTML, tutorial and images from doc/html" for file in `find doc/html -type f` do if ! cmp -s $file $BACKUP/$file then f=`echo $file | sed -e 'sXdoc/html/XX'` e=`echo $file | sed -e 'sX.*\.\([a-zA-Z0-9]\)X\1X'` if test "$e" = "swp" then # Skip gvim swap files continue; fi echo "Copying file: $f..." if test "$e" = "html" then # Setup the date in HTML docs d=`date -r $file +"%b %d %Y"` sed -e "s/ /$d/" -e "s/<\/DATE>//" \ -e "s/ /$VERSION/" -e "s/<\/VERSION>//" \ -e 'sX"../../index.htm"X"http://www.daylongraphics.com/other/sswf/"X' \ $file >$TMPHTML cp -f $TMPHTML $LOCAL_OUTPUT/$f cp -f $TMPHTML $DST/$f else cp -f $file $LOCAL_OUTPUT/$f cp -f $file $DST/$f fi cp -f $file $BACKUP/$file fi done ############################################################ # # SSWF SAMPLES IN HTML # # This part generates a web page for each SSWF sample and # then it copies the results to the website. # ############################################################ echo " Creating HTML of each SSWF sample & its animation file" # prepare an HTML file from our SSWF scripts create_html() { name=$1 subdir=$2 params=$3 swf=samples/$subdir/$name.swf set `swf_dump -m $swf | sed -e 's/,//g'` version=$1 width=`expr $2 / 20` height=`expr $3 / 20` ( echo -n " $name.sswf Back to the SSWF project home page
Sample: $name.sswf
From: samples/$subdir
" sed -e 's/\&/\&/g' -e 's/\</g' -e 's/>/\>/g' -e 's/"/\"/g' samples/$subdir/$name.sswf echo "This sample source was last modified on `date -r samples/$subdir/$name.sswf +"%b %d %Y"`
" ) >$TMPHTML f=$name.html if ! cmp -s $TMPHTML $BACKUP/dev/web-page/$f then echo "Copying file: $f..." cp -f $TMPHTML $LOCAL_OUTPUT/$f cp -f $TMPHTML $DST/$f cp -f $TMPHTML $BACKUP/dev/web-page/$f fi if test ! -f $swf then echo "ERROR: can't create Flash animation file \"$swf\"" ERR=1 else f=`basename $swf` if ! cmp -s $swf $BACKUP/dev/web-page/swf/$f then echo "Copying file: $f..." cp -f $swf $LOCAL_OUTPUT/swf/$f cp -f $swf $DST/swf/$f cp -f $swf $BACKUP/dev/web-page/swf/$f fi fi } # Make sure all the .swf files exist if $REBUILD then amake -s samples fi create_html anim web-site-anim create_html new new-anim create_html morph morph create_html sun_flower sun-flower create_html button dyn-button "?bgcolor=#AACCEE&label=Download%20%3Cb%3ESSWF%3C/b%3E%3Cbr%3E%3Ci%3ENow!&url=http://sourceforge.net/project/showfiles.php?group_id=$SF_PROJECT_GROUP%26release_id=$SF_PROJECT_RELEASE" create_html scroller scroller "?msg=Version%20on%20which%20I'm%20working%20as%20this%20page%20is%20updated%20on%20SourceForge:%20$VERSION&limit=2000&speed=2" # we need to set the date only... temperature is a special case! echo " Working on the SSWF web site" file=dev/web-page/temperature.html f=temperature.html if ! cmp -s $file $BACKUP/$file; then d=`date -r $file +"%b %d %Y"` sed -e "s//$d/" $file >$TMPHTML echo "Copying file: $f..." cp -f $TMPHTML $LOCAL_OUTPUT/$f cp -f $TMPHTML $DST/$f cp -f $file $BACKUP/$file fi ############################################################ # # SSWF SAMPLES IN HTML # # This part generates a web page for each SSWF sample and # then it copies the results to the website. # ############################################################ # now we want to add the NOTES and CHANGES on the web too # 1st make sure the .html are up to date echo " Generate current HTML notes and changes pages" amake tmp/NOTES.html tmp/CHANGES.html | grep -v "is up to date" || true for file in tmp/NOTES.html tmp/CHANGES.html do ( echo " $f " echo "Back to the SSWF project home page
" cat $file echo "Back to the SSWF project home page
" echo "" ) >$TMPHTML f=`basename $file` if ! cmp -s $TMPHTML $BACKUP/dev/web-page/$f; then echo "Copying file: $f..." cp -f $TMPHTML $LOCAL_OUTPUT/$f cp -f $TMPHTML $DST/$f cp -f $TMPHTML $BACKUP/dev/web-page/$f fi done echo "" >tmp/download-source.html echo " Source Code " >tmp/download-doc.html echo " Documentation " >tmp/download-linux.html echo " Linux Packages " >tmp/download-debian.html echo " Debian Packages " >tmp/download-slackware.html echo " Slackware Packages " >tmp/download-linuxonpower.html echo " Linux on Power Packages " >tmp/download-irix.html echo " SGI Packages " >tmp/download-macosx.html echo " Mac OS/X Packages " >tmp/download-mingw.html echo " MinGW Packages " >tmp/download-win32.html for file in $PACKAGES/* do case "$file" in *-src.* | *-dev.*) OUTPUT=tmp/download-source.html ;; *-doc.*) OUTPUT=tmp/download-doc.html ;; *.linuxonpower.*) OUTPUT=tmp/download-linuxonpower.html ;; *-linux-* | *.rpm) OUTPUT=tmp/download-linux.html ;; *i?86.deb) OUTPUT=tmp/download-debian.html ;; *will*) OUTPUT=tmp/download-slackware.html ;; *-irix-*) OUTPUT=tmp/download-irix.html ;; *darwin* | *.info) OUTPUT=tmp/download-macosx.html ;; *-mingw*) OUTPUT=tmp/download-mingw.html ;; *-win32-*) OUTPUT=tmp/download-win32.html ;; */md5.txt) # We skip this one if it exists continue ;; *) echo "ERROR: don't know in which set of packages to put \"$file\"." exit 1; ;; esac f=`basename $file` ( echo " MS-Windows Packages " echo " " ) >>$OUTPUT done # create the list of files which can be downloaded ( echo "" echo " " echo "$f" echo "" echo " sf.net" echo " " echo "" echo " `stat -c \"%s\" $file`" echo " " echo "" echo " " echo "`md5sum -b $file | sed -e 's/ .*//'`" echo "" echo "
" echo " " echo " " echo "
" echo "" echo " " cat tmp/download-source.html cat tmp/download-doc.html cat tmp/download-linux.html cat tmp/download-debian.html cat tmp/download-slackware.html cat tmp/download-linuxonpower.html cat tmp/download-irix.html cat tmp/download-macosx.html cat tmp/download-mingw.html cat tmp/download-win32.html echo " " echo "" echo " Filename" echo " " echo "" echo " SF" echo " " echo "" echo " Size" echo " " echo "" echo " MD5*" echo " " echo "" echo " " echo "
" echo " * " echo " To generate an MD5 number, use the command: md5sum -b
" echo " You can then compare the result by hand between the sum we present here and the result you get.
" echo " You can also download the md5.txt file.
" echo " With it, you can run the MD5 check as in:md5sum -c md5.txt.
" echo " MD5 generates a warning if a file doesn't exists (a file you didn't download).
" echo " However, an error is generated when a file is invalid.
" echo " For the other files you will get the message \"OK\"." echo "
" ) >$DOWNLOAD # we need to set the date & release & version here echo " Creating the different Indexes" file=dev/web-page/index.html f=index.html if ! (cmp -s $file $BACKUP/$file && cmp -s $DOWNLOAD $BACKUP/`basename $DOWNLOAD` && test -f tmp/backup/dev/web-page/done$VERSION.html) then d=`date -r $file +"%b %d %Y"` sed -e "s//$d/" -e "s/ /$SF_PROJECT_RELEASE/" \ -e "s/ /$VERSION/" -e "/ / r $DOWNLOAD" \ -e "s/ //" $file >$TMPHTML echo "Copying file: $f..." cp -f $TMPHTML $LOCAL_OUTPUT/$f cp -f $TMPHTML $DST/$f cp -f $file $BACKUP/$file cp -f $DOWNLOAD $BACKUP/`basename $DOWNLOAD` touch tmp/backup/dev/web-page/done$VERSION.html fi ################################################## # # Now try to send the pages which changed to # the SourceForge web server. # ################################################## if $SF then cd tmp/web-page tar cjf ../web-page.tar.bz2 . cd .. if scp web-page.tar.bz2 alexis_wilke@sswf.sourceforge.net:/home/groups/s/ss/sswf/htdocs/web-page.tar.bz2 \ && ssh alexis_wilke@sswf.sourceforge.net "cd /home/groups/s/ss/sswf/htdocs/; tar -mxjf web-page.tar.bz2; rm -rf web-page.tar.bz2"; then # by removing the directory we signal that the transfer worked rm -rf web-page fi else echo "WARNING: the web page was not downloaded to the SourceForge web-site. Use -sf to this effect" fi rm -rf $TMPHTML $DOWNLOAD tmp/download-*.html exit $ERR