+- Drop %%update_maven_depmap as in tomcat6
+- Provide native systemd unit file ported from tomcat6
This commit is contained in:
parent
4b23f91d22
commit
ddfc98c4f4
101
tomcat-7.0-tomcat-sysd
Normal file
101
tomcat-7.0-tomcat-sysd
Normal file
@ -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
|
||||||
|
|
@ -67,7 +67,7 @@ TOMCAT_PROG="${NAME}"
|
|||||||
TOMCAT_USER="${TOMCAT_USER:-tomcat}"
|
TOMCAT_USER="${TOMCAT_USER:-tomcat}"
|
||||||
|
|
||||||
# Define the tomcat log file
|
# Define the tomcat log file
|
||||||
TOMCAT_LOG="${TOMCAT_LOG:-/var/log/tomcat/catalina.out}"
|
TOMCAT_LOG="${TOMCAT_LOG:-${CATALINA_HOME}/logs/${NAME}-initd.log}"
|
||||||
|
|
||||||
|
|
||||||
RETVAL="0"
|
RETVAL="0"
|
||||||
@ -184,10 +184,10 @@ function start() {
|
|||||||
parseOptions
|
parseOptions
|
||||||
if [ "$RETVAL" -eq "0" -a "$SECURITY_MANAGER" = "true" ]; then
|
if [ "$RETVAL" -eq "0" -a "$SECURITY_MANAGER" = "true" ]; then
|
||||||
$SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start-security" \
|
$SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start-security" \
|
||||||
>> /var/log/${NAME}/initd.log 2>&1 || RETVAL="4"
|
>> ${TOMCAT_LOG} 2>&1 || RETVAL="4"
|
||||||
else
|
else
|
||||||
|
|
||||||
[ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start" >> /var/log/${NAME}/initd.log 2>&1 || RETVAL="4"
|
[ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start" >> ${TOMCAT_LOG} 2>&1 || RETVAL="4"
|
||||||
fi
|
fi
|
||||||
if [ "$RETVAL" -eq "0" ]; then
|
if [ "$RETVAL" -eq "0" ]; then
|
||||||
log_success_msg
|
log_success_msg
|
||||||
@ -206,7 +206,7 @@ function stop() {
|
|||||||
parseOptions
|
parseOptions
|
||||||
if [ "$RETVAL" -eq "0" ]; then
|
if [ "$RETVAL" -eq "0" ]; then
|
||||||
touch /var/lock/subsys/${NAME} 2>&1 || RETVAL="4"
|
touch /var/lock/subsys/${NAME} 2>&1 || RETVAL="4"
|
||||||
[ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> /var/log/${NAME}/initd.log 2>&1 || RETVAL="4"
|
[ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> ${TOMCAT_LOG} 2>&1 || RETVAL="4"
|
||||||
fi
|
fi
|
||||||
if [ "$RETVAL" -eq "0" ]; then
|
if [ "$RETVAL" -eq "0" ]; then
|
||||||
count="0"
|
count="0"
|
||||||
|
@ -1,13 +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]
|
[Unit]
|
||||||
Description=Release implementation for Servlet 3.0 and JSP 2.2
|
Description=Apache Tomcat Web Application Container
|
||||||
After=syslog.target network.target
|
After=syslog.target network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=/var/run/tomcat.pid
|
ExecStart=/usr/sbin/tomcat-sysd start
|
||||||
EnvironmentFile=/etc/sysconfig/tomcat
|
ExecStop=/usr/sbin/tomcat-sysd stop
|
||||||
ExecStart=/etc/init.d/tomcat start
|
|
||||||
ExecStop=/etc/init.d/tomcat stop
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
61
tomcat.spec
61
tomcat.spec
@ -54,7 +54,7 @@
|
|||||||
Name: tomcat
|
Name: tomcat
|
||||||
Epoch: 0
|
Epoch: 0
|
||||||
Version: %{major_version}.%{minor_version}.%{micro_version}
|
Version: %{major_version}.%{minor_version}.%{micro_version}
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API
|
Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API
|
||||||
|
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
@ -77,6 +77,7 @@ Source13: jasper-el-OSGi-MANIFEST.MF
|
|||||||
Source14: jasper-OSGi-MANIFEST.MF
|
Source14: jasper-OSGi-MANIFEST.MF
|
||||||
Source15: tomcat-api-OSGi-MANIFEST.MF
|
Source15: tomcat-api-OSGi-MANIFEST.MF
|
||||||
Source16: tomcat-juli-OSGi-MANIFEST.MF
|
Source16: tomcat-juli-OSGi-MANIFEST.MF
|
||||||
|
Source17: %{name}-%{major_version}.%{minor_version}-tomcat-sysd
|
||||||
Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch
|
Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch
|
||||||
Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch
|
Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch
|
||||||
|
|
||||||
@ -97,6 +98,7 @@ BuildRequires: junit
|
|||||||
BuildRequires: log4j
|
BuildRequires: log4j
|
||||||
BuildRequires: geronimo-jaxrpc
|
BuildRequires: geronimo-jaxrpc
|
||||||
BuildRequires: wsdl4j
|
BuildRequires: wsdl4j
|
||||||
|
BuildRequires: systemd-units
|
||||||
Requires: apache-commons-daemon
|
Requires: apache-commons-daemon
|
||||||
Requires: apache-commons-logging
|
Requires: apache-commons-logging
|
||||||
Requires: apache-commons-collections
|
Requires: apache-commons-collections
|
||||||
@ -110,8 +112,9 @@ Requires(post): chkconfig
|
|||||||
Requires(preun): chkconfig
|
Requires(preun): chkconfig
|
||||||
Requires(post): redhat-lsb
|
Requires(post): redhat-lsb
|
||||||
Requires(preun): redhat-lsb
|
Requires(preun): redhat-lsb
|
||||||
Requires(post): jpackage-utils
|
Requires(post): systemd-units
|
||||||
Requires(postun): jpackage-utils
|
Requires(preun): systemd-units
|
||||||
|
Requires(postun): systemd-units
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Tomcat is the servlet container that is used in the official Reference
|
Tomcat is the servlet container that is used in the official Reference
|
||||||
@ -147,6 +150,14 @@ Requires: jpackage-utils
|
|||||||
%description javadoc
|
%description javadoc
|
||||||
Javadoc generated documentation for Apache Tomcat.
|
Javadoc generated documentation for Apache Tomcat.
|
||||||
|
|
||||||
|
%package systemv
|
||||||
|
Group: System Environment/Daemons
|
||||||
|
Summary: Systemv scripts for Apache Tomcat
|
||||||
|
Requires: %{name} = %{epoch}:%{version}-%{release}
|
||||||
|
|
||||||
|
%description systemv
|
||||||
|
SystemV scripts to start and stop tomcat service
|
||||||
|
|
||||||
%package jsp-%{jspspec}-api
|
%package jsp-%{jspspec}-api
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
Summary: Apache Tomcat JSP API implementation classes
|
Summary: Apache Tomcat JSP API implementation classes
|
||||||
@ -308,6 +319,7 @@ zip -u output/build/bin/tomcat-juli.jar META-INF/MANIFEST.MF
|
|||||||
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{homedir}
|
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{homedir}
|
||||||
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{tempdir}
|
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{tempdir}
|
||||||
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{workdir}
|
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{workdir}
|
||||||
|
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_unitdir}
|
||||||
|
|
||||||
# move things into place
|
# move things into place
|
||||||
# First copy supporting libs to tomcat lib
|
# First copy supporting libs to tomcat lib
|
||||||
@ -334,7 +346,9 @@ popd
|
|||||||
%{__install} -m 0644 %{SOURCE4} \
|
%{__install} -m 0644 %{SOURCE4} \
|
||||||
${RPM_BUILD_ROOT}%{_sbindir}/%{name}
|
${RPM_BUILD_ROOT}%{_sbindir}/%{name}
|
||||||
%{__install} -m 0644 %{SOURCE11} \
|
%{__install} -m 0644 %{SOURCE11} \
|
||||||
${RPM_BUILD_ROOT}%{_systemddir}/%{name}.service
|
${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service
|
||||||
|
%{__install} -m 0644 %{SOURCE17} \
|
||||||
|
${RPM_BUILD_ROOT}%{_sbindir}/%{name}-sysd
|
||||||
%{__ln_s} %{name} ${RPM_BUILD_ROOT}%{_sbindir}/d%{name}
|
%{__ln_s} %{name} ${RPM_BUILD_ROOT}%{_sbindir}/d%{name}
|
||||||
%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \
|
%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \
|
||||||
> ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}
|
> ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}
|
||||||
@ -444,7 +458,10 @@ done
|
|||||||
%post
|
%post
|
||||||
# install but don't activate
|
# install but don't activate
|
||||||
/sbin/chkconfig --add %{name}
|
/sbin/chkconfig --add %{name}
|
||||||
%update_maven_depmap
|
if [ $1 -eq 1 ]; then
|
||||||
|
#initial installation
|
||||||
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
%post jsp-%{jspspec}-api
|
%post jsp-%{jspspec}-api
|
||||||
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \
|
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \
|
||||||
@ -453,7 +470,6 @@ done
|
|||||||
%post servlet-%{servletspec}-api
|
%post servlet-%{servletspec}-api
|
||||||
%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \
|
%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \
|
||||||
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar 20500
|
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar 20500
|
||||||
%update_maven_depmap
|
|
||||||
|
|
||||||
%post el-%{elspec}-api
|
%post el-%{elspec}-api
|
||||||
%{_sbindir}/update-alternatives --install %{_javadir}/elspec.jar elspec \
|
%{_sbindir}/update-alternatives --install %{_javadir}/elspec.jar elspec \
|
||||||
@ -465,11 +481,18 @@ done
|
|||||||
if [ "$1" = "0" ]; then
|
if [ "$1" = "0" ]; then
|
||||||
%{_initrddir}/%{name} stop >/dev/null 2>&1
|
%{_initrddir}/%{name} stop >/dev/null 2>&1
|
||||||
/sbin/chkconfig --del %{name}
|
/sbin/chkconfig --del %{name}
|
||||||
|
# package removal, not upgrade
|
||||||
|
/bin/systemctl --no-reload disable tomcat.service > /dev/null 2>&1 || :
|
||||||
|
/bin/systemctl stop tomcat.service > /dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%update_maven_depmap
|
/bin/systemctl daemon-reload > /dev/null 2>&1 || :
|
||||||
|
if [ $1 -ge 1 ]; then
|
||||||
|
#package upgrade, not uninstall
|
||||||
|
/bin/systemctl try-restart tomcat.service > /dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
%postun jsp-%{jspspec}-api
|
%postun jsp-%{jspspec}-api
|
||||||
if [ "$1" = "0" ]; then
|
if [ "$1" = "0" ]; then
|
||||||
@ -481,7 +504,6 @@ fi
|
|||||||
if [ "$1" = "0" ]; then
|
if [ "$1" = "0" ]; then
|
||||||
%{_sbindir}/update-alternatives --remove servlet \
|
%{_sbindir}/update-alternatives --remove servlet \
|
||||||
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar
|
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar
|
||||||
%update_maven_depmap
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%postun el-%{elspec}-api
|
%postun el-%{elspec}-api
|
||||||
@ -490,15 +512,20 @@ if [ "$1" = "0" ]; then
|
|||||||
%{_javadir}/%{name}-el-%{elspec}-api.jar
|
%{_javadir}/%{name}-el-%{elspec}-api.jar
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
%triggerun -- tomcat < 0:7.0.22-2
|
||||||
|
/usr/bin/systemd-sysv-convert -- save tomcat > /dev/null 2>&1 || :
|
||||||
|
# Run these becasue the SysV package being removed won't do them
|
||||||
|
/sbin/chkconfig --del tomcat > /dev/null 2>&1 || :
|
||||||
|
/bin/systemctl try-restart tomcat.service > /dev/null 2>&1 || :
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(0664,root,tomcat,0755)
|
%defattr(0664,root,tomcat,0755)
|
||||||
%doc {LICENSE,NOTICE,RELEASE*}
|
%doc {LICENSE,NOTICE,RELEASE*}
|
||||||
%attr(0755,root,root) %{_bindir}/%{name}-digest
|
%attr(0755,root,root) %{_bindir}/%{name}-digest
|
||||||
%attr(0755,root,root) %{_bindir}/%{name}-tool-wrapper
|
%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) %{_sbindir}/%{name}
|
||||||
%attr(0755,root,root) %{_initrddir}/%{name}
|
%attr(0644,root,root) %{_unitdir}/%{name}.service
|
||||||
%attr(0644,root,root) %{_systemddir}/%{name}.service
|
%attr(0755,root,root) %{_sbindir}/%{name}-sysd
|
||||||
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
|
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
|
||||||
%attr(0755,root,tomcat) %dir %{basedir}
|
%attr(0755,root,tomcat) %dir %{basedir}
|
||||||
@ -582,7 +609,17 @@ fi
|
|||||||
%{appdir}/examples
|
%{appdir}/examples
|
||||||
%{appdir}/sample
|
%{appdir}/sample
|
||||||
|
|
||||||
|
%files systemv
|
||||||
|
%defattr(755,root,root,0755)
|
||||||
|
%{_sbindir}/d%{name}
|
||||||
|
%{_initrddir}/%{name}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Nov 11 2011 Ivan Afonichev <ivan.afonichev@gmail.com> 0:7.0.22-2
|
||||||
|
- Move tomcat-juli.jar to lib package
|
||||||
|
- Drop %%update_maven_depmap as in tomcat6
|
||||||
|
- Provide native systemd unit file ported from tomcat6
|
||||||
|
|
||||||
* Thu Oct 6 2011 Ivan Afonichev <ivan.afonichev@gmail.com> 0:7.0.22-1
|
* Thu Oct 6 2011 Ivan Afonichev <ivan.afonichev@gmail.com> 0:7.0.22-1
|
||||||
- Updated to 7.0.22
|
- Updated to 7.0.22
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user