On Oct 30, 2009, at 8:33 PM, mr.freeze wrote:

> This is useful.  Perhaps worth making a slice?
> http://www.web2pyslices.com/main/default/user/login?_next=/main/slices/make_slice

I can do that. Here's an improved version. It zips the old version  
instead of copying it, and has cleaner messaging.

#!/bin/bash
#
#  update-web2py.sh
#
#  save a snapshot of current web2py/ as web2py-version.zip
#  download the current released version of web2py
#  unzip downloaded version over web2py/
#  upgrade web2py default applications (admin, examples, welcome)
#
TARGET=web2py
read a VERSION c < $TARGET/VERSION
SAVE=$TARGET-$VERSION
URL=http://www.web2py.com/examples/static/web2py_src.zip

ZIP=`basename $URL`
SAVED=""

#  Save a zip archive of the current version,
#  but don't overwrite a previous save of the same version.
#
if [ -f $SAVE.zip ]; then
        echo "Remove or rename $SAVE.zip first" >&2
        exit 1
fi
if [ -d $TARGET ]; then
        echo -n ">>Save old version: " >&2
        cat $TARGET/VERSION >&2
        zip -q -r $SAVE.zip $TARGET
        SAVED=$SAVE.zip
fi
#
#  Download the new version.
#
echo ">>Download latest web2py release:" >&2
curl -O $URL
#
#  Unzip into web2py/
#
unzip -q -o $ZIP
rm $ZIP
echo -n ">>New version: " >&2
cat $TARGET/VERSION >&2
if [ "$SAVED" != "" ]; then
        echo ">>Old version saved as $SAVED"
fi
#
#  Update the web2py standard applications.
#  Comment out these lines if updating is not desired.
#
echo ">>Update web2py default applications:" >&2
python $TARGET/web2py.py --upgrade=yes


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to