* work around the broken python-clearsilver package for ubuntu jaunty (9.04)

* finally fixes #220
 * related to: https://bugs.launchpad.net/ubuntu/+source/clearsilver/+bug/386970
This commit is contained in:
lars 2009-06-16 10:02:43 +00:00
parent a6aaba642e
commit 7ecf2566a4
1 changed files with 42 additions and 0 deletions

View File

@ -46,8 +46,50 @@ OPTIONS="-B --pidfile=$PIDFILE --config=$CONF_FILE --logfile=$LOGFILE --host=$HO
test -e "$DAEMON" || exit 0
# this test is specific for ubuntu, which currently lacks python-clearsilver
# support for pythpn 2.6
# see https://bugs.launchpad.net/ubuntu/+source/clearsilver/+bug/386970
check_python_version() {
MODULE_CHECK="import neo_cgi, neo_util, neo_cs"
PYTHON_EXEC_25="/usr/bin/python2.5"
PYTHON_EXEC_24="/usr/bin/python2.4"
if "$PYTHON_EXEC" -c "$MODULE_CHECK" 2>/dev/null; then
# everything is fine
return 0
else
if which "$PYTHON_EXEC_25" >/dev/null; then
if "$PYTHON_EXEC_25" -c "$MODULE_CHECK" 2>/dev/null; then
PYTHON_EXEC="$PYTHON_EXEC_25"
return 0
else
log_daemon_msg "The python-clearsilver package is not installed"
log_end_msg 1
return 1
fi
fi
if which "$PYTHON_EXEC_24" >/dev/null; then
if "$PYTHON_EXEC_24" -c "$MODULE_CHECK" 2>/dev/null; then
PYTHON_EXEC="$PYTHON_EXEC_24"
return 0
else
log_daemon_msg "The python-clearsilver package is not installed"
log_end_msg 1
return 1
fi
fi
# no useable python version installed
log_daemon_msg "Failed to use clearsilver with your current python version."
log_daemon_msg "Please install pyhton2.5 (aptitude install python2.5)."
log_end_msg 1
fi
}
case "$1" in
start )
# check if the default python version supports clearsilver
# change the used python interpreter if possible
check_python_version || exit 1
# create the directory of the pid file if necessary
PIDDIR=$(dirname "$PIDFILE")
if [ ! -d "$PIDDIR" ]