cbe921
# Copyright (c) 2000-2008, JPackage Project
cbe921
# All rights reserved.
cbe921
#
cbe921
# Redistribution and use in source and binary forms, with or without
cbe921
# modification, are permitted provided that the following conditions
cbe921
# are met:
cbe921
#
cbe921
# 1. Redistributions of source code must retain the above copyright
cbe921
#    notice, this list of conditions and the following disclaimer.
cbe921
# 2. Redistributions in binary form must reproduce the above copyright
cbe921
#    notice, this list of conditions and the following disclaimer in the
cbe921
#    documentation and/or other materials provided with the
cbe921
#    distribution.
cbe921
# 3. Neither the name of the JPackage Project nor the names of its
cbe921
#    contributors may be used to endorse or promote products derived
cbe921
#    from this software without specific prior written permission.
cbe921
#
cbe921
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
cbe921
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
cbe921
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
cbe921
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
cbe921
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
cbe921
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
cbe921
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
cbe921
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
cbe921
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
cbe921
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
cbe921
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cbe921
#
cbe921
cbe921
%global jspspec 2.3
cbe921
%global major_version 9
cbe921
%global minor_version 0
cbe921
%global micro_version 62
cbe921
%global packdname apache-tomcat-%{version}-src
cbe921
%global servletspec 4.0
cbe921
%global elspec 3.0
cbe921
%global tcuid 53
cbe921
# Recommended version is specified in java/org/apache/catalina/core/AprLifecycleListener.java
cbe921
%global native_version 1.2.21
cbe921
cbe921
cbe921
# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/
cbe921
%global basedir %{_var}/lib/%{name}
cbe921
%global appdir %{basedir}/webapps
cbe921
%global homedir %{_datadir}/%{name}
cbe921
%global bindir %{homedir}/bin
cbe921
%global confdir %{_sysconfdir}/%{name}
cbe921
%global libdir %{_javadir}/%{name}
cbe921
%global logdir %{_var}/log/%{name}
cbe921
%global cachedir %{_var}/cache/%{name}
cbe921
%global tempdir %{cachedir}/temp
cbe921
%global workdir %{cachedir}/work
cbe921
%global _systemddir /lib/systemd/system
cbe921
cbe921
Name:          tomcat
cbe921
Epoch:         1
cbe921
Version:       %{major_version}.%{minor_version}.%{micro_version}
cbe921
Release:       5%{?dist}
cbe921
Summary:       Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API
cbe921
cbe921
License:       ASL 2.0
cbe921
URL:           http://tomcat.apache.org/
cbe921
Source0:       http://www.apache.org/dist/tomcat/tomcat-%{major_version}/v%{version}/src/%{packdname}.tar.gz
cbe921
Source1:       %{name}-%{major_version}.%{minor_version}.conf
cbe921
Source3:       %{name}-%{major_version}.%{minor_version}.sysconfig
cbe921
Source4:       %{name}-%{major_version}.%{minor_version}.wrapper
cbe921
Source5:       %{name}-%{major_version}.%{minor_version}.logrotate
cbe921
Source6:       %{name}-%{major_version}.%{minor_version}-digest.script
cbe921
Source7:       %{name}-%{major_version}.%{minor_version}-tool-wrapper.script
cbe921
Source11:      %{name}-%{major_version}.%{minor_version}.service
cbe921
Source21:      tomcat-functions
cbe921
Source30:      tomcat-preamble
cbe921
Source31:      tomcat-server
cbe921
Source32:      tomcat-named.service
cbe921
Source33:      java-9-start-up-parameters.conf
cbe921
cbe921
Patch0:        %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch
cbe921
Patch1:        %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch
cbe921
Patch2:        %{name}-build.patch
cbe921
Patch3:        %{name}-%{major_version}.%{minor_version}-catalina-policy.patch
cbe921
Patch4:        rhbz-1857043.patch
cbe921
Patch5:        %{name}-%{major_version}.%{minor_version}-JDTCompiler.patch
cbe921
# remove bnd dependency which version is too low on rhel8
cbe921
Patch6:        remove-bnd-annotation.patch
cbe921
# The fixes for memory leak which have been fixed in 9.0.64, remove this patch in the next tomcat update
cbe921
Patch7:        %{name}-%{major_version}.%{minor_version}-memory-leak.patch
cbe921
Patch8:        fix-malformed-dtd.patch
cbe921
cbe921
BuildArch:     noarch
cbe921
cbe921
BuildRequires: ant
cbe921
BuildRequires: ecj >= 1:4.10
cbe921
BuildRequires: findutils
cbe921
BuildRequires: java-devel >= 1:1.8.0
cbe921
BuildRequires: javapackages-local
cbe921
BuildRequires: aqute-bnd
cbe921
BuildRequires: aqute-bndlib
cbe921
BuildRequires: systemd
cbe921
cbe921
Requires:      java-headless >= 1:1.8.0
cbe921
Requires:      javapackages-tools
cbe921
Requires:      %{name}-lib = %{epoch}:%{version}-%{release}
cbe921
%if 0%{?fedora} || 0%{?rhel} > 7
cbe921
Recommends:    tomcat-native >= %{native_version}
cbe921
%endif
cbe921
Requires(pre):    shadow-utils
cbe921
Requires(post):   systemd
cbe921
Requires(preun):  systemd
cbe921
Requires(postun): systemd
cbe921
cbe921
# We will change it to an obsoletes whenever the pki team is able to make the switch
cbe921
Conflicts: pki-servlet-engine <= 1:9.0.50
cbe921
cbe921
# added after log4j sub-package was removed
cbe921
Provides:         %{name}-log4j = %{epoch}:%{version}-%{release}
cbe921
cbe921
%description
cbe921
Tomcat is the servlet container that is used in the official Reference
cbe921
Implementation for the Java Servlet and JavaServer Pages technologies.
cbe921
The Java Servlet and JavaServer Pages specifications are developed by
cbe921
Sun under the Java Community Process.
cbe921
cbe921
Tomcat is developed in an open and participatory environment and
cbe921
released under the Apache Software License version 2.0. Tomcat is intended
cbe921
to be a collaboration of the best-of-breed developers from around the world.
cbe921
cbe921
%package admin-webapps
cbe921
Summary: The host-manager and manager web applications for Apache Tomcat
cbe921
Requires: %{name} = %{epoch}:%{version}-%{release}
cbe921
cbe921
%description admin-webapps
cbe921
The host-manager and manager web applications for Apache Tomcat.
cbe921
cbe921
%package docs-webapp
cbe921
Summary: The docs web application for Apache Tomcat
cbe921
Requires: %{name} = %{epoch}:%{version}-%{release}
cbe921
cbe921
%description docs-webapp
cbe921
The docs web application for Apache Tomcat.
cbe921
cbe921
%package jsp-%{jspspec}-api
cbe921
Summary: Apache Tomcat JavaServer Pages v%{jspspec} API Implementation Classes
cbe921
Provides: jsp = %{jspspec}
cbe921
Obsoletes: %{name}-jsp-2.2-api
cbe921
Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release}
cbe921
Requires: %{name}-el-%{elspec}-api = %{epoch}:%{version}-%{release}
cbe921
Conflicts: pki-servlet-engine <= 1:9.0.50
cbe921
cbe921
%description jsp-%{jspspec}-api
cbe921
Apache Tomcat JSP API Implementation Classes.
cbe921
cbe921
%package lib
cbe921
Summary: Libraries needed to run the Tomcat Web container
cbe921
Requires: %{name}-jsp-%{jspspec}-api = %{epoch}:%{version}-%{release}
cbe921
Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release}
cbe921
Requires: %{name}-el-%{elspec}-api = %{epoch}:%{version}-%{release}
cbe921
Requires: ecj >= 1:4.10
cbe921
Requires(preun): coreutils
cbe921
Conflicts: pki-servlet-engine <= 1:9.0.50
cbe921
cbe921
%description lib
cbe921
Libraries needed to run the Tomcat Web container.
cbe921
cbe921
%package servlet-%{servletspec}-api
cbe921
Summary: Apache Tomcat Java Servlet v%{servletspec} API Implementation Classes
cbe921
Provides: servlet = %{servletspec}
cbe921
Provides: servlet6
cbe921
Provides: servlet3
cbe921
Obsoletes: %{name}-servlet-3.1-api
cbe921
Conflicts: pki-servlet-4.0-api <= 1:9.0.50
cbe921
cbe921
%description servlet-%{servletspec}-api
cbe921
Apache Tomcat Servlet API Implementation Classes.
cbe921
cbe921
%package el-%{elspec}-api
cbe921
Summary: Apache Tomcat Expression Language v%{elspec} API Implementation Classes
cbe921
Provides: el_api = %{elspec}
cbe921
Obsoletes: %{name}-el-2.2-api
cbe921
Conflicts: pki-servlet-engine <= 1:9.0.50 and pki-servlet-container <= 1:9.0.7
cbe921
cbe921
%description el-%{elspec}-api
cbe921
Apache Tomcat EL API Implementation Classes.
cbe921
cbe921
%package webapps
cbe921
Summary: The ROOT web application for Apache Tomcat
cbe921
Requires: %{name} = %{epoch}:%{version}-%{release}
cbe921
cbe921
%description webapps
cbe921
The ROOT web application for Apache Tomcat.
cbe921
cbe921
%prep
cbe921
%setup -q -n %{packdname}
cbe921
# remove pre-built binaries and windows files
cbe921
find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "*.gz" -o \
cbe921
   -name "*.jar" -o -name "*.war" -o -name "*.zip" \) -delete
