File tomcat6.spec of Package tomcat6.import5619
#
# spec file for package tomcat6
#
# 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 section free
%define jspspec 2.1
%define major_version 6
%define minor_version 0
%define micro_version 32
%define packdname apache-tomcat-%{version}-src
%define servletspec 2.5
%define elspec 1.0
%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
Name:           tomcat6
Version:        %{major_version}.%{minor_version}.%{micro_version}
Release:        7.<RELEASE12>
Summary:        Apache Servlet/JSP Engine, RI for Servlet 2.5/JSP 2.1 API
Group:          Productivity/Networking/Web/Servers
License:        Apache Software License ..
Url:            http://tomcat.apache.org
Source0:        http://www.apache.org/dist/tomcat/tomcat-6/v%{version}/src/%{packdname}.tar.bz2
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:        %{name}-%{major_version}.%{minor_version}.starter
#bnc#653586: offline jasper compiler for spacewalk - rewritten from tomcat5.5/jasper/bin
Source100:      tomcat6-6.0.jasper.sh
Source101:      tomcat6-6.0.jspc
Source1000:     tomcat6-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-UPSTREAM: http://svn.apache.org/viewvc?view=revision&revision=1140071
Patch2:         apache-tomcat-CVE-2011-2204.patch
#PATCH-FIX-UPSTREAM: http://svn.apache.org/viewvc?view=revision&revision=1146703
Patch3:         apache-tomcat-CVE-2011-2526.patch
#PATCH-FIX-UPSTREAM: http://svn.apache.org/viewvc?view=revision&revision=1162959
Patch4:         apache-tomcat-CVE-2011-3190.patch
# PATCH-FIX-UPSTREAM: http://svn.apache.org/viewvc?view=revision&revision=1140904
# add getCharset method for B2CConverter expected by parameter-processing patch
Patch5:         apache-tomcat-get-charset.patch
# PATCH-FIX-UPSTREAM: http://svn.apache.org/viewvc?view=revision&revision=1199122
# add isConfigProblemFatal method expected by parameter-processing patch
Patch6:         apache-tomcat-isconfigproblemfatal.patch
#PATCH-FIX-UPSTREAM: http://svn.apache.org/viewvc?view=revision&revision=1200601
Patch7:         apache-tomcat-parameter-processing-performance.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
BuildRequires:  ant
BuildRequires:  ant-trax
BuildRequires:  ecj >= 3.2.2
BuildRequires:  findutils
BuildRequires:  jakarta-commons-collections
BuildRequires:  jakarta-commons-daemon
BuildRequires:  java-devel >= 1.6.0
BuildRequires:  jpackage-utils >= 1.7.0
BuildRequires:  junit
BuildRequires:  sed
%if %defined suse_version
BuildRequires:  unzip
BuildRequires:  jakarta-taglibs-standard >= 1.1
BuildRequires:  fdupes
Requires(pre):  jpackage-utils
Recommends:     libtcnative-1-0
Recommends:     logrotate
%endif
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
Requires:       jakarta-commons-daemon
Requires:       jakarta-commons-logging
Requires:       %{name}-lib = %{version}-%{release}
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(post): findutils
Requires(post): coreutils
# bnc#712784 - we need java and javac (for jsps)
# to have a possibility use tomcat with third-party java
# let's use recommends instead
Recommends:     java >= 1.6.0
Recommends:     java-devel >= 1.6.0
%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
License:        Apache Software License ..
Group:          Productivity/Networking/Web/Servers
Summary:        The host-manager and manager web applications for Apache Tomcat
Requires:       %{name} = %{version}-%{release}
%description admin-webapps
The host-manager and manager web applications for Apache Tomcat.
%package docs-webapp
License:        Apache Software License ..
Group:          Productivity/Networking/Web/Servers
Summary:        The docs web application for Apache Tomcat
Requires:       %{name} = %{version}-%{release}
%description docs-webapp
The docs web application for Apache Tomcat.
%package el-1_0-api
License:        Apache Software License ..
Summary:        Expression Language v1.0 API
Group:          Development/Libraries/Java
Provides:       %{name}-el-%{elspec}-api = %{version}-%{release}
Provides:       el_1_0_api = %{version}-%{release}
Provides:       el_api = 1.0
Requires(preun):%{_sbindir}/update-alternatives
Requires(post): %{_sbindir}/update-alternatives
%description el-1_0-api
Expression Language 1.0.
%package javadoc
License:        Apache Software License ..
Group:          Productivity/Networking/Web/Servers
Summary:        Javadoc generated documentation for Apache Tomcat
%description javadoc
Javadoc generated documentation for Apache Tomcat.
%package jsp-2_1-api
License:        Apache Software License ..
Group:          Productivity/Networking/Web/Servers
Summary:        Apache Tomcat JSP API implementation classes
Provides:       jsp = %{jspspec}
Provides:       jsp21
Provides:       %{name}-jsp-2.1-api
Requires:       %{name}-servlet-2_5-api = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description jsp-2_1-api
Apache Tomcat JSP API implementation classes
%package lib
License:        Apache Software License ..
Group:          Productivity/Networking/Web/Servers
Summary:        Libraries needed to run the Tomcat Web container
Requires:       %{name}-jsp-2_1-api = %{version}-%{release}
Requires:       %{name}-servlet-2_5-api = %{version}-%{release}
Requires:       %{name}-el-%{elspec}-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-2_5-api
License:        Apache Software License ..
Group:          Productivity/Networking/Web/Servers
Summary:        Apache Tomcat Servlet API implementation classes
Provides:       %{name}-servlet-2.5-api
Provides:       servlet = %{servletspec}
Provides:       servlet6
Provides:       servlet25
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description servlet-2_5-api
Apache Tomcat Servlet API implementation classes
%package webapps
License:        Apache Software License ..
Group:          Productivity/Networking/Web/Servers
Summary:        The ROOT and examples web applications for Apache Tomcat
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}
%patch0 -p1
%patch1 -p0
%patch2 -p1 -b .CVE-2011-2204
%patch3 -p1 -b .CVE-2011-2526
%patch4 -p1 -b .CVE-2011-3190
%patch5 -p1
%patch6 -p1
%patch7 -p1
%build
export CLASSPATH=
export OPT_JAR_LIST="ant/ant-trax"
# remove pre-built binaries and windows files
find . \( -name "*.bat" -o -name "*.class" -o -name "*.gz" -o \
            -name "*.jar" -o -name "*.zip" \) | xargs -t %{__rm} -f
