#!/bin/sh SVNURI="http://helpim.tilanus.com/subversion/HelpIM3/" HTMLPATH="/usr/local/share/HelpIM" if [ $# -ne 0 ]; then cat << EOF This script updates the current installation of HelpIM from subversion at the uri: $SVNURI If HelpIM is not in the python-path, then this script will use the current directory. If in the current directory is no 'HelpIM' directory, a new one will be created. The html-resources will be copied to: $HTMLPATH If it doesn't exist, it will be created. EOF exit 0 fi SVN=`which svn` if [ -z $SVN ]; then echo "svn not found, please install the subversion client and make sure it is in your path" exit 1 fi LOCALPATH=`python -c "import HelpIM; print HelpIM.__file__.split('HelpIM/__init__.py')[0]"` if [ $? -eq 1 ]; then echo "No HelpIM found, placing it in current directory" LOCALPATH='.' else if [ -z $LOCALPATH ]; then echo "HelpIM found in current directory" LOCALPATH='.' else echo "Found HelpIM in $LOCALPATH" fi fi echo "Updating $HTMLPATH/htdocs" if [ ! -d "$HTMLPATH" ]; then mkdir "$HTMLPATH" if [ $? -ne 0 ]; then echo "Can't find or create $HTMLPATH, aborting" exit 1 fi fi RESULT=`$SVN export --force "$SVNURI/htdocs" "$HTMLPATH/htdocs"` if [ $? -ne 0 ]; then echo "Error while updating, aborting" exit 1 fi echo "Updating $LOCALPATH""HelpIM" RESULT=`$SVN export --force "$SVNURI/HelpIM" "$LOCALPATH""HelpIM"` if [ $? -ne 0 ]; then echo "Error while updating, aborting" exit 1 fi REVISION=`echo $RESULT | awk '{print $NF}' | sed "s/\.//g"` sed -i "s/^__version__ = \"\([0-9.]*\)\"$/__version__ = \"\1r$REVISION\"/" "$LOCALPATH""HelpIM/__init__.py" echo "Precompiling $LOCALPATH""HelpIM" python -c "import compileall; compileall.compile_dir('$LOCALPATH''HelpIM', force=True, quiet=True)" if [ $? -ne 0 ]; then echo "Error while compiling, aborting" exit 1 fi if ! chmod +x "$LOCALPATH"'HelpIM/bot/bot.py'; then echo "Error while making HelpIM bot executable, aborting" exit 1 fi exit 0