From 7ecf2566a47e1ba6058f552d6a710d035111069e Mon Sep 17 00:00:00 2001 From: lars Date: Tue, 16 Jun 2009 10:02:43 +0000 Subject: [PATCH] * 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 --- debian/cryptobox-server.init | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/debian/cryptobox-server.init b/debian/cryptobox-server.init index 874d13d..b1ccdfe 100644 --- a/debian/cryptobox-server.init +++ b/debian/cryptobox-server.init @@ -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" ]