forked from pool/tomcat
Accepting request 845778 from Java:packages
OBS-URL: https://build.opensuse.org/request/show/845778 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/tomcat?expand=0&rev=73
This commit is contained in:
commit
7e2e44cd86
386
tomcat-9.0.init
386
tomcat-9.0.init
@ -1,386 +0,0 @@
|
||||
#!/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:/usr/bin:/usr/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="/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 <num> set local and overall rc status to <num><num>
|
||||
# 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 --no-dereference ${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 "/run/${NAME}.pid" ]; then
|
||||
read kpid < /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="/run/${NAME}.pid"
|
||||
touch $CATALINA_PID
|
||||
chown --no-dereference ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID
|
||||
touch $TOMCAT_LOG
|
||||
chown --no-dereference ${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 "/run/${NAME}.pid" ]; then
|
||||
read kpid < /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 "/run/${NAME}.pid" ]; then
|
||||
read kpid < /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} /run/${NAME}.pid
|
||||
if [ "${CLEAR_WORK}" = "true" ]; then
|
||||
echo -n "Cleaning work directory: "
|
||||
find ${CATALINA_HOME}/work/{Catalina,temp} -mindepth 2 -type d -print0 | xargs -0 rm -rf
|
||||
if [ "$?" -eq "0" ]; then
|
||||
log_success_msg
|
||||
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 /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 /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
|
3
tomcat-serverxml-tool-1.0.tar.gz
Normal file
3
tomcat-serverxml-tool-1.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bcfb8ac5f9f02359be4dd81ba5feac083f23ffab2b4eee4f79932035d4e642af
|
||||
size 9260
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:345bbc4b2ab711d90c9c182fc1d09d0664f1421499d741f1ae1c6ad602ce2f67
|
||||
size 1969
|
@ -1,3 +1,22 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 3 10:08:03 UTC 2020 - Matei Albu <malbu@suse.com>
|
||||
|
||||
- Add source url for tomcat-serverxml-tool
|
||||
- Fix typo in tomcat-webapps %postun that caused /examples
|
||||
context to remain in server.xml when package was removed
|
||||
- Remove tomcat-9.0.init and /usr/lib/tmpfiles.d/tomcat.conf from
|
||||
package. They're not used anymore becuse of systemd (bsc#1178396)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 30 17:05:52 UTC 2020 - Matei Albu <malbu@suse.com>
|
||||
|
||||
- Fix tomcat-servlet-4_0-api package alternatives to use
|
||||
/usr/share/java/servlet.jar instead of /usr/share/java/tomcat-servlet.jar.
|
||||
Keep /usr/share/java/tomcat-servlet.jar symlink for compatibility.
|
||||
(bsc#1092163)
|
||||
- Change default file ownership in tomcat-webapps from
|
||||
tomcat:tomcat to root:tomcat
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 13 11:23:32 UTC 2020 - Matei Albu <malbu@suse.com>
|
||||
|
||||
@ -7,6 +26,15 @@ Tue Oct 13 11:23:32 UTC 2020 - Matei Albu <malbu@suse.com>
|
||||
- Change /usr/lib/tomcat to /usr/libexec/tomcat in startup
|
||||
scripts (bsc#1177601)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 13 10:47:39 UTC 2020 - Jan Engelhardt <jengelh@inai.de>
|
||||
|
||||
- Replace old specfile constructs. Remove support for SUSE 11.x.
|
||||
- Drop %systemd_requires, which is considered a no-op.
|
||||
- Trim redundant license mention from description.
|
||||
- Make documentation noarch.
|
||||
- Do not suppress errors from useradd.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 26 06:04:58 UTC 2020 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
|
61
tomcat.spec
61
tomcat.spec
@ -24,6 +24,7 @@
|
||||
%define minor_version 0
|
||||
%define micro_version 36
|
||||
%define packdname apache-tomcat-%{version}-src
|
||||
%define serverxmltool_version 1.0
|
||||
# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/
|
||||
%global basedir /srv/%{name}
|
||||
%define appdir %{basedir}/webapps
|
||||
@ -51,7 +52,6 @@ Group: Productivity/Networking/Web/Servers
|
||||
URL: https://tomcat.apache.org
|
||||
Source0: https://archive.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
|
||||
Source3: %{name}-%{major_version}.%{minor_version}.sysconfig
|
||||
Source4: %{name}-%{major_version}.%{minor_version}.wrapper
|
||||
Source5: %{name}-%{major_version}.%{minor_version}.logrotate
|
||||
@ -64,7 +64,7 @@ Source21: tomcat-functions
|
||||
Source30: tomcat-preamble
|
||||
Source31: tomcat-server
|
||||
Source32: tomcat-named.service
|
||||
Source33: tomcat-serverxml-tool.tar.gz
|
||||
Source33: https://gitlab.suse.de/galaxy/tomcat-serverxml-tool/-/archive/%{serverxmltool_version}/tomcat-serverxml-tool-%{serverxmltool_version}.tar.gz
|
||||
Source34: tomcat-serverxml-tool.sh.in
|
||||
Source1000: tomcat-rpmlintrc
|
||||
Source1001: https://archive.apache.org/dist/tomcat/tomcat-%{major_version}/v%{version}/src/%{packdname}.tar.gz.asc
|
||||
@ -125,7 +125,6 @@ Requires(pre): %{_sbindir}/useradd
|
||||
Recommends: libtcnative-1-0 >= 1.1.24
|
||||
Recommends: logrotate
|
||||
BuildArch: noarch
|
||||
%systemd_requires
|
||||
|
||||
%description
|
||||
Tomcat is the servlet container that is used in the official Reference
|
||||
@ -133,11 +132,6 @@ 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.
|
||||
|
||||
ATTENTION: This tomcat is built with java 1.8.0.
|
||||
|
||||
%package admin-webapps
|
||||
@ -180,6 +174,7 @@ Expression Language API version 3.0.
|
||||
%package javadoc
|
||||
Summary: Javadoc generated documentation for Apache Tomcat
|
||||
Group: Documentation/HTML
|
||||
BuildArch: noarch
|
||||
|
||||
%description javadoc
|
||||
Javadoc generated documentation files for Apache Tomcat.
|
||||
@ -323,15 +318,12 @@ jar cf ../../../../../../../../output/build/webapps/docs/appdev/sample/sample.wa
|
||||
popd
|
||||
popd
|
||||
|
||||
pushd %{_builddir}/tomcat-serverxml-tool
|
||||
pushd %{_builddir}/tomcat-serverxml-tool-%{serverxmltool_version}/src
|
||||
javac -source %{javac_target} -target %{javac_target} com/suse/tcserverxml/ApplyStylesheet.java
|
||||
jar cfe serverxmltool.jar com.suse.tcserverxml.ApplyStylesheet com/suse/tcserverxml/ApplyStylesheet.class com/suse/tcserverxml/add-context.xslt com/suse/tcserverxml/remove-context.xslt
|
||||
jar cfe %{_builddir}/tomcat-serverxml-tool-%{serverxmltool_version}/serverxmltool.jar com.suse.tcserverxml.ApplyStylesheet com/suse/tcserverxml/ApplyStylesheet.class com/suse/tcserverxml/add-context.xslt com/suse/tcserverxml/remove-context.xslt
|
||||
popd
|
||||
|
||||
%install
|
||||
%if 0%{?suse_version} == 1110
|
||||
export NO_BRP_CHECK_BYTECODE_VERSION=true
|
||||
%endif
|
||||
# build initial path structure
|
||||
install -d -m 0755 %{buildroot}%{_bindir}
|
||||
install -d -m 0755 %{buildroot}%{_sbindir}
|
||||
@ -418,6 +410,7 @@ pushd %{buildroot}%{_javadir}
|
||||
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
|
||||
ln -s %{name}-servlet-%{servletspec}-api.jar %{name}-servlet.jar
|
||||
mv %{name}/el-api.jar %{name}-el-%{elspec}-api.jar
|
||||
ln -s %{name}-el-%{elspec}-api.jar %{name}-el-api.jar
|
||||
popd
|
||||
@ -572,15 +565,12 @@ mkdir -p %{buildroot}%{_sysconfdir}/alternatives
|
||||
ln -s -f %{_sysconfdir}/alternatives/el_api %{buildroot}%{_javadir}/%{name}-el_api.jar
|
||||
ln -s -f %{_sysconfdir}/alternatives/el_1_0_api %{buildroot}%{_javadir}/%{name}-el_1_0_api.jar
|
||||
ln -s -f %{_sysconfdir}/alternatives/jsp %{buildroot}%{_javadir}/%{name}-jsp.jar
|
||||
ln -s -f %{_sysconfdir}/alternatives/servlet %{buildroot}%{_javadir}/%{name}-servlet.jar
|
||||
|
||||
mkdir -p %{buildroot}%{_tmpfilesdir}
|
||||
cat > %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF
|
||||
f /run/%{name}.pid 0644 tomcat tomcat -
|
||||
EOF
|
||||
# To avoid conflicts with servletapi4 and servletapi5 create a link to incorrect /etc/alternatives/servlet.jar.
|
||||
# It will be changed anyways to the correct symlink by update-alternatives.
|
||||
ln -s -f %{_sysconfdir}/alternatives/servlet.jar %{buildroot}%{_javadir}/servlet.jar
|
||||
|
||||
# Install tool used to edit server.xml
|
||||
pushd %{_builddir}/tomcat-serverxml-tool
|
||||
pushd %{_builddir}/tomcat-serverxml-tool-%{serverxmltool_version}
|
||||
cat %{SOURCE34} | sed 's#@LIBEXECDIR@#%{_libexecdir}#g' >tomcat-serverxml-tool.sh
|
||||
install -m 0755 tomcat-serverxml-tool.sh \
|
||||
%{buildroot}%{_libexecdir}/%{name}/serverxml-tool.sh
|
||||
@ -589,16 +579,15 @@ popd
|
||||
|
||||
%pre
|
||||
# add the tomcat user and group
|
||||
%{_sbindir}/groupadd -r tomcat 2>/dev/null || :
|
||||
%{_sbindir}/useradd -c "Apache Tomcat" -g tomcat \
|
||||
-s /sbin/nologin -r -d %{homedir} tomcat 2>/dev/null || :
|
||||
getent group tomcat >/dev/null || %{_sbindir}/groupadd -r tomcat
|
||||
getent passwd tomcat >/dev/null || %{_sbindir}/useradd -c "Apache Tomcat" \
|
||||
-g tomcat -s /sbin/nologin -r -d %{homedir} tomcat
|
||||
%service_add_pre %{name}.service
|
||||
|
||||
%post
|
||||
%service_add_post %{name}.service
|
||||
%service_add_post %{name}@.service
|
||||
%{fillup_only %{name}}
|
||||
%tmpfiles_create %_tmpfilesdir/%{name}.conf
|
||||
|
||||
%preun
|
||||
%service_del_preun %{name}.service
|
||||
@ -639,11 +628,26 @@ if [ $1 -eq 0 ] ; then
|
||||
fi
|
||||
|
||||
%post servlet-4_0-api
|
||||
update-alternatives --install %{_javadir}/%{name}-servlet.jar servlet \
|
||||
update-alternatives --install %{_javadir}/servlet.jar servlet \
|
||||
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar 30000
|
||||
# Fix for bsc#1092163.
|
||||
# Keep the /usr/share/java/tomcat-servlet.jar symlink for compatibility.
|
||||
# In case of update from an older version where /usr/share/java/tomcat-servlet.jar is an alternatives symlink
|
||||
# the update-alternatives in the new version will cause a rename tomcat-servlet.jar -> servlet.jar.
|
||||
# This makes sure the tomcat-servlet.jar is recreated if it's missing because of the rename.
|
||||
if [ ! -f %{_javadir}/%{name}-servlet.jar ]; then
|
||||
echo "Recreating symlink %{_javadir}/%{name}-servlet.jar"
|
||||
ln -s %{_javadir}/%{name}-servlet-%{servletspec}-api.jar %{_javadir}/%{name}-servlet.jar
|
||||
fi
|
||||
|
||||
%postun servlet-4_0-api
|
||||
if [ $1 -eq 0 ] ; then
|
||||
if [ ! -f %{_sysconfdir}/alternatives/servlet ]; then
|
||||
# /etc/alternatives/servlet was removed on uninstall.
|
||||
# Create a broken symlink to make sure update-alternatives works correctly and falls back
|
||||
# to servletapi5 or servletapi4 if they're installed.
|
||||
ln -s %{_javadir}/%{name}-servlet-%{servletspec}-api.jar %{_sysconfdir}/alternatives/servlet
|
||||
fi
|
||||
update-alternatives --remove servlet \
|
||||
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar
|
||||
fi
|
||||
@ -665,7 +669,7 @@ rm -f \
|
||||
if [ $1 -eq 0 ]; then # uninstall only
|
||||
%{serverxmltool} remove %{tomcatappdir}/ROOT /
|
||||
%{serverxmltool} remove %{tomcatappdir}/sample /sample
|
||||
%{serverxmltool} remove %{tomcatappdir}/examples /example
|
||||
%{serverxmltool} remove %{tomcatappdir}/examples /examples
|
||||
fi
|
||||
|
||||
%post admin-webapps
|
||||
@ -687,7 +691,6 @@ if [ $1 -eq 0 ]; then # uninstall only
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc {LICENSE,NOTICE,RELEASE*}
|
||||
%attr(0755,root,root) %{_bindir}/%{name}-digest
|
||||
%attr(0755,root,root) %{_bindir}/%{name}-tool-wrapper
|
||||
@ -731,7 +734,6 @@ fi
|
||||
%attr(0644,root,tomcat) %config(noreplace) %{confdir}/web.xml
|
||||
%attr(0644,root,tomcat) %config(noreplace) %{confdir}/jaspic-providers.xml
|
||||
%attr(0755,root,tomcat) %dir %{homedir}
|
||||
%attr(0644,root,tomcat) %{_tmpfilesdir}/%{name}.conf
|
||||
%attr(0644,root,tomcat) %{bindir}/bootstrap.jar
|
||||
%attr(0644,root,tomcat) %{bindir}/catalina-tasks.xml
|
||||
%{homedir}/lib
|
||||
@ -788,10 +790,11 @@ fi
|
||||
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar
|
||||
%{_javadir}/%{name}-servlet-api.jar
|
||||
%{_javadir}/%{name}-servlet.jar
|
||||
%{_javadir}/servlet.jar
|
||||
%ghost %{_sysconfdir}/alternatives/servlet
|
||||
|
||||
%files webapps
|
||||
%defattr(0644,tomcat,tomcat,0755)
|
||||
%defattr(0644,root,tomcat,0755)
|
||||
#bnc#520532
|
||||
%config(noreplace) %{tomcatappdir}/ROOT
|
||||
%{tomcatappdir}/examples
|
||||
|
Loading…
x
Reference in New Issue
Block a user