1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#!/bin/sh -e
# This is the postinst script for Debian's Cocoon, adapted from the
# Debian's GNUJSP script (written by Stefan Gybas <sgybas@debian.org>)
# by Julio Maia <julio@pobox.com>. It is released under the GPL.
# Modified to fit the new package, by Ola Lundqvist <opal@debian.org>
case "$1" in
configure|abort-upgrade|abort-remove|abort-deconfigure)
# old place in previous versions ...
rm -rf /var/cocoon
# Here we should use wwwconfig-common
echo -n "Setting the owner for /var/lib/cocoon ... "
chown www-data:www-data /var/lib/cocoon
echo "done."
if [ -x /usr/sbin/update-jserv ]; then
/usr/sbin/update-jserv add-classpath /usr/share/java/cocoon.jar
# /usr/sbin/update-jserv add-classpath /usr/share/java/openxml.jar
# /usr/sbin/update-jserv add-classpath /usr/share/java/xslp.jar
/usr/sbin/update-jserv add-classpath /usr/share/java/fop-0.13.0.jar
# /usr/sbin/update-jserv add-classpath /usr/share/java/fesi.jar
/usr/sbin/update-jserv add-mapping xml org.apache.cocoon.Cocoon
/usr/sbin/update-jserv add-option servlet.org.apache.cocoon.Cocoon.initArgs properties /etc/cocoon/cocoon.properties
[ -x /etc/init.d/jserv ] && /etc/init.d/jserv force-reload
[ -x /etc/init.d/apache ] && /etc/init.d/apache reload
echo
echo "Cocoon was installed sucessfully."
echo "You can now try http://127.0.0.1/Cocoon.xml"
echo "to grab informations about its settings."
elif [ -e /usr/share/tomcat/lib/tomcat.jar ] ; then
if [ -e /etc/tomcat/server.xml ] ; then
if ! grep cocoon /etc/tomcat/server.xml > /dev/null 2>&1 ; then
sed -e 's#</ContextManager>#<Context path="/cocoon" docBase="webapps/cocoon" debug="0" reloadable="true"></Context></ContextManager>#;' /etc/tomcat/server.xml > /etc/tomcat/server.xml.new
if [ -s /etc/tomcat/server.xml ] ; then
if grep cocoon /etc/tomcat/server.xml.new > /dev/null 2>&1 ; then
echo "Successfully modified /etc/tomcat/server.xml"
mv /etc/tomcat/server.xml.new /etc/tomcat/server.xml
else
echo "Cocoon not added to /etc/tomcat/server.xml, do it manually (and file a bug)."
fi
else
echo "Error when replacing server.xml. Do it manually."
fi
fi
fi
if [ -x /etc/init.d/tomcat ] ; then
echo "Restarting the tomcat webserver."
/etc/init.d/tomcat restart
else
echo "You have to restart the tomcat server."
fi
else
echo
echo "The automatic configuration of Cocoon failed."
echo "Please read /usr/share/doc/cocoon/README.Debian to find out"
echo "how to manually set up Cocoon on your system."
fi
;;
*)
echo "$0 called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
|