#! /bin/sh
#----------------------------------------------------------------
# Example debian/postinst which uses TestCase
# Andreas Tille <tille@debian.org> GPL
#----------------------------------------------------------------

set -e

PYTHON=`dpkg --status zope | grep "^Depends" | sed "s/.*\(python[2-3]\.[1-9][.0-9]*\).*/\1/"`
export SOFTWARE_HOME="/usr/lib/zope/lib/python"
export PYTHONPATH="/usr/lib/${PYTHON}:${SOFTWARE_HOME}"

case "$1" in
    configure)
                # Check whether zope-testcase is really installed which
		# is not sure because it might be only suggested until
		# it is accepted by policy
		if [ -f ${SOFTWARE_HOME}/Testing/ZopeTestCase/ZopeLite.py ] ; then
		   cd ${SOFTWARE_HOME}/Products/ExtFile/tests
                   ${PYTHON} ./runalltests.py
		fi
    ;;
    abort-upgrade|abort-remove|abort-deconfigure)
    ;;
    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac

#DEBHELPER#

# That's all folks!
exit 0
