diff --git a/system/apache-tomcat/README b/system/apache-tomcat/README new file mode 100644 index 0000000000..af37ab8734 --- /dev/null +++ b/system/apache-tomcat/README @@ -0,0 +1,7 @@ +Apache Tomcat is an implementation of the Java Servlet and JavaServer Pages +technologies. The Java Servlet and JavaServer Pages specifications are +developed under the Java Community Process. Apache Tomcat powers numerous +large-scale, mission- critical web applications across a diverse range of +industries and organizations. + +apache-tomcat requires commons-daemon. diff --git a/system/apache-tomcat/apache-tomcat.SlackBuild b/system/apache-tomcat/apache-tomcat.SlackBuild new file mode 100755 index 0000000000..f4a0fbf3f0 --- /dev/null +++ b/system/apache-tomcat/apache-tomcat.SlackBuild @@ -0,0 +1,147 @@ +#!/bin/sh + +# Slackware build script for apache-tomcat + +# Copyright 2008-2010 Heinz Wiesinger, Amsterdam, The Netherlands +# Copyright 2010 Vincent Batts, vbatts@hashbangbash.com, http://hashbangbash.com/ +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=apache-tomcat +VERSION=6.0.26 +ARCH=noarch +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +TOMCAT_HOME=/var/lib/tomcat + +if ! grep ^tomcat: /etc/group 2>&1 > /dev/null; then + echo " Must have a tomcat group to run this script." + echo " # groupadd -g 232 tomcat" + echo " Or something similar." + exit 1 +elif ! grep ^tomcat: /etc/passwd 2>&1 > /dev/null; then + echo " Must have a tomcat user to run this script." + echo " # useradd -u 232 -g tomcat -d /var/lib/tomcat tomcat" + echo " Or something similar." + exit 1 +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +unzip $CWD/$PRGNAM-$VERSION.zip +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +mkdir -p $PKG/etc/tomcat $PKG/usr/share/{tomcat,java} \ + $PKG/var/{run,lib,log,tmp,spool}/tomcat + +rm -f bin/*.exe bin/*.bat bin/*.tar.gz bin/commons-daemon.jar +cp -rf bin lib $PKG/usr/share/tomcat/ + +cp -f conf/* $PKG/etc/tomcat/ +cp -f $CWD/tomcat-java.conf $PKG/etc/tomcat/tomcat-java.conf + +cp -rf webapps ${PKG}${TOMCAT_HOME}/webapps + +ln -s /var/log/tomcat ${PKG}${TOMCAT_HOME}/logs +ln -s /var/tmp/tomcat ${PKG}${TOMCAT_HOME}/temp +ln -s /var/run/tomcat ${PKG}${TOMCAT_HOME}/work +ln -s /etc/tomcat ${PKG}${TOMCAT_HOME}/conf + +for i in tmp run spool; do + chown -R tomcat:tomcat ${PKG}/var/${i}/tomcat + chmod -R 755 ${PKG}/var/${i}/tomcat +done + +chown -R tomcat:root ${PKG}/var/log/tomcat +chmod -R 755 ${PKG}/var/log/tomcat + +chown -R tomcat:tomcat ${PKG}${TOMCAT_HOME} +chmod -R 755 ${PKG}${TOMCAT_HOME} +chmod -R 775 ${PKG}${TOMCAT_HOME}/webapps + +chown root:tomcat $PKG/etc/tomcat +chown tomcat:tomcat $PKG/etc/tomcat/tomcat-users.xml +chmod 775 $PKG/etc/tomcat + +chown tomcat:tomcat $PKG/usr/share/tomcat/bin/*.sh +chmod 744 $PKG/usr/share/tomcat/bin/*.sh + +cd $PKG/usr/share/java + for jar in ../../../usr/share/tomcat/lib/*.jar ; do + ln -s $jar + done +cd - + +mkdir -p $PKG/etc/{profile.d,rc.d} +cp $CWD/rc.tomcat $PKG/etc/rc.d/rc.tomcat.new + +cat << EOF > $PKG/etc/profile.d/$PRGNAM.csh +#!/bin/csh +setenv CATALINA_HOME /usr/share/tomcat +setenv CATALINA_BASE $TOMCAT_HOME +setenv CATALINA_TMPDIR /var/tmp/tomcat +setenv CATALINA_LIBDIR /usr/share/tomcat/lib +EOF + +cat << EOF > $PKG/etc/profile.d/$PRGNAM.sh +#!/bin/sh +export CATALINA_HOME=/usr/share/tomcat +export CATALINA_BASE=$TOMCAT_HOME +export CATALINA_TMPDIR=/var/tmp/tomcat +export CATALINA_LIBDIR=/usr/share/tomcat/lib +EOF + +chmod 0755 $PKG/etc/profile.d/* + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE NOTICE RELEASE-NOTES RUNNING.txt \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +#Let's not clobber config files +cd $PKG/etc/tomcat + for i in $(find . -type f); do + file=${i/.\//} + mv $file $file.new + echo "config etc/tomcat/$file.new" >> $PKG/install/doinst.sh + done +cd - + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/apache-tomcat/apache-tomcat.info b/system/apache-tomcat/apache-tomcat.info new file mode 100644 index 0000000000..d45e2485d8 --- /dev/null +++ b/system/apache-tomcat/apache-tomcat.info @@ -0,0 +1,10 @@ +PRGNAM="apache-tomcat" +VERSION="6.0.26" +HOMEPAGE="http://tomcat.apache.org/" +DOWNLOAD="http://www.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.zip" +MD5SUM="6bf77c1c820a0e7c1a1fb6463c0a2a1d" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Heinz Wiesinger" +EMAIL="pprkut@liwjatan.at" +APPROVED="rworkman" diff --git a/system/apache-tomcat/doinst.sh b/system/apache-tomcat/doinst.sh new file mode 100644 index 0000000000..3b6fbddc80 --- /dev/null +++ b/system/apache-tomcat/doinst.sh @@ -0,0 +1,22 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Keep same perms on rc.tomcat.new: +if [ -e etc/rc.d/rc.tomcat ]; then + cp -a etc/rc.d/rc.tomcat etc/rc.d/rc.tomcat.new.incoming + cat etc/rc.d/rc.tomcat.new > etc/rc.d/rc.tomcat.new.incoming + mv etc/rc.d/rc.tomcat.new.incoming etc/rc.d/rc.tomcat.new +fi + +config etc/rc.d/rc.tomcat.new + diff --git a/system/apache-tomcat/rc.tomcat b/system/apache-tomcat/rc.tomcat new file mode 100644 index 0000000000..e82c6347c1 --- /dev/null +++ b/system/apache-tomcat/rc.tomcat @@ -0,0 +1,66 @@ +#!/bin/sh +# Start/stop/restart apache-tomcat. +# $Id: rc.apache-tomcat,v 1.1.3 2010/02/03 +# Authors: Heinz Wiesinger , Vincent Batts +# --------------------------------------------------------------------------- + +# Load tomcat specific java vm options +. /etc/tomcat/tomcat-java.conf + +PIDFILE="/var/spool/tomcat/tomcat.pid" +LOGFILE="/var/log/tomcat/tomcat.log" + +CLASSPATH="/usr/share/tomcat/bin/bootstrap.jar:/usr/share/java/commons-daemon.jar" +for i in /usr/share/tomcat/lib/*.jar; do + CLASSPATH=$CLASSPATH:$i +done + +USER="tomcat" + +TOMCAT_CMD="/usr/bin/jsvc -user $USER -cp $CLASSPATH \ + -pidfile $PIDFILE -outfile $LOGFILE -errfile $LOGFILE \ + -Xms$MEMALLOC_MIN -Xmx$MEMALLOC_MAX -Xss$STACK -XX:MaxPermSize=$MAXPERMSIZE \ + -Djava.awt.headless=true org.apache.catalina.startup.Bootstrap" + +tomcat_start() { + echo -n "Starting Apache Tomcat ... " + if [ -e "$PIDFILE" ]; then + echo "already running!" + else + cd /var/lib/tomcat + $TOMCAT_CMD + echo "done!" + fi +} + +tomcat_stop() { + echo -n "Stopping Apache Tomcat ... " + if [ -e "$PIDFILE" ]; then + kill -TERM $(cat $PIDFILE) > /dev/null 2>&1 + echo "done!" + rm -f "$PIDFILE" + else + echo "not running!" + fi +} + +# Restart tomcat: +tomcat_restart() { + tomcat_stop + sleep 1 + tomcat_start +} + +case "$1" in +'start') + tomcat_start + ;; +'stop') + tomcat_stop + ;; +'restart') + tomcat_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac diff --git a/system/apache-tomcat/slack-desc b/system/apache-tomcat/slack-desc new file mode 100644 index 0000000000..aab034f172 --- /dev/null +++ b/system/apache-tomcat/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler-------------------------------------------------------| +apache-tomcat: Apache Tomcat (Java servlet container) +apache-tomcat: +apache-tomcat: Apache Tomcat is an implementation of the Java Servlet and Java Server +apache-tomcat: Pages technologies. The Java Servlet and Java Server Pages +apache-tomcat: specifications are developed under the Java Community Process. Apache +apache-tomcat: Tomcat powers numerous large-scale, mission-critical web applications +apache-tomcat: across a diverse range of industries and organizations. +apache-tomcat: +apache-tomcat: Homepage: http://tomcat.apache.org/ +apache-tomcat: +apache-tomcat: diff --git a/system/apache-tomcat/tomcat-java.conf b/system/apache-tomcat/tomcat-java.conf new file mode 100644 index 0000000000..da501613e3 --- /dev/null +++ b/system/apache-tomcat/tomcat-java.conf @@ -0,0 +1,16 @@ +# This file stores configuration options for the java vm +# used by apache tomcat. It does not affect any other java +# applications + +# Initial size of memory allocation pool +MEMALLOC_MIN="512m" + +# Maximum size of memory allocation pool +MEMALLOC_MAX="1024m" + +# Thread stack size +STACK="128k" + +# Maximum amount of heap used for permanent generation +MAXPERMSIZE="512m" +