Add postinst script

JDBC driver link creation moved to postinst to circunvent problems
introduced by old navalplan packages deleting the link when the
package is being removed.
This commit is contained in:
Nacho Barrientos 2011-11-30 18:30:27 +01:00 committed by Manuel Rego Casasnovas
parent 2569f598d3
commit 2f1f3fca84
2 changed files with 26 additions and 20 deletions

26
debian/navalplan.postinst vendored Executable file
View file

@ -0,0 +1,26 @@
#! /bin/bash
if [[ $1 = configure ]]
then
# Remove old deployment directory as it's no longer necessary.
if [ -d /var/lib/tomcat6/webapps/navalplan/ ] ; then
rm -r /var/lib/tomcat6/webapps/navalplan/
fi
# Make sure the driver is there, as it might be removed when
# uninstalling older versions of the package.
if [ ! -L /usr/share/tomcat6/lib/postgresql-jdbc3.jar ] ; then
ln -sf /usr/share/java/postgresql-jdbc3.jar /usr/share/tomcat6/lib/
fi
# Start tomcat again
if [ -x /etc/init.d/tomcat6 ] ; then
if [ -x "$(which invoke-rc.d 2> /dev/null)" ] ; then
invoke-rc.d tomcat6 start
else
/etc/init.d/tomcat6 start
fi
fi
fi
#DEBHELPER#

View file

@ -91,25 +91,5 @@ then
rm $PGPASSFILE $old_db_dump
# Remove old deployment directory as it's no longer necessary.
if [ -d /var/lib/tomcat6/webapps/navalplan/ ] ; then
rm -r /var/lib/tomcat6/webapps/navalplan/
fi
# Make sure the driver is there, as it might be removed when
# uninstalling older versions of the package.
if [ ! -L /usr/share/tomcat6/lib/postgresql-jdbc3.jar ] ; then
ln -sf /usr/share/java/postgresql-jdbc3.jar /usr/share/tomcat6/lib/
fi
# Start tomcat again
if [ -x /etc/init.d/tomcat6 ] ; then
if [ -x "$(which invoke-rc.d 2> /dev/null)" ] ; then
invoke-rc.d tomcat6 start
else
/etc/init.d/tomcat6 start
fi
fi
fi
#DEBHELPER#