From a187a00edfbbf008ae677ad51c16494da0c7aba7272fd032f310a582c6fff864 Mon Sep 17 00:00:00 2001 From: Factory Maintainer Date: Sat, 16 Jun 2012 05:18:01 +0000 Subject: [PATCH] unlink OBS-URL: https://build.opensuse.org/package/show/Java:packages/tomcat?expand=0&rev=3 --- .gitattributes | 23 + .gitignore | 1 + apache-tomcat-7.0.27-src.tar.gz | 3 + el-api-OSGi-MANIFEST.MF | 13 + jasper-OSGi-MANIFEST.MF | 40 ++ jasper-el-OSGi-MANIFEST.MF | 13 + jsp-api-OSGi-MANIFEST.MF | 13 + servlet-api-OSGi-MANIFEST.MF | 17 + tomcat-7.0-bootstrap-MANIFEST.MF.patch | 11 + tomcat-7.0-digest.script | 45 ++ tomcat-7.0-jsvc.service | 19 + tomcat-7.0-jsvc.wrapper | 83 +++ tomcat-7.0-log4j.properties | 11 + tomcat-7.0-tomcat-jsvc-sysd | 113 ++++ tomcat-7.0-tomcat-sysd | 101 +++ tomcat-7.0-tomcat-users-webapp.patch | 19 + tomcat-7.0-tool-wrapper.script | 45 ++ tomcat-7.0.2-property-build.windows.patch | 23 + tomcat-7.0.conf | 56 ++ tomcat-7.0.init | 388 ++++++++++++ tomcat-7.0.logrotate | 8 + tomcat-7.0.service | 19 + tomcat-7.0.wrapper | 74 +++ tomcat-api-OSGi-MANIFEST.MF | 12 + tomcat-juli-OSGi-MANIFEST.MF | 13 + tomcat-rpmlintrc | 2 + tomcat.changes | 51 ++ tomcat.spec | 719 ++++++++++++++++++++++ 28 files changed, 1935 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 apache-tomcat-7.0.27-src.tar.gz create mode 100644 el-api-OSGi-MANIFEST.MF create mode 100644 jasper-OSGi-MANIFEST.MF create mode 100644 jasper-el-OSGi-MANIFEST.MF create mode 100644 jsp-api-OSGi-MANIFEST.MF create mode 100644 servlet-api-OSGi-MANIFEST.MF create mode 100644 tomcat-7.0-bootstrap-MANIFEST.MF.patch create mode 100644 tomcat-7.0-digest.script create mode 100644 tomcat-7.0-jsvc.service create mode 100644 tomcat-7.0-jsvc.wrapper create mode 100644 tomcat-7.0-log4j.properties create mode 100644 tomcat-7.0-tomcat-jsvc-sysd create mode 100644 tomcat-7.0-tomcat-sysd create mode 100644 tomcat-7.0-tomcat-users-webapp.patch create mode 100644 tomcat-7.0-tool-wrapper.script create mode 100644 tomcat-7.0.2-property-build.windows.patch create mode 100644 tomcat-7.0.conf create mode 100644 tomcat-7.0.init create mode 100644 tomcat-7.0.logrotate create mode 100644 tomcat-7.0.service create mode 100644 tomcat-7.0.wrapper create mode 100644 tomcat-api-OSGi-MANIFEST.MF create mode 100644 tomcat-juli-OSGi-MANIFEST.MF create mode 100644 tomcat-rpmlintrc create mode 100644 tomcat.changes create mode 100644 tomcat.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/apache-tomcat-7.0.27-src.tar.gz b/apache-tomcat-7.0.27-src.tar.gz new file mode 100644 index 0000000..76f3779 --- /dev/null +++ b/apache-tomcat-7.0.27-src.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e692cfe55168e866094d1dba2653d2bb75462c535f0940f756a0253284b2ca9 +size 4189578 diff --git a/el-api-OSGi-MANIFEST.MF b/el-api-OSGi-MANIFEST.MF new file mode 100644 index 0000000..f1f98bf --- /dev/null +++ b/el-api-OSGi-MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Export-Package: javax.el;version="2.2.0" +Bundle-Vendor: %bundleProvider +Bundle-ClassPath: . +Bundle-Version: 2.2.0 +Bundle-Name: %bundleName +Bundle-Localization: plugin +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: javax.el +DynamicImport-Package: org.apache.el +Bundle-RequiredExecutionEnvironment: J2SE-1.4,CDC-1.0/Foundation-1.0,J + 2SE-1.3 + diff --git a/jasper-OSGi-MANIFEST.MF b/jasper-OSGi-MANIFEST.MF new file mode 100644 index 0000000..b28cd51 --- /dev/null +++ b/jasper-OSGi-MANIFEST.MF @@ -0,0 +1,40 @@ +Manifest-Version: 1.0 +Export-Package: org.apache.jasper;version="7.0.21",org.apache.jasper.c + ompiler;version="7.0.21",org.apache.jasper.compiler.tagplugin;version + ="7.0.21",org.apache.jasper.resources;version="7.0.21",org.apache.jas + per.runtime;version="7.0.21",org.apache.jasper.security;version="7.0. + 19",org.apache.jasper.servlet;version="7.0.21",org.apache.jasper.tagp + lugins.jstl;version="7.0.21",org.apache.jasper.tagplugins.jstl.core;v + ersion="7.0.21",org.apache.jasper.util;version="7.0.21",org.apache.ja + sper.xmlparser;version="7.0.21" +Bundle-Vendor: %bundleProvider +Bundle-ClassPath: . +Bundle-Version: 7.0.21 +Bundle-Localization: plugin +Bundle-Name: %bundleName +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.apache.jasper +Import-Package: javax.servlet;version="[2.4.0, 3.0.0]",javax.servlet.h + ttp;version="[2.4.0, 3.0.0]",javax.servlet.jsp;version="[2.0.0, 2.2.0 + ]",javax.servlet.jsp.el;version="[2.0.0, 2.2.0]",javax.servlet.jsp.re + sources;version="[2.0.0, 2.2.0]",javax.servlet.jsp.tagext;version="[2 + .0.0, 2.2.0]",javax.servlet.resources;version="[2.4.0, 3.0.0]",javax. + xml.parsers,org.apache.commons.el;version="[1.0.0,2.0.0)",org.apache. + commons.logging;version="[1.0.0,2.0.0)",org.apache.tools.ant;resoluti + on:=optional,org.apache.tools.ant.taskdefs;resolution:=optional,org.a + pache.tools.ant.types;resolution:=optional,org.apache.tools.ant.util; + resolution:=optional,org.w3c.dom,org.xml.sax,org.xml.sax.ext,org.xml. + sax.helpers,org.apache.tomcat;version="7.0.21",org.apache.juli.loggin + g;version="7.0.21",javax.el;version="2.2.0",org.eclipse.jdt.internal. + compiler,org.eclipse.jdt.internal.compiler.parser,org.eclipse.jdt.int + ernal.compiler.parser.diagnose,org.eclipse.jdt.internal.compiler.flow + ,org.eclipse.jdt.internal.compiler.util,org.eclipse.jdt.internal.comp + iler.impl,org.eclipse.jdt.internal.compiler.lookup,org.eclipse.jdt.in + ternal.compiler.codegen,org.eclipse.jdt.internal.compiler.batch,org.e + clipse.jdt.internal.compiler.classfmt,org.eclipse.jdt.internal.compil + er.ast,org.eclipse.jdt.internal.compiler.problem,org.eclipse.jdt.inte + rnal.compiler.env,org.eclipse.jdt.internal.core.util,org.eclipse.jdt. + core.compiler +Bundle-RequiredExecutionEnvironment: J2SE-1.4,CDC-1.0/Foundation-1.0,J + 2SE-1.3 + diff --git a/jasper-el-OSGi-MANIFEST.MF b/jasper-el-OSGi-MANIFEST.MF new file mode 100644 index 0000000..158f023 --- /dev/null +++ b/jasper-el-OSGi-MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Export-Package: org.apache.el;version="7.0.21" +Bundle-Vendor: %bundleProvider +Bundle-ClassPath: . +Bundle-Version: 7.0.21 +Bundle-Name: %bundleName +Bundle-Localization: plugin +Bundle-ManifestVersion: 2 +Import-Package: javax.el;version="2.2" +Bundle-SymbolicName: org.apache.el +Bundle-RequiredExecutionEnvironment: J2SE-1.4,CDC-1.0/Foundation-1.0,J + 2SE-1.3 + diff --git a/jsp-api-OSGi-MANIFEST.MF b/jsp-api-OSGi-MANIFEST.MF new file mode 100644 index 0000000..35aca76 --- /dev/null +++ b/jsp-api-OSGi-MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-Vendor: %bundleProvider +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,J2SE-1.3 +Bundle-Name: %bundleName +Bundle-SymbolicName: javax.servlet.jsp +Export-Package: javax.servlet.jsp; version=2.2,javax.servlet.jsp.el; v + ersion=2.2,javax.servlet.jsp.resources; version=2.2,javax.servlet.jsp + .tagext; version=2.2 +Bundle-Version: 2.2.0.v200806031607 +Bundle-ManifestVersion: 2 +Import-Package: javax.servlet; version=3.0,javax.servlet.http; version + =3.0,javax.servlet.resources; version=3.0,javax.el;version="2.2.0" diff --git a/servlet-api-OSGi-MANIFEST.MF b/servlet-api-OSGi-MANIFEST.MF new file mode 100644 index 0000000..1a5c6ed --- /dev/null +++ b/servlet-api-OSGi-MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,J2SE-1.4 +Bundle-SymbolicName: javax.servlet +Bundle-ManifestVersion: 2 +Bundle-Name: %bundleName +Bundle-Localization: plugin +Bundle-Version: 3.0.0 +Bundle-Vendor: %bundleProvider +Export-Package: javax.servlet;version="3.0", + javax.servlet;version="2.6", + javax.servlet.http;version="3.0", + javax.servlet.http;version="2.6", + javax.servlet.annotation;version="2.6", + javax.servlet.descriptor;version="3.0", + javax.servlet.descriptor;version="2.6", + javax.servlet.resources;version="3.0", + javax.servlet.resources;version="2.6" diff --git a/tomcat-7.0-bootstrap-MANIFEST.MF.patch b/tomcat-7.0-bootstrap-MANIFEST.MF.patch new file mode 100644 index 0000000..3324c3c --- /dev/null +++ b/tomcat-7.0-bootstrap-MANIFEST.MF.patch @@ -0,0 +1,11 @@ +Index: apache-tomcat-7.0.2-src/res/META-INF/bootstrap.jar.manifest +=================================================================== +--- apache-tomcat-7.0.2-src.orig/res/META-INF/bootstrap.jar.manifest 2010-08-04 01:26:39.000000000 +0200 ++++ apache-tomcat-7.0.2-src/res/META-INF/bootstrap.jar.manifest 2010-09-23 11:25:07.237277450 +0200 +@@ -1,6 +1,5 @@ + Manifest-Version: 1.0 + Main-Class: org.apache.catalina.startup.Bootstrap +-Class-Path: commons-daemon.jar + Specification-Title: Apache Tomcat Bootstrap + Specification-Version: @VERSION_MAJOR_MINOR@ + Specification-Vendor: Apache Software Foundation diff --git a/tomcat-7.0-digest.script b/tomcat-7.0-digest.script new file mode 100644 index 0000000..51df750 --- /dev/null +++ b/tomcat-7.0-digest.script @@ -0,0 +1,45 @@ +#!/bin/sh +# +# tomcat-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/tomcat/tomcat.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 tomcat/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/tomcat-7.0-jsvc.service b/tomcat-7.0-jsvc.service new file mode 100644 index 0000000..519f38e --- /dev/null +++ b/tomcat-7.0-jsvc.service @@ -0,0 +1,19 @@ +# Systemd unit file for tomcat +# +# To create clones of this service: +# 1) By default SERVICE_NAME=tomcat. When cloned, the value must be defined +# before tomcat-sysd is called. +# 2) Create /etc/sysconfig/${SERVICE_NAME} from /etc/sysconfig/tomcat +# to override tomcat defaults + +[Unit] +Description=Apache Tomcat Web Application Container JSVC wrapper +After=syslog.target network.target + +[Service] +Type=forking +ExecStart=/usr/sbin/tomcat-jsvc-sysd start +ExecStop=/usr/sbin/tomcat-jsvc-sysd stop + +[Install] +WantedBy=multi-user.target diff --git a/tomcat-7.0-jsvc.wrapper b/tomcat-7.0-jsvc.wrapper new file mode 100644 index 0000000..7c59d55 --- /dev/null +++ b/tomcat-7.0-jsvc.wrapper @@ -0,0 +1,83 @@ +#!/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/tomcat/tomcat.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 jsvc installed and USE_JSVC=true +# then use jsvc instead of calling java directly +if [ -x /usr/bin/jsvc ]; then + JAVACMD="/usr/bin/jsvc -nodetach -user ${TOMCAT_USER} -outfile ${CATALINA_BASE}/logs/catalina.out -errfile ${CATALINA_BASE}/logs/catalina.out" + if [ "$1" = "stop" ]; then + JAVACMD="${JAVACMD} -stop" + fi +fi + +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 \ + -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/tomcat-7.0-log4j.properties b/tomcat-7.0-log4j.properties new file mode 100644 index 0000000..c136eec --- /dev/null +++ b/tomcat-7.0-log4j.properties @@ -0,0 +1,11 @@ +log4j.rootLogger=debug, R +log4j.appender.R=org.apache.log4j.RollingFileAppender +log4j.appender.R.File=${catalina.home}/logs/tomcat.log +log4j.appender.R.MaxFileSize=10MB +log4j.appender.R.MaxBackupIndex=10 +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n +log4j.logger.org.apache.catalina=DEBUG, R +log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=DEBUG, R +log4j.logger.org.apache.catalina.core=DEBUG, R +log4j.logger.org.apache.catalina.session=DEBUG, R diff --git a/tomcat-7.0-tomcat-jsvc-sysd b/tomcat-7.0-tomcat-jsvc-sysd new file mode 100644 index 0000000..3e0373a --- /dev/null +++ b/tomcat-7.0-tomcat-jsvc-sysd @@ -0,0 +1,113 @@ +#!/bin/bash +# +# This script provides systemd activation of the tomcat service +# To create clones of this service: +# 1) SERVICE_NAME must be defined before calling this script +# 2) Create /etc/sysconfig/${SERVICE_NAME} from /etc/sysconfig/tomcat +# to override tomcat defaults + +# SERVICE_NAME is a required value only if the service name is +# different from 'tomcat' +# +NAME="${SERVICE_NAME:-tomcat}" + +#I'll bet this isn't required. +# unset ISBOOT + +# For SELinux we need to use 'runuser' not 'su' +if [ -x "/sbin/runuser" ]; then + SU="/sbin/runuser -s /bin/sh" +else + SU="/bin/su -s /bin/sh" +fi + +# Path to the tomcat launch script +TOMCAT_SCRIPT="/usr/sbin/tomcat-jsvc" + +# Define the tomcat username +TOMCAT_USER="${TOMCAT_USER:-tomcat}" + +# TOMCAT_LOG should be different from catalina.out. +# Usually the below config is all that is necessary +TOMCAT_LOG=/var/log/${NAME}/${SERVICE_NAME}-jsvc-sysd.log + +# Get the tomcat config (use this for environment specific settings) +TOMCAT_CFG="/etc/tomcat/tomcat.conf" +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +# Get instance specific config file +if [ -r "/etc/sysconfig/${NAME}" ]; then + . /etc/sysconfig/${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() { + # fix permissions on the log and pid files + export CATALINA_PID="/var/run/${NAME}.pid" + touch $CATALINA_PID 2>&1 + if [ "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID + fi + + touch $TOMCAT_LOG 2>&1 + if [ "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_USER} $TOMCAT_LOG + fi + + # if jsvc installed and USE_JSVC=true + # then start as root and use jsvc to drop privileges + if [ -x /usr/bin/jsvc ]; then + TOMCAT_USER="root" + 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 +} + +function stop() { + # if jsvc installed and USE_JSVC=true + # then start as root and use jsvc to drop privileges + if [ -x /usr/bin/jsvc ]; then + TOMCAT_USER="root" + fi + + parseOptions + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1 +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; +esac + diff --git a/tomcat-7.0-tomcat-sysd b/tomcat-7.0-tomcat-sysd new file mode 100644 index 0000000..2fe0eb8 --- /dev/null +++ b/tomcat-7.0-tomcat-sysd @@ -0,0 +1,101 @@ +#!/bin/bash +# +# This script provides systemd activation of the tomcat service +# To create clones of this service: +# 1) SERVICE_NAME must be defined before calling this script +# 2) Create /etc/sysconfig/${SERVICE_NAME} from /etc/sysconfig/tomcat +# to override tomcat defaults + +# SERVICE_NAME is a required value only if the service name is +# different from 'tomcat' +# +NAME="${SERVICE_NAME:-tomcat}" + +#I'll bet this isn't required. +# unset ISBOOT + +# For SELinux we need to use 'runuser' not 'su' +if [ -x "/sbin/runuser" ]; then + SU="/sbin/runuser -s /bin/sh" +else + SU="/bin/su -s /bin/sh" +fi + +# Path to the tomcat launch script +TOMCAT_SCRIPT="/usr/sbin/tomcat" + +# Define the tomcat username +TOMCAT_USER="${TOMCAT_USER:-tomcat}" + +# TOMCAT_LOG should be different from catalina.out. +# Usually the below config is all that is necessary +TOMCAT_LOG=/var/log/${NAME}/${NAME}-sysd.log + +# Get the tomcat config (use this for environment specific settings) +TOMCAT_CFG="/etc/tomcat/tomcat.conf" +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +# Get instance specific config file +if [ -r "/etc/sysconfig/${NAME}" ]; then + . /etc/sysconfig/${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() { + # fix permissions on the log and pid files + export CATALINA_PID="/var/run/${NAME}.pid" + touch $CATALINA_PID 2>&1 + if [ "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID + fi + + touch $TOMCAT_LOG 2>&1 + if [ "$?" -eq "0" ]; then + chown ${TOMCAT_USER}:${TOMCAT_USER} $TOMCAT_LOG + 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 +} + +function stop() { + parseOptions + $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1 +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; +esac + diff --git a/tomcat-7.0-tomcat-users-webapp.patch b/tomcat-7.0-tomcat-users-webapp.patch new file mode 100644 index 0000000..5324f7e --- /dev/null +++ b/tomcat-7.0-tomcat-users-webapp.patch @@ -0,0 +1,19 @@ +Index: apache-tomcat-7.0.2-src/conf/tomcat-users.xml +=================================================================== +--- apache-tomcat-7.0.2-src/conf/tomcat-users.xml 2010-08-04 01:26:35.000000000 +0200 ++++ apache-tomcat-7.0.2-src/conf/tomcat-users.xml 2010-09-23 11:27:11.819276755 +0200 +@@ -23,4 +23,14 @@ + + + --> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + diff --git a/tomcat-7.0-tool-wrapper.script b/tomcat-7.0-tool-wrapper.script new file mode 100644 index 0000000..98b4ef6 --- /dev/null +++ b/tomcat-7.0-tool-wrapper.script @@ -0,0 +1,45 @@ +#!/bin/sh +# +# tomcat-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/tomcat/tomcat.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 tomcat/catalina servlet" + +# Set parameters +set_classpath $BASE_JARS +set_flags $BASE_FLAGS +set_options $BASE_OPTIONS + +# Let's start +run "$@" diff --git a/tomcat-7.0.2-property-build.windows.patch b/tomcat-7.0.2-property-build.windows.patch new file mode 100644 index 0000000..5b5f892 --- /dev/null +++ b/tomcat-7.0.2-property-build.windows.patch @@ -0,0 +1,23 @@ +Index: apache-tomcat-7.0.27-src/build.properties.default +=================================================================== +--- apache-tomcat-7.0.27-src.orig/build.properties.default 2012-03-31 16:46:49.000000000 +0200 ++++ apache-tomcat-7.0.27-src/build.properties.default 2012-06-13 13:56:38.272947593 +0200 +@@ -197,3 +197,5 @@ + dojo-js.loc=http://download.dojotoolkit.org/release-1.1.1/dojo-release-1.1.1.tar.gz + dojo-js.jar=${dojo-js.home}/dojo/dojo.js + ++# ----- Build on Windows ---- ++build.windows=false +Index: apache-tomcat-7.0.27-src/build.xml +=================================================================== +--- apache-tomcat-7.0.27-src.orig/build.xml 2012-03-31 16:46:49.000000000 +0200 ++++ apache-tomcat-7.0.27-src/build.xml 2012-06-13 13:56:38.274947593 +0200 +@@ -2341,7 +2341,7 @@ + + + ++ description="Download additional components for a distribution" if="${build.windows}"> + + + diff --git a/tomcat-7.0.conf b/tomcat-7.0.conf new file mode 100644 index 0000000..5ed858d --- /dev/null +++ b/tomcat-7.0.conf @@ -0,0 +1,56 @@ +# System-wide configuration file for tomcat services +# This will be sourced by tomcat and any secondary service + +# Where your java installation lives +JAVA_HOME="@@@JAVAHOME@@@" + +# 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/tomcat.pid" + +# Connector port is 8080 for this tomcat 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) + +# Clear work directory when tomcat is stopped or restarted +CLEAR_WORK="false" + +# Java runtime options used when the "start", or "run" command is executed +# Use # it if you want: +# Set a location of JAAS config file +# CATALINA_OPTS="-Djava.security.auth.login.config=$CATALINA_HOME/conf/jaas.config" +# To collect data on how long garbage collection is taking +# CATALINA_OPTS="-verbose:gc" +# Make jikes error messages compatible with jasper +# CATALINA_OPTS="-Dbuild.compiler.emacs=true" +# Debug the permission (WARNING - This will generate many megabytes of output!) +# CATALINA_OPTS="-Djava.security.debug=all" diff --git a/tomcat-7.0.init b/tomcat-7.0.init new file mode 100644 index 0000000..334d4c3 --- /dev/null +++ b/tomcat-7.0.init @@ -0,0 +1,388 @@ +#!/bin/bash +# Copyright (c) 2008 SuSE Linux AG Nuernberg, Germany. +# +# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot +# - heavily rewritten by Deepak Bhole and Jason Corley +# - merged with previous SUSE's rctomcat55 by Petr Mladek and jpackage.org +# original by Michal Vyskocil +# +# /etc/init.d/tomcat +# +# and its symbolic link +# +# /usr/sbin/rctomcat +# +# System startup script for the Tomcat servlet container +# +### BEGIN INIT INFO +# Provides: tomcat +# Required-Start: $network $syslog $remote_fs +# Should-Start: $named $syslog $time +# Required-Stop: $network $syslog $remote_fs +# Should-Stop: $named $syslog $time +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Tomcat Servlet Container +# Description: Start and Stop Apache Tomcat +### END INIT INFO + +# set a minimalist PATH +PATH="/bin:/sbin" + +# Source LSB function library. +if [ -r /lib/lsb/init-functions ]; then + . /lib/lsb/init-functions +else + exit 1 +fi +DISTRIB_ID=`lsb_release -i -s 2>/dev/null` + +NAME="$(basename $0)" +unset ISBOOT +if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then + NAME="${NAME:3}" + ISBOOT="1" +fi + +# remove SUSE's rc name +if [ "${NAME:0:2}" = "rc" ]; then + NAME="${NAME:2}" +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/tomcat/tomcat.conf" +if [ -r "$TOMCAT_CFG" ]; then + . $TOMCAT_CFG +fi + +# Define which connector port to use +CONNECTOR_PORT="${CONNECTOR_PORT:-8080}" + +# Path to the tomcat launch script +TOMCAT_SCRIPT="/usr/sbin/dtomcat" + +# Tomcat program name +TOMCAT_PROG="${NAME}" + +# Define the tomcat username +TOMCAT_USER="${TOMCAT_USER:-tomcat}" + +# Define the tomcat log file +TOMCAT_LOG="${TOMCAT_LOG:-${CATALINA_HOME}/logs/${NAME}-initd.log}" +# Define the tomcat pid file +export CATALINA_PID="/var/run/${NAME}.pid" + +RETVAL="0" + +# pulled from RHEL4 /etc/rc.d/init.d/functions +function checkpid() { + local i + for i in $* ; do + if [ -d "/proc/${i}" ]; then + return 0 + fi + done + return 1 +} + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_failed set local and overall rc status to failed +# rc_failed set local and overall rc status to +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status +. /etc/rc.status + +# First reset status of this service +rc_reset + +# Return values acc. to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - insufficient privilege +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running +# +# Note that starting an already running service, stopping +# or restarting a not-running service as well as the restart +# with force-reload (in case signalling is not supported) are +# considered a success. + +# 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/tomcat/* /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/tomcat ${CATALINA_HOME}/lib + ln -fs /usr/share/tomcat/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 ($CATALINA_BASE)" + if [ -f "/var/run/rc${NAME}" ] ; then + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + if checkpid $kpid 2>&1; then + echo "$NAME process already running" + rc_failed 0 + else + echo -n "lock file found but no process running for pid $kpid, continuing" + rc_failed 7 + 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/tomcat" ]; 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 + rc_failed 0 + touch /var/run/rc${NAME} + else + rc_failed 7 + fi + rc_status -v +} + +## Check status with checkproc(8), if process is running +## checkproc will return with exit status 0. + +# Status has a slightly different for the status command: +# 0 - service running +# 1 - service dead, but /var/run/ pid file exists +# 2 - service dead, but /var/lock/ lock file exists +# 3 - service not running + +# NOTE: checkproc returns LSB compliant status values. +function status() { + echo -n "Checking for Tomcat ($CATALINA_BASE)" + if [ -f "/var/run/${NAME}.pid" ]; then + read kpid < /var/run/${NAME}.pid + if checkpid $kpid 2>&1; then + rc_failed 0 + else + rc_failed 2 + fi + else + #don't be dependent on procps + #pid="$(/usr/bin/pgrep -u tomcat java)" + pid="$(ps U tomcat o pid,cmd | grep java | grep -v 'grep java')" + if [ -n "$pid" ]; then + echo "$0 running (${pid}) but no PID file exists" + rc_failed 0 + else + rc_failed 3 + fi + fi + rc_status -v +} + +function stop() { + echo -n "Shutting down Tomcat ($CATALINA_BASE)" + if [ -f "/var/run/rc${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" + echo -n -e "after " + echo -n "$SHUTDOWN_WAIT seconds" + fi + kill -9 $kpid + fi + rc_failed 0 + if [ "$count" -gt "0" ]; then + echo -n -e "\n" + fi + fi + rm -f /var/run/rc${NAME} /var/run/${NAME}.pid + if [ "${CLEAR_WORK}" = "true" ]; then + echo -n "Cleaning work directory: " + #rm -rf ${CATALINA_HOME}/work/* + find ${CATALINA_HOME}/work/ -maxdepth 1 -type 'd' \! -name 'Catalina' \! -name 'temp' -print0 | xargs -0 rm -rf + find ${CATALINA_HOME}/work/Catalina/ ${CATALINA_HOME}/work/temp/ -print0 | xargs -0 rm -rf + if [ "$?" -eq "0" ]; then + echo_success + echo -n -e "\n" + fi + fi + + else + rc_failed 1 + fi + fi + rc_status -v +} + + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + try-restart) + ## Stop the service and if this succeeds (i.e. the + ## service was running before), start it again. + ## Note: try-restart is not (yet) part of LSB (as of 0.7.5) + $0 status >/dev/null && $0 restart + + # Remember status and be quiet + rc_status + ;; + restart) + stop + sleep 2 + start + rc_status + ;; + force-reload) + ## Signal the daemon to reload its config. Most daemons + ## do this on signal 1 (SIGHUP). + ## If it does not support it, restart. + + echo -n "Reload service Tomcat $($CATALINA_BASE)" + ## if it supports it: + #killproc -HUP $TOMCAT_BIN + #touch /var/run/FOO.pid + #rc_status -v + + ## Otherwise: + $0 stop && $0 start + rc_status + ;; + reload) + ## Like force-reload, but if daemon does not support + ## signalling, do nothing (!) + + # If it supports signalling: + #echo -n "Reload service FOO" + #killproc -HUP $TOMCAT_BIN + #touch /var/run/FOO.pid + #rc_status -v + + ## Otherwise if it does not support reload: + rc_failed 3 + rc_status -v + ;; + status) + status + ;; + probe) + ## Optional: Probe for the necessity of a reload, + ## give out the argument which is required for a reload. + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" + exit 1 + ;; +esac +rc_exit diff --git a/tomcat-7.0.logrotate b/tomcat-7.0.logrotate new file mode 100644 index 0000000..55c8e0b --- /dev/null +++ b/tomcat-7.0.logrotate @@ -0,0 +1,8 @@ +@@@TCLOG@@@/catalina.out { + copytruncate + weekly + rotate 52 + compress + missingok + create 0644 tomcat tomcat +} diff --git a/tomcat-7.0.service b/tomcat-7.0.service new file mode 100644 index 0000000..9388905 --- /dev/null +++ b/tomcat-7.0.service @@ -0,0 +1,19 @@ +# Systemd unit file for tomcat +# +# To create clones of this service: +# 1) By default SERVICE_NAME=tomcat. When cloned, the value must be defined +# before tomcat-sysd is called. +# 2) Create /etc/sysconfig/${SERVICE_NAME} from /etc/sysconfig/tomcat +# to override tomcat defaults + +[Unit] +Description=Apache Tomcat Web Application Container +After=syslog.target network.target + +[Service] +Type=forking +ExecStart=/usr/sbin/tomcat-sysd start +ExecStop=/usr/sbin/tomcat-sysd stop + +[Install] +WantedBy=multi-user.target diff --git a/tomcat-7.0.wrapper b/tomcat-7.0.wrapper new file mode 100644 index 0000000..268fd35 --- /dev/null +++ b/tomcat-7.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/tomcat/tomcat.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 \ + -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/tomcat-api-OSGi-MANIFEST.MF b/tomcat-api-OSGi-MANIFEST.MF new file mode 100644 index 0000000..7c1a408 --- /dev/null +++ b/tomcat-api-OSGi-MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Export-Package: org.apache.tomcat;version="7.0.21" +Bundle-Vendor: %bundleProvider +Bundle-ClassPath: . +Bundle-Version: 7.0.21 +Bundle-Name: %bundleName +Bundle-Localization: plugin +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.apache.tomcat +Bundle-RequiredExecutionEnvironment: J2SE-1.4,CDC-1.0/Foundation-1.0,J + 2SE-1.3 + diff --git a/tomcat-juli-OSGi-MANIFEST.MF b/tomcat-juli-OSGi-MANIFEST.MF new file mode 100644 index 0000000..fcd349b --- /dev/null +++ b/tomcat-juli-OSGi-MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Export-Package: org.apache.juli;version="7.0.21",org.apache.juli.loggi + ng;version="7.0.21" +Bundle-Vendor: %bundleProvider +Bundle-ClassPath: . +Bundle-Version: 7.0.21 +Bundle-Name: %bundleName +Bundle-Localization: plugin +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.apache.juli +Bundle-RequiredExecutionEnvironment: J2SE-1.4,CDC-1.0/Foundation-1.0,J + 2SE-1.3 + diff --git a/tomcat-rpmlintrc b/tomcat-rpmlintrc new file mode 100644 index 0000000..4bd312f --- /dev/null +++ b/tomcat-rpmlintrc @@ -0,0 +1,2 @@ +s is OK - fix of bnc#520532 +addFilter(".*non-etc-or-var-file-marked-as-conffile /srv/tomcat6/webapps/ROOT.*") diff --git a/tomcat.changes b/tomcat.changes new file mode 100644 index 0000000..6ddb3de --- /dev/null +++ b/tomcat.changes @@ -0,0 +1,51 @@ +------------------------------------------------------------------- +Wed Jun 13 12:37:49 UTC 2012 - mvyskocil@suse.cz + +- update to 7.0.26 (bugfix release) +- rename package to tomcat in order to emphasise a fact, there is only one + major release of tomcat maintained in distribution +- add manifest files and systemd support (thanks Fedora) +- create tomcat-jsvc package + +------------------------------------------------------------------- +Thu Feb 23 13:59:10 UTC 2012 - mvyskocil@suse.cz + +- update to 7.0.26 (bugfix release) +- fix bnc#747771 - don't use /var/lock/subsys + sync tomcat7 init with tomcat6 + +------------------------------------------------------------------- +Sun Feb 19 23:02:42 UTC 2012 - wittemar@googlemail.com + +- update to 7.0.25 (bugfix release) + +------------------------------------------------------------------- +Tue Nov 1 12:36:57 UTC 2011 - mvyskocil@suse.cz + +- update to 7.0.22 (bugfix release) +- wrote changes and prepare for inclusion to openSUSE distribution +- fix bnc#726307 + /etc/tomcat7 is writtable for tomcat group + +------------------------------------------------------------------- +Mon Sep 19 10:21:29 UTC 2011 - wittemar@googlemail.com + + - update to version 7.0.21 + +------------------------------------------------------------------- +Thu Jul 21 10:21:29 UTC 2011 - mvyskocil@suse.cz + + - update to version 7.0.16 (bugfix update) + +------------------------------------------------------------------- +Wed Mar 30 16:29:28 UTC 2011 - jrenner@suse.de + + - add rpmlintrc, digest, init and wrapper scripts and config file + - build require geronimo apis and wsdl4j + - disable webservices in javadoc target + +------------------------------------------------------------------- +Tue Jan 18 12:22:55 UTC 2011 - mvyskocil@suse.cz + + - initial packaging of tomcat7 7.0.6 + diff --git a/tomcat.spec b/tomcat.spec new file mode 100644 index 0000000..5bea3a1 --- /dev/null +++ b/tomcat.spec @@ -0,0 +1,719 @@ +# +# spec file for package tomcat +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2000-2009, JPackage Project +# All rights reserved. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +%define jspspec 2.2 +%define servletspec 3.0 +%define elspec 2.2 + +%define major_version 7 +%define minor_version 0 +%define micro_version 27 + +%define packdname apache-tomcat-%{version}-src +%define tcuid 91 +# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/ +%define appdir /srv/%{name}/webapps +%define bindir %{_datadir}/%{name}/bin +%define confdir %{_sysconfdir}/%{name} +%define homedir %{_datadir}/%{name} +%define libdir %{_javadir}/%{name} +%define logdir %{_localstatedir}/log/%{name} +%define cachedir %{_localstatedir}/cache/%{name} +%define tempdir %{cachedir}/temp +%define workdir %{cachedir}/work +%define _initrddir %{_sysconfdir}/init.d +%define _systemddir /lib/systemd/system + +Name: tomcat +Version: %{major_version}.%{minor_version}.%{micro_version} +Release: 0 +Summary: Apache Servlet/JSP Engine, RI for Servlet 3.0/JSP 2.2 API +License: Apache-2.0 +Group: Productivity/Networking/Web/Servers +Url: http://tomcat.apache.org + +Source0: http://www.apache.org/dist/tomcat/tomcat-%{major_version}/v%{version}/src/%{packdname}.tar.gz +Source1: %{name}-%{major_version}.%{minor_version}.conf +Source2: %{name}-%{major_version}.%{minor_version}.init +# sysconfig removal - bnc#471639 +#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 +Source8: servlet-api-OSGi-MANIFEST.MF +Source9: jsp-api-OSGi-MANIFEST.MF +Source10: %{name}-%{major_version}.%{minor_version}-log4j.properties +Source11: %{name}-%{major_version}.%{minor_version}.service +Source12: el-api-OSGi-MANIFEST.MF +Source13: jasper-el-OSGi-MANIFEST.MF +Source14: jasper-OSGi-MANIFEST.MF +Source15: tomcat-api-OSGi-MANIFEST.MF +Source16: tomcat-juli-OSGi-MANIFEST.MF +Source17: %{name}-%{major_version}.%{minor_version}-tomcat-sysd +Source18: %{name}-%{major_version}.%{minor_version}-tomcat-jsvc-sysd +Source19: %{name}-%{major_version}.%{minor_version}-jsvc.wrapper +Source20: %{name}-%{major_version}.%{minor_version}-jsvc.service +Source1000: tomcat-rpmlintrc + +#PATCH-FIX-UPSTREAM: from jpackage.org package +Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch +#PATCH-FIX-UPSTREAM: from jpackage.org package +Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch +#PATCH-FIX-OPENSUSE: skip few windows specific parts of build +Patch2: tomcat-7.0.2-property-build.windows.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildArch: noarch + +BuildRequires: ant +BuildRequires: ecj >= 3.2.2 +BuildRequires: fdupes +BuildRequires: findutils +BuildRequires: geronimo-jaf-1_0_2-api +BuildRequires: jakarta-commons-collections +BuildRequires: jakarta-commons-daemon +BuildRequires: jakarta-commons-dbcp +BuildRequires: jakarta-commons-pool +BuildRequires: jakarta-taglibs-standard >= 1.1 +BuildRequires: java-devel >= 1.6.0 +BuildRequires: jpackage-utils >= 1.7.0 +BuildRequires: junit +BuildRequires: sed +BuildRequires: unzip +BuildRequires: zip +#BuildRequires: geronimo-j2ee-1_4-apis +BuildRequires: geronimo-jaxrpc-1_1-api +BuildRequires: geronimo-qname-1_1-api +BuildRequires: geronimo-saaj-1_1-api +BuildRequires: log4j +BuildRequires: wsdl4j +%if 0%{?suse_version} > 1140 +BuildRequires: systemd +%endif + +Recommends: libtcnative-1-0 +Recommends: logrotate + +Requires(pre): %{_sbindir}/groupadd +Requires(pre): %{_sbindir}/useradd +Requires: %{name}-lib = %{version}-%{release} +Requires: jakarta-commons-daemon +Requires: jakarta-commons-dbcp +Requires: jakarta-commons-logging +Requires: jakarta-commons-pool +%{?systemd_requires} +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig + +%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 +Summary: The host-manager and manager web applications for Apache Tomcat +Group: Productivity/Networking/Web/Servers +Requires: %{name} = %{version}-%{release} + +%description admin-webapps +The host-manager and manager web applications for Apache Tomcat. + + + +%package docs-webapp +Summary: The docs web application for Apache Tomcat +Group: Productivity/Networking/Web/Servers +Requires: %{name} = %{version}-%{release} + +%description docs-webapp +The docs web application for Apache Tomcat. + +%package el-2_2-api +Summary: Expression Language v2.2 API +Group: Development/Libraries/Java +Provides: %{name}-el-%{elspec}-api = %{version}-%{release} +Provides: el_2_2_api = %{version}-%{release} +Provides: el_api = %{elspec} +Requires(preun):%{_sbindir}/update-alternatives +Requires(post): %{_sbindir}/update-alternatives + +%description el-2_2-api +Expression Language 2.2. + + +%package javadoc +Summary: Javadoc generated documentation for Apache Tomcat +Group: Productivity/Networking/Web/Servers + +%description javadoc +Javadoc generated documentation for Apache Tomcat. + + + +%package jsp-2_2-api +Summary: Apache Tomcat JSP API implementation classes +Group: Productivity/Networking/Web/Servers +Provides: %{name}-jsp-%{jspspec}-api +Provides: jsp = %{jspspec} +Provides: jsp22 +Requires: %{name}-servlet-%{servletspec}-api = %{version}-%{release} +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives + +%description jsp-2_2-api +Apache Tomcat JSP API implementation classes + +%package jsvc +Summary: Apache jsvc wrapper for Apache Tomcat as separate service +Group: Productivity/Networking/Web/Servers +Requires: %{name} = %{version}-%{release} +Requires: apache-commons-daemon-jsvc + +%description jsvc +Systemd service and wrapper scripts to start tomcat with jsvc, +which allows tomcat to perform some privileged operations +(e.g. bind to a port < 1024) and then switch identity to a non-privileged user. + + +%package lib +Summary: Libraries needed to run the Tomcat Web container +Group: Productivity/Networking/Web/Servers +Requires: %{name}-el-%{elspec}-api = %{version}-%{release} +Requires: %{name}-jsp-%{jspspec}-api = %{version}-%{release} +Requires: %{name}-servlet-%{servletspec}-api = %{version}-%{release} +Requires(post): ecj >= 3.2.2 +Requires(post): jakarta-commons-collections-tomcat5 +Requires(post): jakarta-commons-dbcp-tomcat5 +Requires(post): jakarta-commons-pool-tomcat5 +Requires(preun):%{__rm} + +%description lib +Libraries needed to run the Tomcat Web container + + + +%package servlet-3_0-api +Summary: Apache Tomcat Servlet API implementation classes +Group: Productivity/Networking/Web/Servers +Provides: %{name}-servlet-%{servletspec}-api = %{version}-%{release} +Provides: servlet = %{servletspec} +Provides: servlet30 +Provides: servlet7 +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives + +%description servlet-3_0-api +Apache Tomcat Servlet API implementation classes + + + +%package webapps +Summary: The ROOT and examples web applications for Apache Tomcat +Group: Productivity/Networking/Web/Servers +Requires: %{name} = %{version}-%{release} +Requires(post): jakarta-taglibs-standard >= 1.1 + +%description webapps +The ROOT and examples web applications for Apache Tomcat + + + +%prep +%setup -q -n %{packdname} +# remove pre-built binaries and windows files +find . -type f \( -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 -p1 +%patch1 -p1 +%patch2 -p1 + +%build +%{__ln_s} $(build-classpath jakarta-taglibs-core) webapps/examples/WEB-INF/lib/jstl.jar +%{__ln_s} $(build-classpath jakarta-taglibs-standard) webapps/examples/WEB-INF/lib/standard.jar + +export CLASSPATH= +export OPT_JAR_LIST="xalan-j2-serializer" +export ANT_OPTS=-Xmx500M + +# 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 +%{__mkdir_p} HACKDIR +touch HACKDIR/build.xml + +%{ant} -Dbase.path="." \ + -Dbuild.compiler="modern" \ + -Dcommons-collections.jar="$(build-classpath commons-collections)" \ + -Dcommons-daemon.jar="$(build-classpath commons-daemon)" \ + -Dcommons-daemon.native.src.tgz="HACK" \ + -Djasper-jdt.jar="$(build-classpath ecj)" \ + -Djdt.jar="$(build-classpath ecj)" \ + -Dtomcat-dbcp.jar="HACK" \ + -Dtomcat-native.tar.gz="HACK" \ + -Dtomcat-native.home="." \ + -Dcommons-daemon.native.win.mgr.exe="HACK" \ + -Dnsis.exe="HACK" \ + -Djaxrpc-lib.jar="$(build-classpath jaxrpc)" \ + -Dwsdl4j-lib.jar="$(build-classpath wsdl4j)" \ + -Dcommons-pool.home="HACKDIR" \ + -Dcommons-dbcp.home="HACKDIR" \ + -Dno.build.dbcp=true \ + -Dversion="%{version}" \ + -Dversion.build="%{micro_version}" \ + deploy dist-prepare dist-source javadoc + +# remove some jars that we'll replace with symlinks later +%{__rm} output/build/bin/commons-daemon.jar \ + output/build/lib/ecj.jar +# remove the cruft we created +%{__rm} output/build/bin/tomcat-native.tar.gz + +pushd 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 + +# inject OSGi manifests +mkdir -p META-INF +cp -p %{SOURCE8} META-INF/MANIFEST.MF +touch META-INF/MANIFEST.MF +zip -u output/build/lib/servlet-api.jar META-INF/MANIFEST.MF +cp -p %{SOURCE9} META-INF/MANIFEST.MF +touch META-INF/MANIFEST.MF +zip -u output/build/lib/jsp-api.jar META-INF/MANIFEST.MF +cp -p %{SOURCE12} META-INF/MANIFEST.MF +touch META-INF/MANIFEST.MF +zip -u output/build/lib/el-api.jar META-INF/MANIFEST.MF +cp -p %{SOURCE13} META-INF/MANIFEST.MF +touch META-INF/MANIFEST.MF +zip -u output/build/lib/jasper-el.jar META-INF/MANIFEST.MF +cp -p %{SOURCE14} META-INF/MANIFEST.MF +touch META-INF/MANIFEST.MF +zip -u output/build/lib/jasper.jar META-INF/MANIFEST.MF +cp -p %{SOURCE15} META-INF/MANIFEST.MF +touch META-INF/MANIFEST.MF +zip -u output/build/lib/tomcat-api.jar META-INF/MANIFEST.MF +cp -p %{SOURCE16} META-INF/MANIFEST.MF +touch META-INF/MANIFEST.MF +zip -u output/build/bin/tomcat-juli.jar META-INF/MANIFEST.MF + +%install +# 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} +%if 0%{?suse_version} > 1140 +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_systemddir} +%endif +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name} +# sysconfig removal +# % {__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}%{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 0775 ${RPM_BUILD_ROOT}%{workdir} +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{cachedir}/Catalina/localhost +%if 0%{?suse_version} > 1140 +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_unitdir} +%endif + +# move things into place +# First copy supporting libs to tomcat lib +pushd output/build + %{__cp} -a bin/*.{jar,xml} ${RPM_BUILD_ROOT}%{bindir} + %{__cp} %{SOURCE10} conf/log4j.properties + %{__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 + +# javadoc +%{__cp} -a output/dist/webapps/docs/api/* ${RPM_BUILD_ROOT}%{_javadocdir}/%{name} + +%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ + -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ + -e "s|\@\@\@JAVAHOME\@\@\@|/etc/alternatives/jre|g" \ + -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE1} \ + > ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf +# sysconfig removal +# % {__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ +# -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" %{SOURCE3} \ +# > ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name} +%{__install} -m 0755 %{SOURCE2} \ + ${RPM_BUILD_ROOT}%{_initrddir}/%{name} +%{__install} -m 0755 %{SOURCE4} \ + ${RPM_BUILD_ROOT}%{_sbindir}/d%{name} +# % {__ln_s} %{name} ${RPM_BUILD_ROOT}%{_sbindir}/d%{name} +%if 0%{?suse_version} > 1140 +%{__install} -m 0644 %{SOURCE11} \ + ${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service +%{__install} -m 0644 %{SOURCE17} \ + ${RPM_BUILD_ROOT}%{_sbindir}/%{name}-sysd +%endif +%{__install} -m 0644 %{SOURCE19} \ + ${RPM_BUILD_ROOT}%{_sbindir}/%{name}-jsvc +%if 0%{?suse_version} > 1140 +%{__install} -m 0644 %{SOURCE20} \ + ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-jsvc.service +%{__install} -m 0644 %{SOURCE18} \ + ${RPM_BUILD_ROOT}%{_sbindir}/%{name}-jsvc-sysd +%endif +%{__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 and el API symlinks +pushd ${RPM_BUILD_ROOT}%{_javadir} + %{__mv} %{name}/jsp-api.jar %{name}-jsp-%{jspspec}-api.jar + %{__ln_s} %{name}-jsp-%{jspspec}-api.jar %{name}-jsp-api.jar + %{__mv} %{name}/servlet-api.jar %{name}-servlet-%{servletspec}-api.jar + %{__ln_s} %{name}-servlet-%{servletspec}-api.jar %{name}-servlet-api.jar + %{__mv} %{name}/el-api.jar %{name}-el-%{elspec}-api.jar + %{__ln_s} %{name}-el-%{elspec}-api.jar %{name}-el-api.jar +popd + +pushd output/build + %{_bindir}/build-jar-repository lib commons-collections \ + commons-dbcp commons-pool ecj 2>&1 + # need to use -p here with b-j-r otherwise the examples webapp fails to + # load with a java.io.IOException + %{_bindir}/build-jar-repository -p webapps/examples/WEB-INF/lib \ + taglibs-core.jar taglibs-standard.jar 2>&1 +popd + +pushd ${RPM_BUILD_ROOT}%{libdir} + # symlink JSP and servlet and el API jars + %{__ln_s} ../%{name}-jsp-%{jspspec}-api.jar . + %{__ln_s} ../%{name}-servlet-%{servletspec}-api.jar . + %{__ln_s} ../%{name}-el-%{elspec}-api.jar . + %{__ln_s} $(build-classpath commons-collections) commons-collections.jar + %{__ln_s} $(build-classpath commons-dbcp) commons-dbcp.jar + %{__ln_s} $(build-classpath log4j) log4j.jar + %{__ln_s} $(build-classpath ecj) jasper-jdt.jar + + # Temporary copy the juli jar here from /usr/share/java/tomcat (for maven depmap) + %{__cp} -a ${RPM_BUILD_ROOT}%{bindir}/tomcat-juli.jar ./ +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 + +# Install the maven metadata +%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_mavenpomdir} +pushd output/dist/src/res/maven +for pom in *.pom; do + # fix-up version in all pom files + sed -i 's/@MAVEN.DEPLOY.VERSION@/%{version}/g' $pom +done + +# we won't install dbcp, juli-adapters and juli-extras pom files +for libname in annotations-api catalina jasper-el jasper catalina-ha; do + %{__cp} -a %{name}-$libname.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-$libname.pom + %add_maven_depmap JPP.%{name}-$libname.pom %{name}/$libname.jar +done + +# servlet-api jsp-api and el-api are not in tomcat subdir, since they are widely re-used elsewhere +%{__cp} -a tomcat-jsp-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-jsp-api.pom +%add_maven_depmap JPP-tomcat-jsp-api.pom tomcat-jsp-api.jar -f "tomcat-jsp-api" -a "javax.servlet.jsp:javax.servlet.jsp-api,javax.servlet:jsp-api" + +%{__cp} -a tomcat-el-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-el-api.pom +%add_maven_depmap JPP-tomcat-el-api.pom tomcat-el-api.jar -f "tomcat-el-api" -a "javax.el:javax.el-api,javax.el:el-api" + +%{__cp} -a tomcat-servlet-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-servlet-api.pom +# Generate a depmap fragment javax.servlet:servlet-api pointing to +# tomcat-servlet-3.0-api for backwards compatibility +# also provide jetty depmap (originally in jetty package, but it's cleaner to have it here +%add_maven_depmap JPP-tomcat-servlet-api.pom tomcat-servlet-api.jar -f "tomcat-servlet-api" -a "javax.servlet:servlet-api,javax.servlet:javax.servlet-api,org.mortbay.jetty:servlet-api" + +# two special pom where jar files have different names +%{__cp} -a tomcat-tribes.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-catalina-tribes.pom +%add_maven_depmap JPP.%{name}-catalina-tribes.pom %{name}/catalina-tribes.jar + +%{__cp} -a tomcat-juli.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-juli.pom +%add_maven_depmap JPP.%{name}-tomcat-juli.pom %{name}/tomcat-juli.jar + +%{__cp} -a tomcat-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-api.pom +%add_maven_depmap JPP.%{name}-tomcat-api.pom %{name}/tomcat-api.jar + +%{__cp} -a tomcat-util.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-util.pom +%add_maven_depmap JPP.%{name}-tomcat-util.pom %{name}/tomcat-util.jar + +# replace temporary copy with link +%{__ln_s} -f %{bindir}/tomcat-juli.jar ${RPM_BUILD_ROOT}%{libdir}/ + +%if %defined suse_version +# bnc#424675 +%{__ln_s} %{cachedir}/Catalina ${RPM_BUILD_ROOT}/%{confdir} +%{__rm} -rf %{buildroot}/%{confdir}/Catalina +%{__ln_s} %{cachedir}/Catalina ${RPM_BUILD_ROOT}/%{confdir}/ + +# bnc#418664 +install -d -m 0755 ${RPM_BUILD_ROOT}/%{_sysconfdir}/ant.d/ +echo "%{name}/catalina-ant" > ${RPM_BUILD_ROOT}/%{_sysconfdir}/ant.d/catalina-ant +%fdupes $RPM_BUILD_ROOT /srv/%{name} +install -d -m 755 $RPM_BUILD_ROOT/%{_sbindir} +ln -sf %{_initrddir}/%{name} $RPM_BUILD_ROOT/%{_sbindir}/rc%{name} +#bnc#565901 +ln -sf %{_sbindir}/d%{name} %{buildroot}/%{bindir}/catalina.sh +%endif + +%clean +%{__rm} -rf $RPM_BUILD_ROOT + +%pre +# add the tomcat user and group +%{_sbindir}/groupadd -r tomcat 2>/dev/null || : +%{_sbindir}/useradd -c "Apache Tomcat" -g tomcat \ + -s /bin/sh -r -d %{homedir} tomcat 2>/dev/null || : +%if 0%{?suse_version} > 1140 +%service_add_pre %{name}.service +%endif + +%post +%{fillup_and_insserv -f %{name}} +%if 0%{?suse_version} > 1140 +%service_add_post %{name}.service +%endif + +%preun +# clean tempdir and cachedir on removal or upgrade +## % {__rm} -rf %{workdir}/* %{tempdir}/* +%stop_on_removal %{name} +%if 0%{?suse_version} > 1140 +%service_del_preun %{name}.service +%endif + +%postun +%insserv_cleanup +%restart_on_update %{name} +%if 0%{?suse_version} > 1140 +%service_del_postun %{name}.service +%endif + +%post el-2_2-api +%{_sbindir}/update-alternatives --install %{_javadir}/el_api.jar el_api %{_javadir}/%{name}-el-%{elspec}-api.jar 20300 +%{_sbindir}/update-alternatives --install %{_javadir}/el_1_0_api.jar el_1_0_api %{_javadir}/%{name}-el-%{elspec}-api.jar 20300 + +%preun el-2_2-api +if [ "$1" = "0" ]; then + %{_sbindir}/update-alternatives --remove el_api %{_javadir}/%{name}-el-%{elspec}-api.jar + %{_sbindir}/update-alternatives --remove el_1_0_api %{_javadir}/%{name}-el-%{elspec}-api.jar +fi + +%post jsp-2_2-api +%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \ + %{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20200 + +%postun jsp-2_2-api +if [ "$1" = "0" ]; then + %{_sbindir}/update-alternatives --remove jsp \ + %{_javadir}/%{name}-jsp-%{jspspec}-api.jar +fi + +%post servlet-3_0-api +%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \ + %{_javadir}/%{name}-servlet-%{servletspec}-api.jar 30000 + +%postun servlet-3_0-api +if [ "$1" = "0" ]; then + %{_sbindir}/update-alternatives --remove servlet \ + %{_javadir}/%{name}-servlet-%{servletspec}-api.jar +fi + +%post lib +# HACK! The commons-dbcp-tomcat5 needs the tomcat-lib to build, but tomcat +# needs this only as post/un dependency to create a symlink, not for build of +# itself. This is mainly for succesfully build, in the production case it +# should not happen! +build-jar-repository %{libdir} \ + commons-collections-tomcat5 \ + commons-dbcp-tomcat5 \ + commons-pool-tomcat5 \ + ecj 2>&1 || exit 0 + +%preun lib +if [ "$1" = "0" ]; then + %{__rm} -f \ + %{libdir}/\[commons-collections-tomcat5\].jar \ + %{libdir}/\[commons-dbcp-tomcat5\].jar \ + %{libdir}/\[commons-pool-tomcat5\].jar \ + %{libdir}/\[ecj\].jar >/dev/null 2>&1 +fi + +%files +%defattr(0644,root,root,0755) +%doc {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} +%if 0%{?suse_version} > 1140 +%attr(0644,root,root) %{_unitdir}/%{name}.service +%attr(0755,root,root) %{_sbindir}/%{name}-sysd +%endif +%attr(0755,root,root) %{_initrddir}/%{name} +#bnc#565901 +%attr(0755,root,root) %{bindir}/catalina.sh +%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +# sysconfig removal +# % config(noreplace) %{_sysconfdir}/sysconfig/%{name} +# bnc#726307 +%attr(0775,root,tomcat) %dir %{confdir} +%attr(0775,root,tomcat) %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 +%config(noreplace) %{confdir}/web.xml +%verify (not user group) %attr(0660,tomcat,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml +%dir %{homedir} +%dir %{bindir} +%{bindir}/bootstrap.jar +%{bindir}/catalina-tasks.xml +%{homedir}/lib +%{homedir}/temp +%{homedir}/webapps +%{homedir}/work +%{homedir}/logs +%{homedir}/conf +%dir /srv/%{name} +%{_sbindir}/rc%{name} +%{confdir}/Catalina +# tomcat group writtable dirs - bnc#625415 +%defattr(0664,root,tomcat,0775) +%verify (not user group) %dir %{appdir} +%verify (not user group) %{logdir} +%verify (not user group) %{cachedir} + +%files admin-webapps +%defattr(0644,root,root,0755) +%{appdir}/host-manager +%{appdir}/manager + +%files docs-webapp +%defattr(0644,root,root,0755) +%doc %{appdir}/docs + +%files el-2_2-api +%defattr(0644,root,root,0755) +%{_javadir}/%{name}-el-%{elspec}-api.jar +%{_javadir}/%{name}-el-api.jar +%{libdir}/%{name}-el-%{elspec}-api.jar +%{_mavenpomdir}/JPP-%{name}-el-api.pom +%{_mavendepmapfragdir}/%{name}-tomcat-el-api + +%files javadoc +%defattr(0644,root,root,0755) +%doc %{_javadocdir}/%{name} + +%files jsp-2_2-api +%defattr(0644,root,root,0755) +%{_javadir}/%{name}-jsp-%{jspspec}-api.jar +%{_javadir}/%{name}-jsp-api.jar +# % ghost %{_javadir}/jsp.jar +%{_mavenpomdir}/JPP-%{name}-jsp-api.pom +%{_mavendepmapfragdir}/%{name}-tomcat-jsp-api + +%files lib +%defattr(0644,root,root,0755) +%{libdir} +%dir %{bindir} +%{bindir}/tomcat-juli.jar +%{_mavendepmapfragdir}/%{name} +%{_mavenpomdir}/JPP.%{name}-annotations-api.pom +%{_mavenpomdir}/JPP.%{name}-catalina-ha.pom +%{_mavenpomdir}/JPP.%{name}-catalina-tribes.pom +%{_mavenpomdir}/JPP.%{name}-catalina.pom +%{_mavenpomdir}/JPP.%{name}-jasper-el.pom +%{_mavenpomdir}/JPP.%{name}-jasper.pom +%{_mavenpomdir}/JPP.%{name}-tomcat-api.pom +%{_mavenpomdir}/JPP.%{name}-tomcat-juli.pom +%{_mavenpomdir}/JPP.%{name}-tomcat-util.pom +%exclude %{libdir}/%{name}-el-%{elspec}-api.jar +# bnc#418664 +%config(noreplace) %{_sysconfdir}/ant.d + +%files servlet-3_0-api +%defattr(0644,root,root,0755) +%doc LICENSE +%{_javadir}/%{name}-servlet-%{servletspec}-api.jar +%{_javadir}/%{name}-servlet-api.jar +# % ghost %{_javadir}/servlet.jar +%{_mavendepmapfragdir}/%{name}-tomcat-servlet-api +%{_mavenpomdir}/JPP-%{name}-servlet-api.pom + +%files webapps +%defattr(0644,root,root,0755) +#bnc#520532 +%config(noreplace) %{appdir}/ROOT +%{appdir}/examples +%{appdir}/sample + +%files jsvc +%defattr(755,root,root,0755) +%{_sbindir}/%{name}-jsvc +%if 0%{?suse_version} > 1140 +%{_sbindir}/%{name}-jsvc-sysd +%attr(0644,root,root) %{_unitdir}/%{name}-jsvc.service +%endif + +%changelog