summaryrefslogtreecommitdiff
path: root/extra/tomcat
diff options
context:
space:
mode:
Diffstat (limited to 'extra/tomcat')
-rw-r--r--extra/tomcat/PKGBUILD46
-rwxr-xr-xextra/tomcat/tomcat53
-rw-r--r--extra/tomcat/tomcat.conf.d5
-rw-r--r--extra/tomcat/tomcat.install27
4 files changed, 131 insertions, 0 deletions
diff --git a/extra/tomcat/PKGBUILD b/extra/tomcat/PKGBUILD
new file mode 100644
index 000000000..273e65ae2
--- /dev/null
+++ b/extra/tomcat/PKGBUILD
@@ -0,0 +1,46 @@
+# $Id: PKGBUILD 117492 2011-04-04 07:40:54Z guillaume $
+# Maintainer: Guillaume ALAUX <guillaume at archlinux dot org>
+# Contributor: Hugo Doria <hugo@archlinux.org>
+pkgname=tomcat
+pkgver=5.5.33
+pkgrel=1
+arch=('i686' 'x86_64' 'mips64el')
+pkgdesc="Servlet container for Java Servlet and JavaServer Pages"
+url="http://tomcat.apache.org/"
+license=('APACHE')
+depends=('java-environment')
+makedepends=('openjdk6')
+backup=('opt/tomcat/conf/server.xml' 'opt/tomcat/conf/tomcat-users.xml' 'etc/conf.d/tomcat')
+install=tomcat.install
+source=(http://archive.apache.org/dist/tomcat/tomcat-5/v${pkgver}/bin/apache-tomcat-${pkgver}.tar.gz
+ 'tomcat'
+ 'tomcat.conf.d')
+md5sums=('3d79cd245497b2c501b4fd64e1da641c'
+ '20e6a8e89a148e2b0ac81ca03ceea6b1'
+ '368322d8a51ce20cc5dbdb505706a16a')
+
+build() {
+ unset LDFLAGS
+ # build jsvc
+ cd ${srcdir}/apache-${pkgname}-${pkgver}/bin
+ tar xzf commons-daemon-native.tar.gz
+ cd commons-daemon-1.0.5-native-src/unix
+ sh configure --with-java=/usr/lib/jvm/java-6-openjdk
+ make clean
+ make
+ cp jsvc ../..
+
+ # get rid of some cruft
+ cd ${srcdir}/apache-${pkgname}-${pkgver}
+ rm -f LICENSE NOTICE RELEASE-NOTES RUNNING.txt
+ rm -fr bin/*.exe bin/*.bat bin/*.tar.gz bin/jsvc-src
+
+ # install everything
+ mkdir -p ${pkgdir}/opt/tomcat
+ cp -R * ${pkgdir}/opt/tomcat
+ install -D -m755 ${srcdir}/tomcat ${pkgdir}/etc/rc.d/tomcat
+ install -D -m644 ${srcdir}/tomcat.conf.d ${pkgdir}/etc/conf.d/tomcat
+ chgrp -R 66 ${pkgdir}/opt/tomcat/{conf,work,webapps}
+ chmod 0660 ${pkgdir}/opt/tomcat/conf/{*.xml,*.policy,*.properties,/Catalina/localhost/*.xml}
+ chmod 775 ${pkgdir}/opt/tomcat/{conf,work,webapps}
+}
diff --git a/extra/tomcat/tomcat b/extra/tomcat/tomcat
new file mode 100755
index 000000000..43116783d
--- /dev/null
+++ b/extra/tomcat/tomcat
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+[ -f /etc/conf.d/tomcat ] && . /etc/conf.d/tomcat
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting Tomcat"
+ /opt/tomcat/bin/jsvc \
+ -user tomcat \
+ -home $TOMCAT_JAVA_HOME \
+ -Dcatalina.home=/opt/tomcat \
+ -Dcatalina.base=/opt/tomcat \
+ -Djava.io.tmpdir=/opt/tomcat/temp \
+ -wait 10 \
+ -pidfile /var/run/tomcat.pid \
+ -errfile /opt/tomcat/logs/catalina.log \
+ $CATALINA_OPTS \
+ -cp $TOMCAT_JAVA_HOME/lib/tools.jar:/opt/tomcat/bin/commons-daemon.jar:/opt/tomcat/bin/bootstrap.jar \
+ org.apache.catalina.startup.Bootstrap
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon tomcat
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Tomcat"
+ /opt/tomcat/bin/jsvc \
+ -stop \
+ -pidfile /var/run/tomcat.pid \
+ org.apache.catalina.startup.Bootstrap
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon tomcat
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/extra/tomcat/tomcat.conf.d b/extra/tomcat/tomcat.conf.d
new file mode 100644
index 000000000..aed805cd3
--- /dev/null
+++ b/extra/tomcat/tomcat.conf.d
@@ -0,0 +1,5 @@
+# The JAVA_HOME of the JVM for Tomcat to use
+TOMCAT_JAVA_HOME=/usr/lib/jvm/java-6-openjdk
+
+# Tomcat additional commandline options
+CATALINA_OPTS=
diff --git a/extra/tomcat/tomcat.install b/extra/tomcat/tomcat.install
new file mode 100644
index 000000000..4308274ce
--- /dev/null
+++ b/extra/tomcat/tomcat.install
@@ -0,0 +1,27 @@
+post_install() {
+ getent group tomcat >/dev/null 2>&1 || groupadd -g 66 tomcat
+ getent passwd tomcat >/dev/null 2>&1 || useradd -u 66 -g tomcat -d /opt/tomcat -s /bin/false tomcat
+
+ if [ -f lib/modules/`uname -r`/kernel/security/capability.ko ]; then
+ echo ">>> It appears that your current kernel has linux security"
+ echo ">>> capabilities built as a module. Tomcat requires this"
+ echo ">>> functionality to operate."
+ echo ">>>"
+ echo ">>> To activate the module, please load it now (modprobe capability)."
+ echo ">>> Also, you should add it to your MODULES array in rc.conf, so"
+ echo ">>> it will be activated automatically at boot-up."
+ fi
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ if getent passwd tomcat >/dev/null 2>&1; then
+ userdel tomcat
+ fi
+ if getent group tomcat >/dev/null 2>&1; then
+ groupdel tomcat
+ fi
+}