PREIN
/bin/sh
# Add the "tomcat" user and group
# we need a shell to be able to use su - later
/usr/sbin/groupadd -g 91 -r tomcat 2> /dev/null || :
/usr/sbin/useradd -c "Apache Tomcat" -u 91 -g tomcat \
-s /bin/sh -r -d /usr/share/tomcat5 tomcat 2> /dev/null || :
PREUN
/bin/sh
# Always clean up workdir and tempdir on upgrade/removal
/bin/rm -fr /var/cache/tomcat5/work/* /var/cache/tomcat5/temp/*
if [ $1 = 0 ]; then
[ -f /var/lock/subsys/tomcat5 ] && /etc/init.d/tomcat5 stop
[ -f /etc/init.d/tomcat5 ] && /sbin/chkconfig --del tomcat5
# Remove automated symlinks
for repository in /var/lib/tomcat5/common/endorsed; do
find $repository -name '\[*\]*.jar' -not -type d | xargs /bin/rm -f
done
for repository in /var/lib/tomcat5/common/lib ; do
find $repository -name '\[*\]*.jar' -not -type d | xargs /bin/rm -f
done
for repository in /var/lib/tomcat5/server/lib ; do
find $repository -name '\[*\]*.jar' -not -type d | xargs /bin/rm -f
done
fi
POSTIN
/bin/sh
echo -e "<dependencies>\n" > /etc/maven/maven2-depmap.xml
if [ -d /etc/maven/fragments ] && [ -n "`find /etc/maven/fragments -type f`" ]; then
cat /etc/maven/fragments/* >> /etc/maven/maven2-depmap.xml
fi
echo -e "</dependencies>\n" >> /etc/maven/maven2-depmap.xml
# install tomcat5 (but don't activate)
/sbin/chkconfig --add tomcat5
# Remove old automated symlinks
for repository in /usr/share/tomcat5/bin ; do
find $repository -name '*.jar' -type l | xargs /bin/rm -f
done
for repository in /var/lib/tomcat5/common/endorsed ; do
find $repository -name '\[*\]*.jar' -not -type d | xargs /bin/rm -f
done
for repository in /var/lib/tomcat5/common/lib ; do
find $repository -name '\[*\]*.jar' -not -type d | xargs /bin/rm -f
done
for repository in /var/lib/tomcat5/server/lib ; do
find $repository -name '\[*\]*.jar' -not -type d | xargs /bin/rm -f
done
# Create automated links - since all needed extensions may not have been
# installed for this jvm output is muted
/bin/rm -f /usr/share/tomcat5/bin/commons-daemon.jar
ln -s $(build-classpath commons-daemon) /usr/share/tomcat5/bin 2>&1
/bin/rm -f /usr/share/tomcat5/bin/commons-logging-api.jar
ln -s $(build-classpath commons-logging-api) /usr/share/tomcat5/bin 2>&1
/bin/rm -f /usr/share/tomcat5/bin/tomcat-juli.jar
ln -s $(build-classpath tomcat5/tomcat-juli) /usr/share/tomcat5/bin 2>&1
build-jar-repository /var/lib/tomcat5/common/endorsed jaxp_parser_impl \
xml-commons-jaxp-1.3-apis 2>&1
build-jar-repository /var/lib/tomcat5/common/lib commons-collections-tomcat5 \
commons-dbcp-tomcat5 commons-el commons-pool-tomcat5 jaf javamail jsp \
tomcat5/naming-factory tomcat5/naming-resources servlet \
jasper5-compiler jasper5-runtime 2>&1
build-jar-repository /var/lib/tomcat5/common/lib ecj 2>&1
build-jar-repository /var/lib/tomcat5/server/lib catalina-ant5 commons-modeler \
tomcat5/catalina-ant-jmx tomcat5/catalina-cluster tomcat5/catalina \
tomcat5/catalina-optional tomcat5/catalina-storeconfig \
tomcat5/servlets-default tomcat5/servlets-invoker tomcat5/servlets-webdav \
tomcat5/tomcat-ajp tomcat5/tomcat-apr tomcat5/tomcat-coyote \
tomcat5/tomcat-http tomcat5/tomcat-jkstatus-ant tomcat5/tomcat-util 2>&1
POSTUN
/bin/sh
echo -e "<dependencies>\n" > /etc/maven/maven2-depmap.xml
if [ -d /etc/maven/fragments ] && [ -n "`find /etc/maven/fragments -type f`" ]; then
cat /etc/maven/fragments/* >> /etc/maven/maven2-depmap.xml
fi
echo -e "</dependencies>\n" >> /etc/maven/maven2-depmap.xml