root/HelpIM3_chi/update_HelpIM_from_svn.sh

Revision 661, 2.0 kB (checked in by winfried, 3 years ago)

- trying to fix bug at CHI, no client admitted

  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3SVNURI="http://helpim.tilanus.com/subversion/HelpIM3/"
4HTMLPATH="/usr/local/share/HelpIM"
5
6if [ $# -ne 0 ]; then
7  cat << EOF
8This script updates the current installation of HelpIM from subversion at the uri:
9  $SVNURI
10If 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.
11The html-resources will be copied to:
12  $HTMLPATH
13If it doesn't exist, it will be created.
14EOF
15  exit 0
16fi
17
18
19SVN=`which svn`
20if [ -z $SVN ]; then
21  echo "svn not found, please install the subversion client and make sure it is in your path"
22  exit 1
23fi
24
25LOCALPATH=`python -c "import HelpIM; print HelpIM.__file__.split('HelpIM/__init__.py')[0]"`
26
27if [ $? -eq 1 ]; then
28  echo "No HelpIM found, placing it in current directory"
29  LOCALPATH='.'
30else
31  if [ -z $LOCALPATH ]; then
32    echo "HelpIM found in current directory"
33    LOCALPATH='.'
34  else
35    echo "Found HelpIM in $LOCALPATH"
36  fi
37fi
38
39
40echo "Updating $HTMLPATH/htdocs"
41if [ ! -d "$HTMLPATH" ]; then
42  mkdir "$HTMLPATH"
43  if [ $? -ne 0 ]; then
44    echo "Can't find or create $HTMLPATH, aborting"
45    exit 1
46  fi
47fi 
48RESULT=`$SVN export --force "$SVNURI/htdocs" "$HTMLPATH/htdocs"`
49if [ $? -ne 0 ]; then
50  echo "Error while updating, aborting"
51  exit 1
52fi
53
54echo "Updating $LOCALPATH""HelpIM"
55RESULT=`$SVN export --force "$SVNURI/HelpIM" "$LOCALPATH""HelpIM"`
56if [ $? -ne 0 ]; then
57  echo "Error while updating, aborting"
58  exit 1
59fi
60REVISION=`echo $RESULT | awk '{print $NF}' | sed "s/\.//g"`
61sed -i "s/^__version__ = \"\([0-9.]*\)\"$/__version__ = \"\1r$REVISION\"/"  "$LOCALPATH""HelpIM/__init__.py"
62echo "Precompiling $LOCALPATH""HelpIM"
63python -c "import compileall; compileall.compile_dir('$LOCALPATH''HelpIM', force=True, quiet=True)"
64if [ $? -ne 0 ]; then
65    echo "Error while compiling, aborting"
66    exit 1
67fi
68
69if ! chmod +x "$LOCALPATH"'HelpIM/bot/bot.py'; then
70    echo "Error while making HelpIM bot executable, aborting"
71    exit 1
72fi
73exit 0
Note: See TracBrowser for help on using the browser.