diff --git a/.cvsignore b/.cvsignore index e69de29..5ae6bfe 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +apache-tomcat-6.0.16-src.tar.gz diff --git a/sources b/sources index e69de29..7c10ac4 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +b2e42e8a875339e655d92975729717e5 apache-tomcat-6.0.16-src.tar.gz diff --git a/tomcat6-6.0-bootstrap-MANIFEST.MF.patch b/tomcat6-6.0-bootstrap-MANIFEST.MF.patch new file mode 100644 index 0000000..9b3ba48 --- /dev/null +++ b/tomcat6-6.0-bootstrap-MANIFEST.MF.patch @@ -0,0 +1,8 @@ +--- apache-tomcat-6.0.16-src/res/bootstrap.jar.manifest.orig 2007-06-21 11:02:18.000000000 -0400 ++++ apache-tomcat-6.0.16-src/res/bootstrap.jar.manifest 2007-06-21 11:02:26.000000000 -0400 +@@ -1,5 +1,4 @@ + Manifest-Version: 1.0 + Main-Class: org.apache.catalina.startup.Bootstrap +-Class-Path: commons-daemon.jar commons-logging-api.jar tomcat-juli.jar tomcat-coyote.jar + Specification-Title: Catalina + Specification-Version: 6.0 diff --git a/tomcat6-6.0-digest.script b/tomcat6-6.0-digest.script new file mode 100644 index 0000000..41ef58e --- /dev/null +++ b/tomcat6-6.0-digest.script @@ -0,0 +1,45 @@ +#!/bin/sh +# +# tomcat6-digest script +# JPackage Project + +# Source functions library +if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions +else + echo "Can't find functions library, aborting" + exit 1 +fi + +# Get the tomcat config (use this for environment specific settings) +if [ -z "${TOMCAT_CFG}" ]; then + TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" +fi + +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +set_javacmd + +# CLASSPATH munging +if [ -n "$JSSE_HOME" ]; then + CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)" +fi +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/bootstrap.jar" +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar" +export CLASSPATH + +# Configuration +MAIN_CLASS="org.apache.catalina.startup.Tool" +BASE_FLAGS="-Dcatalina.home=\"$CATALINA_HOME\"" +BASE_OPTIONS="" +BASE_JARS="commons-daemon tomcat6/catalina servlet" + +# Set parameters +set_classpath $BASE_JARS +set_flags $BASE_FLAGS +set_options $BASE_OPTIONS + +# Let's start +run -server org.apache.catalina.realm.RealmBase "$@" diff --git a/tomcat6-6.0-tomcat-users-webapp.patch b/tomcat6-6.0-tomcat-users-webapp.patch new file mode 100644 index 0000000..f2030b2 --- /dev/null +++ b/tomcat6-6.0-tomcat-users-webapp.patch @@ -0,0 +1,12 @@ +--- apache-tomcat-6.0.16-src/conf/tomcat-users.xml~ 2008-01-28 17:41:06.000000000 -0500 ++++ apache-tomcat-6.0.16-src/conf/tomcat-users.xml 2008-03-07 19:40:07.000000000 -0500 +@@ -23,4 +23,9 @@ + + + --> ++ ++ ++ ++ ++ + diff --git a/tomcat6-6.0-tool-wrapper.script b/tomcat6-6.0-tool-wrapper.script new file mode 100644 index 0000000..bcd7561 --- /dev/null +++ b/tomcat6-6.0-tool-wrapper.script @@ -0,0 +1,45 @@ +#!/bin/sh +# +# tomcat6-digest script +# JPackage Project + +# Source functions library +if [ -f /usr/share/java-utils/java-functions ] ; then + . /usr/share/java-utils/java-functions +else + echo "Can't find functions library, aborting" + exit 1 +fi + +# Get the tomcat config (use this for environment specific settings) +if [ -z "${TOMCAT_CFG}" ]; then + TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" +fi + +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +set_javacmd + +# CLASSPATH munging +if [ -n "$JSSE_HOME" ]; then + CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)" +fi +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/bootstrap.jar" +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar" +export CLASSPATH + +# Configuration +MAIN_CLASS="org.apache.catalina.startup.Tool" +BASE_OPTIONS="" +BASE_FLAGS="-Dcatalina.home=\"$CATALINA_HOME\"" +BASE_JARS="commons-daemon tomcat6/catalina servlet" + +# Set parameters +set_classpath $BASE_JARS +set_flags $BASE_FLAGS +set_options $BASE_OPTIONS + +# Let's start +run "$@" diff --git a/tomcat6-6.0.conf b/tomcat6-6.0.conf new file mode 100644 index 0000000..dae17f6 --- /dev/null +++ b/tomcat6-6.0.conf @@ -0,0 +1,50 @@ +# System-wide configuration file for tomcat6 services +# This will be sourced by tomcat6 and any secondary service +# Values will be overridden by service-specific configuration +# files in /etc/sysconfig +# +# Use this one to change default values for all services +# Change the service specific ones to affect only one service +# (see, for instance, /etc/sysconfig/tomcat6) +# + +# Where your java installation lives +#JAVA_HOME="/usr/lib/jvm/java" + +# Where your tomcat installation lives +CATALINA_BASE="@@@TCHOME@@@" +CATALINA_HOME="@@@TCHOME@@@" +JASPER_HOME="@@@TCHOME@@@" +CATALINA_TMPDIR="@@@TCTEMP@@@" + +# You can pass some parameters to java here if you wish to +#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3" + +# Use JAVA_OPTS to set java.library.path for libtcnative.so +#JAVA_OPTS="-Djava.library.path=@@@LIBDIR@@@" + +# What user should run tomcat +TOMCAT_USER="tomcat" + +# You can change your tomcat locale here +#LANG="en_US" + +# Run tomcat under the Java Security Manager +SECURITY_MANAGER="false" + +# Time to wait in seconds, before killing process +SHUTDOWN_WAIT="30" + +# Whether to annoy the user with "attempting to shut down" messages or not +SHUTDOWN_VERBOSE="false" + +# Set the TOMCAT_PID location +CATALINA_PID="/var/run/tomcat6.pid" + +# Connector port is 8080 for this tomcat6 instance +#CONNECTOR_PORT="8080" + +# If you wish to further customize your tomcat environment, +# put your own definitions here +# (i.e. LD_LIBRARY_PATH for some jdbc drivers) + diff --git a/tomcat6-6.0.init b/tomcat6-6.0.init new file mode 100644 index 0000000..1d3ee42 --- /dev/null +++ b/tomcat6-6.0.init @@ -0,0 +1,269 @@ +#!/bin/bash +# +# tomcat6 This shell script takes care of starting and stopping Tomcat +# +# chkconfig: - 80 20 +# +### BEGIN INIT INFO +# Provides: tomcat6 +# Required-Start: $network $syslog +# Required-Stop: $network $syslog +# Default-Start: +# Default-Stop: +# Description: Release implementation for Servlet 2.5 and JSP 2.1 +# Short-Description: start and stop tomcat +### END INIT INFO +# +# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot +# - heavily rewritten by Deepak Bhole and Jason Corley +# + +# Source function library. +. /etc/rc.d/init.d/functions + +NAME="$(basename $0)" +unset ISBOOT +if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then + NAME="${NAME:3}" + ISBOOT="1" +fi + +# For SELinux we need to use 'runuser' not 'su' +if [ -x "/sbin/runuser" ]; then + SU="/sbin/runuser" +else + SU="/bin/su" +fi + +# Get the tomcat config (use this for environment specific settings) +TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +# Get instance specific config file +if [ -r "/etc/sysconfig/${NAME}" ]; then + . /etc/sysconfig/${NAME} +fi + +# Define which connector port to use +CONNECTOR_PORT="${CONNECTOR_PORT:-8080}" + +# Path to the tomcat launch script +TOMCAT_SCRIPT="/usr/sbin/tomcat6" + +# Tomcat program name +TOMCAT_PROG="${NAME}" + +# Define the tomcat username +TOMCAT_USER="${TOMCAT_USER:-tomcat}" + +# Define the tomcat log file +TOMCAT_LOG="${TOMCAT_LOG:-/var/log/tomcat6/catalina.out}" + +RETVAL="0" + +# Look for open ports, as the function name might imply +function findFreePorts() { + local isSet1="false" + local isSet2="false" + local isSet3="false" + local lower="8000" + randomPort1="0" + randomPort2="0" + randomPort3="0" + local -a listeners="( $( + netstat -ntl | \ + awk '/^tcp/ {gsub("(.)*:", "", $4); print $4}' + ) )" + while [ "$isSet1" = "false" ] || \ + [ "$isSet2" = "false" ] || \ + [ "$isSet3" = "false" ]; do + let port="${lower}+${RANDOM:0:4}" + if [ -z `expr " ${listeners[*]} " : ".*\( $port \).*"` ]; then + if [ "$isSet1" = "false" ]; then + export randomPort1="$port" + isSet1="true" + elif [ "$isSet2" = "false" ]; then + export randomPort2="$port" + isSet2="true" + elif [ "$isSet3" = "false" ]; then + export randomPort3="$port" + isSet3="true" + fi + fi + done +} + +function makeHomeDir() { + if [ ! -d "$CATALINA_HOME" ]; then + echo "$CATALINA_HOME does not exist, creating" + if [ ! -d "/usr/share/${NAME}" ]; then + mkdir /usr/share/${NAME} + cp -pLR /usr/share/tomcat6/* /usr/share/${NAME} + fi + mkdir -p /var/log/${NAME} \ + /var/cache/${NAME} \ + /var/tmp/${NAME} + ln -fs /var/cache/${NAME} ${CATALINA_HOME}/work + ln -fs /var/tmp/${NAME} ${CATALINA_HOME}/temp + cp -pLR /usr/share/${NAME}/bin $CATALINA_HOME + cp -pLR /usr/share/${NAME}/conf $CATALINA_HOME + ln -fs /usr/share/java/tomcat6 ${CATALINA_HOME}/lib + ln -fs /usr/share/tomcat6/webapps ${CATALINA_HOME}/webapps + chown ${TOMCAT_USER}:${TOMCAT_USER} /var/log/${NAME} + fi +} + +function parseOptions() { + options="" + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; print "export ", $0, ";" }' \ + $TOMCAT_CFG + )" + if [ -r "/etc/sysconfig/${NAME}" ]; then + options="$options $( + awk '!/^#/ && !/^$/ { ORS=" "; + print "export ", $0, ";" }' \ + /etc/sysconfig/${NAME} + )" + fi + TOMCAT_SCRIPT="$options ${TOMCAT_SCRIPT}" +} + +# See how we were called. +function start() { + echo -n "Starting ${TOMCAT_PROG}: " + if [ -f "/var/lock/subsys/${NAME}" ] ; then + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + if checkpid $kpid 2>&1; then + echo_success + echo + return 0 + fi + fi + fi + # fix permissions on the log and pid files + export CATALINA_PID="/var/run/${NAME}.pid" + touch $CATALINA_PID + chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID + touch $TOMCAT_LOG + chown ${TOMCAT_USER}:${TOMCAT_USER} $TOMCAT_LOG + if [ "$CATALINA_HOME" != "/usr/share/tomcat6" ]; then + # Create a tomcat directory if it doesn't exist + makeHomeDir + # If CATALINA_HOME doesn't exist modify port number so that + # multiple instances don't interfere with each other + findFreePorts + sed -i -e "s/8005/${randomPort1}/g" -e "s/8080/${CONNECTOR_PORT}/g" \ + -e "s/8009/${randomPort2}/g" -e "s/8443/${randomPort3}/g" \ + ${CATALINA_HOME}/conf/server.xml + fi + parseOptions + if [ "$SECURITY_MANAGER" = "true" ]; then + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start-security" \ + >> $TOMCAT_LOG 2>&1 + else + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start" >> $TOMCAT_LOG 2>&1 + fi + RETVAL="$?" + if [ "$RETVAL" -eq 0 ]; then + echo_success + touch /var/lock/subsys/${NAME} + else + echo_failure + fi + echo + return $RETVAL +} + +function stop() { + RETVAL="0" + echo -n "Stopping ${TOMCAT_PROG}: " + if [ -f "/var/lock/subsys/${NAME}" ]; then + parseOptions + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1 + RETVAL="$?" + if [ "$RETVAL" -eq "0" ]; then + count="0" + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \ + [ "$count" -gt "$SHUTDOWN_WAIT" ]; do + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + echo "waiting for processes $kpid to exit" + fi + sleep 1 + let count="${count}+1" + done + if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then + if [ "$SHUTDOWN_VERBOSE" = "true" ]; then + echo "killing processes which didn't stop after $SHUTDOWN_WAIT seconds" + fi + kill -9 $kpid + fi + echo_success + fi + rm -f /var/lock/subsys/${NAME} /var/run/${NAME}.pid + else + echo_failure + fi + else + echo_success + fi + echo + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + condrestart|try-restart) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + reload) + RETVAL="3" + ;; + force-reload) + if [ -f "/var/run/${NAME}.pid" ]; then + stop + start + fi + ;; + status) + if [ -f "/var/run/${NAME}.pid" ]; then + status ${NAME} + RETVAL="$?" + else + pid="$(/usr/bin/pgrep -d , -u tomcat -G tomcat java)" + if [ -z "$pid" ]; then + status ${NAME} + RETVAL="$?" + else + echo "${NAME} (pid $pid) is running..." + RETVAL="0" + fi + fi + ;; + version) + ${TOMCAT_SCRIPT} version + ;; + *) + echo -n "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|version}" + RETVAL="2" +esac + +exit $RETVAL diff --git a/tomcat6-6.0.logrotate b/tomcat6-6.0.logrotate new file mode 100644 index 0000000..a87b4c0 --- /dev/null +++ b/tomcat6-6.0.logrotate @@ -0,0 +1,8 @@ +@@@TCLOG@@@/catalina.out { + copytruncate + weekly + rotate 52 + compress + missingok + create 0644 tomcat tomcat +} diff --git a/tomcat6-6.0.sysconfig b/tomcat6-6.0.sysconfig new file mode 100644 index 0000000..caefeed --- /dev/null +++ b/tomcat6-6.0.sysconfig @@ -0,0 +1,56 @@ +# Service-specific configuration file for tomcat6. This will be sourced by +# the SysV init script after the global configuration file +# /etc/tomcat6/tomcat6.conf, thus allowing values to be overridden in +# a per-service manner. +# +# NEVER change the init script itself. To change values for all services make +# your changes in /etc/tomcat6/tomcat6.conf +# +# To change values for a specific service make your edits here. +# To create a new service create a link from /etc/init.d/ to +# /etc/init.d/tomcat6 (do not copy the init script) and make a copy of the +# /etc/sysconfig/tomcat6 file to /etc/sysconfig/ and change +# the property values so the two services won't conflict. Register the new +# service in the system as usual (see chkconfig and similars). +# + +# Where your java installation lives +#JAVA_HOME="/usr/lib/jvm/java" + +# Where your tomcat installation lives +#CATALINA_BASE="@@@TCHOME@@@" +#CATALINA_HOME="@@@TCHOME@@@" +#JASPER_HOME="@@@TCHOME@@@" +#CATALINA_TMPDIR="@@@TCTEMP@@@" + +# You can pass some parameters to java here if you wish to +#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3" + +# Use JAVA_OPTS to set java.library.path for libtcnative.so +#JAVA_OPTS="-Djava.library.path=@@@LIBDIR@@@" + +# What user should run tomcat +#TOMCAT_USER="tomcat" + +# You can change your tomcat locale here +#LANG="en_US" + +# Run tomcat under the Java Security Manager +#SECURITY_MANAGER="false" + +# Time to wait in seconds, before killing process +#SHUTDOWN_WAIT="30" + +# Whether to annoy the user with "attempting to shut down" messages or not +#SHUTDOWN_VERBOSE="false" + +# Set the TOMCAT_PID location +#CATALINA_PID="/var/run/tomcat6.pid" + +# Connector port is 8080 for this tomcat6 instance +#CONNECTOR_PORT="8080" + +# If you wish to further customize your tomcat environment, +# put your own definitions here +# (i.e. LD_LIBRARY_PATH for some jdbc drivers) + diff --git a/tomcat6-6.0.wrapper b/tomcat6-6.0.wrapper new file mode 100644 index 0000000..9c02a73 --- /dev/null +++ b/tomcat6-6.0.wrapper @@ -0,0 +1,74 @@ +#!/bin/bash + +if [ -r /usr/share/java-utils/java-functions ]; then + . /usr/share/java-utils/java-functions +else + echo "Can't read Java functions library, aborting" + exit 1 +fi + +# Get the tomcat config (use this for environment specific settings) +if [ -z "${TOMCAT_CFG}" ]; then + TOMCAT_CFG="/etc/tomcat6/tomcat6.conf" +fi + +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +set_javacmd + +# CLASSPATH munging +if [ -n "$JSSE_HOME" ]; then + CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)" +fi +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/bootstrap.jar" +CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar" +CLASSPATH="${CLASSPATH}:$(build-classpath commons-daemon 2>/dev/null)" + +if [ "$1" = "start" ]; then + ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ + -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ + org.apache.catalina.startup.Bootstrap start \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 & + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi +elif [ "$1" = "start-security" ]; then + ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + -Djava.security.manager \ + -Djava.security.policy="${CATALINA_BASE}/conf/catalina.policy" \ + -Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ + -Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ + org.apache.catalina.startup.Bootstrap start \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 & + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi +elif [ "$1" = "stop" ]; then + ${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ + -classpath "$CLASSPATH" \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + org.apache.catalina.startup.Bootstrap stop \ + >> ${CATALINA_BASE}/logs/catalina.out 2>&1 +elif [ "$1" = "version" ]; then + ${JAVACMD} -classpath ${CATALINA_HOME}/lib/catalina.jar \ + org.apache.catalina.util.ServerInfo +else + echo "Usage: $0 {start|start-security|stop|version}" + exit 1 +fi diff --git a/tomcat6.spec b/tomcat6.spec new file mode 100644 index 0000000..30d4ffb --- /dev/null +++ b/tomcat6.spec @@ -0,0 +1,504 @@ +# Copyright (c) 2000-2008, JPackage Project +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the +# distribution. +# 3. Neither the name of the JPackage Project nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "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 COPYRIGHT +# OWNER OR CONTRIBUTORS 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. +# + +%define section free + +%define jspspec 2.1 +%define macro_version 16 +%define major_version 6 +%define minor_version 0 +%define packdname apache-tomcat-%{version}-src +%define servletspec 2.5 +%define tcuid 91 + +# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/ +%define appdir %{_var}/lib/%{name}/webapps +%define bindir %{_datadir}/%{name}/bin +%define confdir %{_sysconfdir}/%{name} +%define homedir %{_datadir}/%{name} +%define libdir %{_javadir}/%{name} +%define logdir %{_var}/log/%{name} +%define tempdir %{_var}/tmp/%{name} +%define workdir %{_var}/cache/%{name} + +Name: tomcat6 +Epoch: 0 +Version: %{major_version}.%{minor_version}.%{macro_version} +Release: 1jpp.7%{?dist} +Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API + +Group: Networking/Daemons +License: ASL 2.0 +URL: http://tomcat.apache.org/ +Source0: http://www.apache.org/dist/tomcat/tomcat-6/v%{version}/src/%{packdname}.tar.gz +Source1: %{name}-%{major_version}.%{minor_version}.conf +Source2: %{name}-%{major_version}.%{minor_version}.init +Source3: %{name}-%{major_version}.%{minor_version}.sysconfig +Source4: %{name}-%{major_version}.%{minor_version}.wrapper +Source5: %{name}-%{major_version}.%{minor_version}.logrotate +Source6: %{name}-%{major_version}.%{minor_version}-digest.script +Source7: %{name}-%{major_version}.%{minor_version}-tool-wrapper.script +Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch +Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +BuildArch: noarch + +BuildRequires: ant +BuildRequires: ant-trax +BuildRequires: eclipse-ecj >= 0:3.2.2 +BuildRequires: findutils +BuildRequires: jakarta-commons-collections +BuildRequires: jakarta-commons-daemon +BuildRequires: java-devel >= 0:1.6.0 +BuildRequires: jpackage-utils >= 0:1.7.0 +BuildRequires: junit +Requires(pre): shadow-utils +Requires(pre): shadow-utils +Requires: jakarta-commons-daemon +Requires: jakarta-commons-logging +Requires: java >= 0:1.6.0 +Requires: procps +Requires: %{name}-lib = %{epoch}:%{version}-%{release} +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +Requires(preun): /sbin/service + +%description +Tomcat is the servlet container that is used in the official Reference +Implementation for the Java Servlet and JavaServer Pages technologies. +The Java Servlet and JavaServer Pages specifications are developed by +Sun under the Java Community Process. + +Tomcat is developed in an open and participatory environment and +released under the Apache Software License version 2.0. Tomcat is intended +to be a collaboration of the best-of-breed developers from around the world. + +%package admin-webapps +Group: System Environment/Applications +Summary: The host-manager and manager web applications for Apache Tomcat +Requires: %{name} = %{epoch}:%{version}-%{release} + +%description admin-webapps +The host-manager and manager web applications for Apache Tomcat + +%package docs-webapp +Group: System Environment/Applications +Summary: The docs web application for Apache Tomcat +Requires: %{name} = %{epoch}:%{version}-%{release} + +%description docs-webapp +The docs web application for Apache Tomcat + +%package javadoc +Group: Documentation +Summary: Javadoc generated documentation for Apache Tomcat + +%description javadoc +Javadoc generated documentation for Apache Tomcat + +%package jsp-%{jspspec}-api +Group: Internet/WWW/Dynamic Content +Summary: Apache Tomcat JSP API implementation classes +Provides: jsp = %{jspspec} +Provides: jsp21 +Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} +Requires(post): chkconfig +Requires(postun): chkconfig + +%description jsp-%{jspspec}-api +Apache Tomcat JSP API implementation classes + +%package lib +Group: Development/Compilers +Summary: Libraries needed to run the Tomcat Web container +Requires: %{name}-jsp-%{jspspec}-api = %{epoch}:%{version}-%{release} +Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} +Requires(post): eclipse-ecj >= 0:3.2.2 +Requires(post): jakarta-commons-collections-tomcat5 +Requires(post): jakarta-commons-dbcp-tomcat5 +Requires(post): jakarta-commons-pool-tomcat5 +Requires(preun): coreutils + +%description lib +Libraries needed to run the Tomcat Web container + +%package servlet-%{servletspec}-api +Group: Internet/WWW/Dynamic Content +Summary: Apache Tomcat Servlet API implementation classes +Provides: servlet = %{servletspec} +Provides: servlet6 +Provides: servlet25 +Requires(post): chkconfig +Requires(postun): chkconfig + +%description servlet-%{servletspec}-api +Apache Tomcat Servlet API implementation classes + +%package webapps +Group: System Environment/Applications +Summary: The ROOT and examples web applications for Apache Tomcat +Requires: %{name} = %{epoch}:%{version}-%{release} +Requires(post): jakarta-taglibs-standard >= 0:1.1 + +%description webapps +The ROOT and examples web applications for Apache Tomcat + +%prep +%setup -q -c -T -a 0 +# remove pre-built binaries and windows files +find . \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "*.gz" -o \ + -name "*.jar" -o -name "*.war" -o -name "*.zip" \) | xargs -t %{__rm} -f +%patch0 -p0 +%patch1 -p0 + +%build +export CLASSPATH= +export OPT_JAR_LIST="ant/ant-trax" +pushd %{packdname} + # we don't care about the tarballs and we're going to replace + # tomcat-dbcp.jar with jakarta-commons-{collections,dbcp,pool}-tomcat5.jar + # so just create a dummy file for later removal + touch HACK + # who needs a build.properties file anyway + %{ant} -Dbase.path="." \ + -Dbuild.compiler="modern" \ + -Dcommons-collections.jar="$(build-classpath commons-collections)" \ + -Dcommons-daemon.jar="$(build-classpath commons-daemon)" \ + -Dcommons-daemon.jsvc.tar.gz="HACK" \ + -Djasper-jdt.jar="$(build-classpath eclipse-ecj)" \ + -Djdt.jar="$(build-classpath eclipse-ecj)" \ + -Dtomcat-dbcp.jar="HACK" \ + -Dtomcat-native.tar.gz="HACK" \ + -Dversion="%{version}" \ + -Dversion.build="%{macro_version}" + # javadoc generation + %{ant} -f dist.xml dist-prepare + %{ant} -f dist.xml dist-source + %{ant} -f dist.xml dist-javadoc + # remove some jars that we'll replace with symlinks later + %{__rm} output/build/bin/commons-daemon.jar \ + output/build/lib/eclipse-ecj.jar + # remove the cruft we created + %{__rm} output/build/bin/HACK \ + output/build/bin/tomcat-native.tar.gz \ + output/build/lib/HACK +popd +pushd %{packdname}/output/dist/src/webapps/docs/appdev/sample/src +%{__mkdir_p} ../web/WEB-INF/classes +%{javac} -cp ../../../../../../../../output/build/lib/servlet-api.jar -d ../web/WEB-INF/classes mypackage/Hello.java +pushd ../web +%{jar} cf ../../../../../../../../output/build/webapps/docs/appdev/sample/sample.war * +popd +popd + +%install +%{__rm} -rf $RPM_BUILD_ROOT +# build initial path structure +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sbindir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_javadocdir}/%{name} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_initrddir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{appdir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{bindir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{confdir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{confdir}/Catalina/localhost +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{libdir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{logdir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{homedir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{tempdir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{workdir} +# move things into place +pushd %{packdname}/output/build + %{__cp} -a bin/*.{jar,xml} ${RPM_BUILD_ROOT}%{bindir} + %{__cp} -a conf/*.{policy,properties,xml} ${RPM_BUILD_ROOT}%{confdir} + %{__cp} -a lib/*.jar ${RPM_BUILD_ROOT}%{libdir} + %{__cp} -a webapps/* ${RPM_BUILD_ROOT}%{appdir} +popd +# remove admin webapp directory since it is not shipped and not available +%{__rm} -r ${RPM_BUILD_ROOT}%{appdir}/ROOT/admin +# javadoc +pushd %{packdname}/output/dist/webapps + %{__cp} -a docs/api/* ${RPM_BUILD_ROOT}%{_javadocdir}/%{name} +popd +%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ + -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ + -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE1} \ + > ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf +%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ + -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ + -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE3} \ + > ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name} +%{__install} -m 0644 %{SOURCE2} \ + ${RPM_BUILD_ROOT}%{_initrddir}/%{name} +%{__install} -m 0644 %{SOURCE4} \ + ${RPM_BUILD_ROOT}%{_sbindir}/%{name} +%{__ln_s} %{name} ${RPM_BUILD_ROOT}%{_sbindir}/d%{name} +%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \ + > ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name} +%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ + -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ + -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \ + > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-digest +%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ + -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ + -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE7} \ + > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper +# create jsp and servlet API symlinks +pushd ${RPM_BUILD_ROOT}%{_javadir} + %{__mv} %{name}/jsp-api.jar %{name}-jsp-%{jspspec}-api-%{version}.jar + %{__mv} %{name}/servlet-api.jar \ + %{name}-servlet-%{servletspec}-api-%{version}.jar + %{__ln_s} %{name}-jsp-%{jspspec}-api-%{version}.jar \ + %{name}-jsp-%{jspspec}-api.jar + %{__ln_s} %{name}-servlet-%{servletspec}-api-%{version}.jar \ + %{name}-servlet-%{servletspec}-api.jar +popd +pushd ${RPM_BUILD_ROOT}%{libdir} + # fix up jars to include version number + for i in *.jar; do + j="$(echo $i | %{__sed} -e 's,\.jar$,,')" + %{__mv} ${j}.jar ${j}-%{version}.jar + %{__ln_s} ${j}-%{version}.jar ${j}.jar + done + # symlink JSP and servlet API jars + %{__ln_s} ../%{name}-jsp-%{jspspec}-api-%{version}.jar . + %{__ln_s} ../%{name}-servlet-%{servletspec}-api-%{version}.jar . +popd +pushd ${RPM_BUILD_ROOT}%{bindir} + # fix up jars to include version number + for i in *.jar; do + j="$(echo $i | %{__sed} -e 's,\.jar$,,')" + %{__mv} ${j}.jar ${j}-%{version}.jar + %{__ln_s} ${j}-%{version}.jar ${j}.jar + done +popd +# symlink to the FHS locations where we've installed things +pushd ${RPM_BUILD_ROOT}%{homedir} + %{__ln_s} %{appdir} webapps + %{__ln_s} %{confdir} conf + %{__ln_s} %{libdir} lib + %{__ln_s} %{logdir} logs + %{__ln_s} %{tempdir} temp + %{__ln_s} %{workdir} work +popd + +# install sample webapp +%{__mkdir_p} ${RPM_BUILD_ROOT}%{appdir}/sample +pushd ${RPM_BUILD_ROOT}%{appdir}/sample +%{jar} xf ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war +popd +%{__rm} ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war + +%clean +%{__rm} -rf $RPM_BUILD_ROOT + +%pre +# add the tomcat user and group +%{_sbindir}/groupadd -g %{tcuid} -r tomcat 2>/dev/null || : +%{_sbindir}/useradd -c "Apache Tomcat" -u %{tcuid} -g tomcat \ + -s /bin/sh -r -d %{homedir} tomcat 2>/dev/null || : + +%post +# install but don't activate +/sbin/chkconfig --add %{name} + +%post jsp-%{jspspec}-api +%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \ + %{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20100 + +%post lib +%{_bindir}/build-jar-repository %{libdir} commons-collections-tomcat5 \ + commons-dbcp-tomcat5 commons-pool-tomcat5 eclipse-ecj 2>&1 + +%post servlet-%{servletspec}-api +%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \ + %{_javadir}/%{name}-servlet-%{servletspec}-api.jar 20500 + +%post webapps +%{_bindir}/build-jar-repository %{appdir}/examples/WEB-INF/lib \ + taglibs-core.jar taglibs-standard.jar 2>&1 + +%preun +# clean tempdir and workdir on removal or upgrade +%{__rm} -rf %{workdir}/* %{tempdir}/* +if [ "$1" = "0" ]; then + /sbin/service %{name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name} +fi + +%preun lib +if [ "$1" = "0" ]; then + %{__rm} -f %{libdir}/\[commons-collections-tomcat5\].jar \ + %{libdir}/\[commons-dbcp-tomcat5\].jar \ + %{libdir}/\[commons-pool-tomcat5\].jar \ + %{libdir}/\[eclipse-ecj\].jar >/dev/null 2>&1 +fi + +%postun jsp-%{jspspec}-api +if [ "$1" = "0" ]; then + %{_sbindir}/update-alternatives --remove jsp \ + %{_javadir}/%{name}-jsp-%{jspspec}-api.jar +fi + +%postun servlet-%{servletspec}-api +if [ "$1" = "0" ]; then + %{_sbindir}/update-alternatives --remove servlet \ + %{_javadir}/%{name}-servlet-%{servletspec}-api.jar +fi + +%files +%defattr(0644,root,root,0755) +%doc %{packdname}/{LICENSE,NOTICE,RELEASE*} +%attr(0755,root,root) %{_bindir}/%{name}-digest +%attr(0755,root,root) %{_bindir}/%{name}-tool-wrapper +%attr(0755,root,root) %{_sbindir}/d%{name} +%attr(0755,root,root) %{_sbindir}/%{name} +%attr(0775,root,tomcat) %dir %{logdir} +%attr(0755,root,root) %{_initrddir}/%{name} +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%attr(0775,root,tomcat) %dir %{appdir} +%dir %{confdir} +%dir %{confdir}/Catalina +%attr(0775,root,tomcat) %dir %{confdir}/Catalina/localhost +%config(noreplace) %{confdir}/%{name}.conf +%config(noreplace) %{confdir}/*.policy +%config(noreplace) %{confdir}/*.properties +%config(noreplace) %{confdir}/context.xml +%config(noreplace) %{confdir}/server.xml +%attr(0660,root,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml +%config(noreplace) %{confdir}/web.xml +%attr(0775,root,tomcat) %dir %{tempdir} +%attr(0775,root,tomcat) %dir %{workdir} +%{homedir} + +%files admin-webapps +%defattr(0644,root,root,0755) +%{appdir}/host-manager +%{appdir}/manager + +%files docs-webapp +%defattr(0644,root,root,0755) +%{appdir}/docs + +%files javadoc +%defattr(0644,root,root,0755) +%{_javadocdir}/%{name} + +%files jsp-%{jspspec}-api +%defattr(0644,root,root,0755) +%{_javadir}/%{name}-jsp*.jar + +%files lib +%defattr(0644,root,root,0755) +%{libdir} + +%files servlet-%{servletspec}-api +%defattr(0644,root,root,0755) +%{_javadir}/%{name}-servlet*.jar + +%files webapps +%defattr(0644,root,root,0755) +%{appdir}/ROOT +%{appdir}/examples +%{appdir}/sample + +%changelog +* Fri Apr 04 2008 David Walluck 0:6.0.16-1jpp.7.fc9 +- version jsp and servlet Provides with their spec versions +- remove Obsoletes/Provides for servletapi6 package as it can co-exist +- check for java-functions existence in wrapper script +- move d%%{name} to %%{name} and create symlink for d%%{name} +- improve status function in initscript +- change license to ASL 2.0 again as per Fedora guidelines + +* Mon Mar 24 2008 David Walluck 0:6.0.16-1jpp.6.fc9 +- remove Requires: tomcat-native +- put back original JPackage Group (except javadoc) and License tags +- add Provides for jsp and servlet +- use ant macro +- build and install sample webapp +- call /sbin/service to stop service on uninstall +- remove references to $RPM_BUILD_DIR +- use copy instead of move to fix short-circuit install build +- remove prebuilt sample.war +- remove Thumbs.db files +- add Requires: java >= 0:1.6.0 + +* Wed Mar 19 2008 David Walluck 0:6.0.16-1jpp.5.fc9 +- explicitly unset CLASSPATH +- explicitly set OPT_JAR_LIST to include ant/ant-trax + +* Tue Mar 18 2008 David Walluck 0:6.0.16-1jpp.4.fc9 +- remove BuildRequires: sed +- remove specific references to icedtea + +* Mon Mar 17 2008 David Walluck 0:6.0.16-1jpp.3.fc9 +- add digest and tool-wrapper scripts +- Requires: tomcat-native + +* Fri Mar 7 2008 David Walluck 0:6.0.16-1jpp.2.fc9 +- use %%{_var} for appdir instead of /srv +- use ${JAVACMD} for java executable in wrapper script +- use built-in status function in initscript where possible +- add missing require on procps for status function +- fix java.library.path setting in %%{_sysconfdir}/sysconfig/%%{name} +- add patch to document webapps in %%{_sysconfdir}/%%{name}/tomcat-users.xml +- remove %%{appdir}/ROOT/admin +- move %%{_bindir}/d%%{name} to %%{_sbindir}/d%%{name} + +* Mon Mar 3 2008 David Walluck 0:6.0.16-1jpp.1.fc9 +- use %%{_initrddir} macro instead of %%{_sysconfdir}/init.d (rhbz #153187) +- fix java.library.path setting in %%{name}.conf (rhbz #253605) +- fix incorrect initscript output (rhbz #380921) +- update initscript (rhbz #247077) +- add logrotate support +- fix strange-permission +- fix %%prep +- replace /var with %%{_var} +- replace %%{_localstatedir} with %%{_var} +- use %%{logdir} where possible +- call build-jar-repository with full path in scriptlets +- remove file-based requires +- build with icedtea and set as the default JAVA_HOME in %%{name}.conf +- fix non-standard-group +- change ecj references to eclipse-ecj +- change Apache Software License 2.0 to ASL 2.0 for rpmlint + +* Fri Feb 8 2008 Jason Corley - 0:6.0.16-1jpp +- update to 6.0.16 + +* Sun Dec 2 2007 Jason Corley - 0:6.0.14-2jpp +- add /etc/tomcat6/Catalina/localhost (Alexander Kurtakov) + +* Tue Aug 14 2007 Jason Corley 0:6.0.14-1jpp +- first JPackage release