cbe921
cbe921
%patch0 -p0
cbe921
%patch1 -p0
cbe921
%patch2 -p0
cbe921
%patch3 -p0
cbe921
%patch4 -p0
cbe921
%patch5 -p0
cbe921
%patch6 -p1
cbe921
%patch7 -p1
cbe921
%patch8 -p1
cbe921
cbe921
# Remove webservices naming resources as it's generally unused
cbe921
%{__rm} -rf java/org/apache/naming/factory/webservices
cbe921
cbe921
# Configure maven files
cbe921
%mvn_package ":tomcat-el-api" tomcat-el-api
cbe921
%mvn_alias "org.apache.tomcat:tomcat-el-api" "org.eclipse.jetty.orbit:javax.el"
cbe921
%mvn_package ":tomcat-jsp-api" tomcat-jsp-api
cbe921
%mvn_alias "org.apache.tomcat:tomcat-jsp-api" "org.eclipse.jetty.orbit:javax.servlet.jsp"
cbe921
%mvn_package ":tomcat-servlet-api" tomcat-servlet-api
cbe921
cbe921
cbe921
%build
cbe921
export OPT_JAR_LIST="xalan-j2-serializer"
cbe921
# we don't care about the tarballs and we're going to replace
cbe921
# tomcat-dbcp.jar with apache-commons-{collections,dbcp,pool}-tomcat5.jar
cbe921
# so just create a dummy file for later removal
cbe921
touch HACK
cbe921
cbe921
# who needs a build.properties file anyway
cbe921
%{ant} -Dbase.path="." \
cbe921
  -Dbuild.compiler="modern" \