# 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
%if %defined suse_version
export CLASSPATH="$(build-classpath xalan-j2-serializer)"
export ANT_OPTS=-Xmx500M
%endif
# 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.native.src.tgz="HACK" \
    -Djasper-jdt.jar="$(build-classpath ecj)" \
    -Djdt.jar="$(build-classpath ecj)" \
    -Dtomcat-dbcp.jar="HACK" \
    -Dtomcat-native.tar.gz="HACK" \
    -Dversion="%{version}" \
    -Dversion.build="%{micro_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/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
%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}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}
%if ! %defined suse_version
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
%endif
%{__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 0755 ${RPM_BUILD_ROOT}%{cachedir}/Catalina/localhost
# move things into place
pushd 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
# javadoc
pushd output/dist/webapps
    %{__cp} -a docs/api/* ${RPM_BUILD_ROOT}%{_javadocdir}/%{name}
popd
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
         -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" %{SOURCE1} \
%if %defined suse_version
         -e "s|\@\@\@JAVAHOME\@\@\@|/etc/alternatives/jre|g" \
%endif
    > ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf
# bnc#471639
%if ! %defined suse_version
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
         -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" %{SOURCE3} \
    > ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}
%endif
%{__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}
%{__install} -m 0755 %{SOURCE8} \
    ${RPM_BUILD_ROOT}%{_sbindir}/%{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
pushd ${RPM_BUILD_ROOT}%{_javadir}
    # create jsp and servlet and el API symlinks
    %{__mv} %{name}/jsp-api.jar %{name}-jsp-%{jspspec}-api-%{version}.jar
    %{__mv} %{name}/servlet-api.jar %{name}-servlet-%{servletspec}-api-%{version}.jar
    %{__mv} %{name}/el-api.jar %{name}-el-%{elspec}-api-%{version}.jar
    /bin/touch el_1_0_api.jar
    /bin/touch el_api.jar
    /bin/touch jsp.jar
    /bin/touch servlet.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
    %{__ln_s} %{name}-el-%{elspec}-api-%{version}.jar %{name}-el-%{elspec}-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 and el API jars
    %{__ln_s} ../%{name}-jsp-%{jspspec}-api-%{version}.jar .
    %{__ln_s} ../%{name}-servlet-%{servletspec}-api-%{version}.jar .
    %{__ln_s} ../%{name}-el-%{elspec}-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} %{cachedir} 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
%{_bindir}/build-jar-repository -p ${RPM_BUILD_ROOT}%{libdir} commons-collections-tomcat5 \
    commons-dbcp-tomcat5 commons-pool-tomcat5 ecj
%if %defined suse_version
# bnc#424675
touch %{buildroot}/%{confdir}/Catalina
# bnc#418664
install -d -m 0755 ${RPM_BUILD_ROOT}/%{_sysconfdir}/ant.d/
echo "tomcat6/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
#bnc#653586 - jasper.sh and jspc
install -m 0755 %{SOURCE100} %{buildroot}/%{bindir}/jasper.sh
install -m 0755 %{SOURCE101} %{buildroot}/%{_bindir}/jspc
%endif
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%pre
# add the tomcat user and group
%if %defined suse_version
%{_sbindir}/groupadd -r tomcat 2>/dev/null || :
%{_sbindir}/useradd -c "Apache Tomcat" -g tomcat \
    -s /bin/sh -r -d %{homedir} tomcat 2>/dev/null || :
%else
%{_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 || :
%endif
%post
%if %defined suse_version
# Usage: VARIABLE_NAME VARIABLE_VALUE
function import_var {
    MSG="### Imported value from %{_sysconfdir}/sysconfig/%{name}. ###"
    if [ ! -z "$2" ]; then
        if [ `grep "^$1" %{confdir}/%{name}.conf` ]; then
            # add a comment with a previous value
            sed -i "s@^$1.*@&\n\n$MSG\n#$1=$2@" %{confdir}/%{name}.conf
        else
            # move the value
            echo -e "\n$MSG\n$1=\"$2\"" >> %{confdir}/%{name}.conf
        fi
    fi
}
# sysconfig removal - bnc#471639
if [ -f /etc/sysconfig/%{name} ]; then
    source %{_sysconfdir}/sysconfig/%{name}
    import_var JAVA_HOME "$JAVA_HOME"
    import_var JAVA_OPTS "$JAVA_OPTS"
    import_var CATALINA_OPTS "$CATALINA_OPTS"
    echo "Merged settings from '%{_sysconfdir}/sysconfig/%{name}' to '%{confdir}/%{name}.conf'"
    mv %{_sysconfdir}/sysconfig/%{name} %{_sysconfdir}/%{name}/%{name}.sysconfig.save
fi
# clean workdir of tomcat6's webapps - bnc#655440#c14
(cd %{workdir}/Catalina/localhost &> /dev/null && \
find _ docs examples host-manager manager -type f -and \( -name '*.java' -or -name '*.class' \) -delete) || :
%else
# install but don't activate
/sbin/chkconfig --add %{name}
%endif
%posttrans
#bnc#650130 workaround, the f*kin rpm cannot convert directory to a symlink during update
if [ ! -L %{confdir}/Catalina ]; then
    %{__rm} -f %{confdir}/Catalina/Catalina
    %{__rm} -rf %{confdir}/Catalina
    %{__ln_s} %{cachedir}/Catalina %{confdir}/
fi
%post el-1_0-api
%{_sbindir}/update-alternatives --install %{_javadir}/el_api.jar el_api %{_javadir}/%{name}-el-%{elspec}-api.jar 10000
%{_sbindir}/update-alternatives --install %{_javadir}/el_1_0_api.jar el_1_0_api %{_javadir}/%{name}-el-%{elspec}-api.jar 10000
%preun el-1_0-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_1-api
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \
    %{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20100
%post lib
# HACK! The commons-dbcp-tomcat5 needs the tomcat6-lib to build, but tomcat6
# 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
%post servlet-2_5-api
%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \
    %{_javadir}/%{name}-servlet-%{servletspec}-api.jar 20500
%post webapps
%{_bindir}/build-jar-repository -p %{appdir}/examples/WEB-INF/lib \
    taglibs-core.jar taglibs-standard.jar 2>&1
%preun
# clean tempdir and cachedir on removal or upgrade
## % {__rm} -rf %{workdir}/* %{tempdir}/*
%if %defined suse_version
%stop_on_removal %{name}
%else
if [ "$1" = "0" ]; then
    %{_initrddir}/%{name} stop >/dev/null 2>&1
    /sbin/chkconfig --del %{name}
fi
%endif
%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
%if %defined suse_version
%postun
%restart_on_update %{name}
%insserv_cleanup
%endif
%postun jsp-2_1-api
if [ "$1" = "0" ]; then
    %{_sbindir}/update-alternatives --remove jsp \
        %{_javadir}/%{name}-jsp-%{jspspec}-api.jar
fi
%postun servlet-2_5-api
if [ "$1" = "0" ]; then
    %{_sbindir}/update-alternatives --remove servlet \
        %{_javadir}/%{name}-servlet-%{servletspec}-api.jar
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}
%attr(0755,root,root) %{_initrddir}/%{name}
%if %{defined suse_version}
#bnc#565901
%attr(0755,root,root) %{bindir}/catalina.sh
#bnc#653586
%attr(0755,root,root) %{bindir}/jasper.sh
%attr(0755,root,root) %{_bindir}/jspc
%endif
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%if ! %defined suse_version
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%endif
%dir %{confdir}
# % dir %{confdir}/Catalina
%ghost %{confdir}/Catalina
%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
%{homedir}
%if %{defined suse_version}
%dir /srv/%{name}
%{_sbindir}/rc%{name}
# % {confdir}/Catalina
%endif
# tomcat group writtable dirs - bnc#625415
%defattr(0664,root,tomcat,0775) 
%verify (not user group) %dir %{appdir}
%verify (not user group) %{cachedir}
%verify (not user group) %{logdir}
%files admin-webapps
%defattr(0644,root,root,0755)
%{appdir}/host-manager
%{appdir}/manager
%files docs-webapp
%defattr(0644,root,root,0755)
%{appdir}/docs
%files el-1_0-api
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-el-%{elspec}-api-%{version}.jar
%{_javadir}/%{name}-el-%{elspec}-api.jar
%ghost %{_javadir}/el_1_0_api.jar
%ghost %{_javadir}/el_api.jar
%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}
%files jsp-2_1-api
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-jsp-%{jspspec}-api-%{version}.jar
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar
%ghost %{_javadir}/jsp.jar
%files lib
%defattr(0644,root,root,0755)
%{libdir}
# bnc#418664
%config(noreplace) %{_sysconfdir}/ant.d
%files servlet-2_5-api
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-servlet-%{servletspec}-api-%{version}.jar
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar
%ghost %{_javadir}/servlet.jar
%files webapps
%defattr(0644,root,root,0755)
#bnc#520532
%config(noreplace) %{appdir}/ROOT
%{appdir}/examples
%{appdir}/sample
%changelog