cbe921
  -Dcommons-daemon.jar="HACK" \
cbe921
  -Dcommons-daemon.native.src.tgz="HACK" \
cbe921
  -Djdt.jar="$(build-classpath ecj/ecj)" \
cbe921
  -Dtomcat-native.tar.gz="HACK" \
cbe921
  -Dtomcat-native.home="." \
cbe921
  -Dcommons-daemon.native.win.mgr.exe="HACK" \
cbe921
  -Dnsis.exe="HACK" \
cbe921
  -Djaxrpc-lib.jar="HACK" \
cbe921
  -Dwsdl4j-lib.jar="HACK" \
cbe921
  -Dbnd.jar="HACK" \
cbe921
  -Dversion="%{version}" \
cbe921
  -Dversion.build="%{micro_version}" \
cbe921
  deploy
cbe921
cbe921
# remove some jars that we'll replace with symlinks later
cbe921
%{__rm} output/build/bin/commons-daemon.jar output/build/lib/ecj.jar
cbe921
# Remove the example webapps per Apache Tomcat Security Considerations
cbe921
# see https://tomcat.apache.org/tomcat-9.0-doc/security-howto.html
cbe921
%{__rm} -rf output/build/webapps/examples
cbe921
cbe921
cbe921
%install
cbe921
# build initial path structure
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir}
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sbindir}
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_systemddir}
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{appdir}
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{bindir}
cbe921
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir}
cbe921
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir}/Catalina/localhost
cbe921
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir}/conf.d
cbe921
/bin/echo "Place your custom *.conf files here. Shell expansion is supported." > ${RPM_BUILD_ROOT}%{confdir}/conf.d/README
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{libdir}
cbe921
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{logdir}
cbe921
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{_localstatedir}/lib/tomcats
cbe921
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{homedir}
cbe921
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{tempdir}
cbe921
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{workdir}
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_unitdir}
cbe921
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_libexecdir}/%{name}
cbe921
cbe921
# move things into place
cbe921
# First copy supporting libs to tomcat lib
cbe921
pushd output/build
cbe921
    %{__cp} -a bin/*.{jar,xml} ${RPM_BUILD_ROOT}%{bindir}
cbe921
    %{__cp} -a conf/*.{policy,properties,xml,xsd} ${RPM_BUILD_ROOT}%{confdir}
cbe921
    %{__cp} -a lib/*.jar ${RPM_BUILD_ROOT}%{libdir}
cbe921
    %{__cp} -a webapps/* ${RPM_BUILD_ROOT}%{appdir}
cbe921
popd
cbe921
cbe921
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
cbe921
   -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
cbe921
   -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE1} \
cbe921
    > ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf
cbe921
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
cbe921
   -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
cbe921
   -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE3} \
cbe921
    > ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}
cbe921
%{__install} -m 0644 %{SOURCE4} \
cbe921
    ${RPM_BUILD_ROOT}%{_sbindir}/%{name}
cbe921
%{__install} -m 0644 %{SOURCE11} \
cbe921
    ${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service
cbe921
%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \
cbe921
    > ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}.disabled
cbe921
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
cbe921
   -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
cbe921
   -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \
cbe921
    > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-digest
cbe921
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
cbe921
   -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
cbe921
   -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE7} \
cbe921
    > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper
cbe921
cbe921
%{__install} -m 0644 %{SOURCE21} \
cbe921
    ${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/functions
cbe921
%{__install} -m 0755 %{SOURCE30} \
cbe921
    ${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/preamble
cbe921
%{__install} -m 0755 %{SOURCE31} \
cbe921
    ${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/server
cbe921
%{__install} -m 0644 %{SOURCE32} \
cbe921
    ${RPM_BUILD_ROOT}%{_unitdir}/%{name}@.service
cbe921
cbe921
%{__install} -m 0644 %{SOURCE33} ${RPM_BUILD_ROOT}%{confdir}/conf.d/
cbe921
cbe921
# Substitute libnames in catalina-tasks.xml
cbe921
sed -i \
cbe921
   "s,el-api.jar,%{name}-el-%{elspec}-api.jar,;
cbe921
    s,servlet-api.jar,%{name}-servlet-%{servletspec}-api.jar,;
cbe921
    s,jsp-api.jar,%{name}-jsp-%{jspspec}-api.jar,;" \
cbe921
    ${RPM_BUILD_ROOT}%{bindir}/catalina-tasks.xml
cbe921
cbe921
# create jsp and servlet API symlinks
cbe921
pushd ${RPM_BUILD_ROOT}%{_javadir}
cbe921
   %{__mv} %{name}/jsp-api.jar %{name}-jsp-%{jspspec}-api.jar
cbe921
   %{__ln_s} %{name}-jsp-%{jspspec}-api.jar %{name}-jsp-api.jar
cbe921
   %{__mv} %{name}/servlet-api.jar %{name}-servlet-%{servletspec}-api.jar
cbe921
   %{__ln_s} %{name}-servlet-%{servletspec}-api.jar %{name}-servlet-api.jar
cbe921
   %{__mv} %{name}/el-api.jar %{name}-el-%{elspec}-api.jar
cbe921
   %{__ln_s} %{name}-el-%{elspec}-api.jar %{name}-el-api.jar
cbe921
popd
cbe921
cbe921
pushd output/build
cbe921
    %{_bindir}/build-jar-repository lib ecj 2>&1
cbe921
popd
cbe921
cbe921
pushd ${RPM_BUILD_ROOT}%{libdir}
cbe921
    # symlink JSP and servlet API jars
cbe921
    %{__ln_s} ../../java/%{name}-jsp-%{jspspec}-api.jar .
cbe921
    %{__ln_s} ../../java/%{name}-servlet-%{servletspec}-api.jar .
cbe921
    %{__ln_s} ../../java/%{name}-el-%{elspec}-api.jar .
cbe921
    %{__ln_s} $(build-classpath ecj/ecj) jasper-jdt.jar
cbe921
popd
cbe921
cbe921
# symlink to the FHS locations where we've installed things
cbe921
pushd ${RPM_BUILD_ROOT}%{homedir}
cbe921
    %{__ln_s} %{appdir} webapps
cbe921
    %{__ln_s} %{confdir} conf
cbe921
    %{__ln_s} %{libdir} lib
cbe921
    %{__ln_s} %{logdir} logs
cbe921
    %{__ln_s} %{tempdir} temp
cbe921
    %{__ln_s} %{workdir} work
cbe921
popd
cbe921
cbe921
# Install the maven metadata for the spec impl artifacts as other projects use them
cbe921
#%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_mavenpomdir}
cbe921
pushd res/maven
cbe921
    for pom in tomcat-el-api.pom tomcat-jsp-api.pom tomcat-servlet-api.pom; do
cbe921
        # fix-up version in all pom files
cbe921
        sed -i 's/@MAVEN.DEPLOY.VERSION@/%{version}/g' $pom
cbe921
    done
cbe921
popd
cbe921
cbe921
# Configure and install maven artifacts
cbe921
%mvn_artifact res/maven/tomcat-el-api.pom output/build/lib/el-api.jar
cbe921
%mvn_artifact res/maven/tomcat-jsp-api.pom output/build/lib/jsp-api.jar
cbe921
%mvn_artifact res/maven/tomcat-servlet-api.pom output/build/lib/servlet-api.jar
cbe921
%mvn_install
cbe921
cbe921
%pre
cbe921
# add the tomcat user and group
cbe921
getent group tomcat >/dev/null || %{_sbindir}/groupadd -f -g %{tcuid} -r tomcat
cbe921
if ! getent passwd tomcat >/dev/null ; then
cbe921
    if ! getent passwd %{tcuid} >/dev/null ; then
cbe921
        %{_sbindir}/useradd -r -u %{tcuid} -g tomcat -d %{homedir} -s /sbin/nologin -c "Apache Tomcat" tomcat
cbe921
        # Tomcat uses a reserved ID, so there should never be an else
cbe921
    fi
cbe921
fi
cbe921
exit 0
cbe921
cbe921
%post
cbe921
# install but don't activate
cbe921
%systemd_post %{name}.service
cbe921
cbe921
%post jsp-%{jspspec}-api
cbe921
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \
cbe921
    %{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20200
cbe921
cbe921
%post servlet-%{servletspec}-api
cbe921
%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \
cbe921
    %{_javadir}/%{name}-servlet-%{servletspec}-api.jar 30000
cbe921
cbe921
%post el-%{elspec}-api
cbe921
%{_sbindir}/update-alternatives --install %{_javadir}/elspec.jar elspec \
cbe921
   %{_javadir}/%{name}-el-%{elspec}-api.jar 20300
cbe921
cbe921
%preun
cbe921
# clean tempdir and workdir on removal or upgrade
cbe921
%{__rm} -rf %{workdir}/* %{tempdir}/*
cbe921
%systemd_preun %{name}.service
cbe921
cbe921
%postun
cbe921
%systemd_postun_with_restart %{name}.service 
cbe921
cbe921
%postun jsp-%{jspspec}-api
cbe921
if [ "$1" = "0" ]; then
cbe921
    %{_sbindir}/update-alternatives --remove jsp \
cbe921
        %{_javadir}/%{name}-jsp-%{jspspec}-api.jar
cbe921
fi
cbe921
cbe921
%postun servlet-%{servletspec}-api
cbe921
if [ "$1" = "0" ]; then
cbe921
    %{_sbindir}/update-alternatives --remove servlet \
cbe921
        %{_javadir}/%{name}-servlet-%{servletspec}-api.jar
cbe921
fi
cbe921
cbe921
%postun el-%{elspec}-api
cbe921
if [ "$1" = "0" ]; then
cbe921
    %{_sbindir}/update-alternatives --remove elspec \
cbe921
        %{_javadir}/%{name}-el-%{elspec}-api.jar
cbe921
fi
cbe921
cbe921
%files 
cbe921
%defattr(0664,root,tomcat,0755)
cbe921
%doc {LICENSE,NOTICE,RELEASE*}
cbe921
%attr(0755,root,root) %{_bindir}/%{name}-digest
cbe921
%attr(0755,root,root) %{_bindir}/%{name}-tool-wrapper
cbe921
%attr(0755,root,root) %{_sbindir}/%{name}
cbe921
%attr(0644,root,root) %{_unitdir}/%{name}.service
cbe921
%attr(0644,root,root) %{_unitdir}/%{name}@.service
cbe921
%attr(0755,root,root) %dir %{_libexecdir}/%{name}
cbe921
%attr(0755,root,root) %dir %{_localstatedir}/lib/tomcats
cbe921
%attr(0644,root,root) %{_libexecdir}/%{name}/functions
cbe921
%attr(0755,root,root) %{_libexecdir}/%{name}/preamble
cbe921
%attr(0755,root,root) %{_libexecdir}/%{name}/server
cbe921
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
cbe921
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}.disabled
cbe921
%attr(0755,root,tomcat) %dir %{basedir}
cbe921
%attr(0755,root,tomcat) %dir %{confdir}
cbe921
cbe921
%defattr(0664,tomcat,root,0770)
cbe921
%attr(0770,tomcat,root) %dir %{logdir}
cbe921
cbe921
%defattr(0664,root,tomcat,0770)
cbe921
%attr(0770,root,tomcat) %dir %{cachedir}
cbe921
%attr(0770,root,tomcat) %dir %{tempdir}
cbe921
%attr(0770,root,tomcat) %dir %{workdir}
cbe921
cbe921
%defattr(0644,root,tomcat,0775)
cbe921
%attr(0775,root,tomcat) %dir %{appdir}
cbe921
%attr(0775,root,tomcat) %dir %{confdir}/Catalina
cbe921
%attr(0775,root,tomcat) %dir %{confdir}/Catalina/localhost
cbe921
%attr(0755,root,tomcat) %dir %{confdir}/conf.d
cbe921
%{confdir}/conf.d/README
cbe921
%{confdir}/conf.d/java-9-start-up-parameters.conf
cbe921
%config(noreplace) %{confdir}/%{name}.conf
cbe921
%config(noreplace) %{confdir}/*.policy
cbe921
%config(noreplace) %{confdir}/*.properties
cbe921
%config(noreplace) %{confdir}/context.xml
cbe921
%config(noreplace) %{confdir}/server.xml
cbe921
%attr(0640,root,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml
cbe921
%attr(0664,root,tomcat) %{confdir}/tomcat-users.xsd
cbe921
%attr(0664,root,tomcat) %config(noreplace) %{confdir}/jaspic-providers.xml
cbe921
%attr(0664,root,tomcat) %{confdir}/jaspic-providers.xsd
cbe921
%config(noreplace) %{confdir}/web.xml
cbe921
%dir %{homedir}
cbe921
%{bindir}/bootstrap.jar
cbe921
%{bindir}/catalina-tasks.xml
cbe921
%{homedir}/lib
cbe921
%{homedir}/temp
cbe921
%{homedir}/webapps
cbe921
%{homedir}/work
cbe921
%{homedir}/logs
cbe921
%{homedir}/conf
cbe921
cbe921
%files admin-webapps
cbe921
%defattr(0664,root,tomcat,0755)
cbe921
%{appdir}/host-manager
cbe921
%{appdir}/manager
cbe921
cbe921
%files docs-webapp
cbe921
%{appdir}/docs
cbe921
cbe921
%files lib
cbe921
%dir %{libdir}
cbe921
%{libdir}/*.jar
cbe921
%{_javadir}/*.jar
cbe921
%{bindir}/tomcat-juli.jar
cbe921
%exclude %{libdir}/%{name}-el-%{elspec}-api.jar
cbe921
%exclude %{_javadir}/%{name}-servlet-%{servletspec}*.jar
cbe921
%exclude %{_javadir}/%{name}-el-%{elspec}-api.jar
cbe921
%exclude %{_javadir}/%{name}-jsp-%{jspspec}*.jar
cbe921
cbe921
%files jsp-%{jspspec}-api -f .mfiles-tomcat-jsp-api
cbe921
%{_javadir}/%{name}-jsp-%{jspspec}*.jar
cbe921
cbe921
%files servlet-%{servletspec}-api -f .mfiles-tomcat-servlet-api
cbe921
%doc LICENSE
cbe921
%{_javadir}/%{name}-servlet-%{servletspec}*.jar
cbe921
cbe921
%files el-%{elspec}-api -f .mfiles-tomcat-el-api
cbe921
%doc LICENSE
cbe921
%{_javadir}/%{name}-el-%{elspec}-api.jar
cbe921
%{libdir}/%{name}-el-%{elspec}-api.jar
cbe921
cbe921
%files webapps
cbe921
%defattr(0644,tomcat,tomcat,0755)
cbe921
%{appdir}/ROOT
cbe921
cbe921
cbe921
%changelog
cbe921
* Thu Feb 16 2023 Coty Sutherland <csutherl@redhat.com> - 1:9.0.62-5
cbe921
- Related: #2160455 Add conflicts to subpackage
cbe921
cbe921
* Wed Feb 15 2023 Hui Wang <huwang@redhat.com> - 1:9.0.62-4
cbe921
- Resolves: #2160455 Add Tomcat 9 to RHEL8