- Updated to 7.0.29
- Add pidfile as tmpfile - Use systemd for running as unprivileged user - Resolves: rhbz 847751 upgrade path was broken - Resolves: rhbz 850343 use new systemd-rpm macros Merge branch 'f17' of ssh://pkgs.fedoraproject.org/tomcat Conflicts: tomcat.spec
This commit is contained in:
commit
18fb32c606
2
sources
2
sources
@ -1 +1 @@
|
||||
b84c51041fdd42e3e08747d6c4db6d30 apache-tomcat-7.0.28-src.tar.gz
|
||||
16b9f637e5ca623cf87a2a1514c8978e apache-tomcat-7.0.29-src.tar.gz
|
||||
|
@ -9,7 +9,7 @@
|
||||
# SERVICE_NAME is a required value only if the service name is
|
||||
# different from 'tomcat'
|
||||
#
|
||||
NAME="${SERVICE_NAME:-tomcat}"
|
||||
export NAME="${SERVICE_NAME:-tomcat}"
|
||||
|
||||
#I'll bet this isn't required.
|
||||
# unset ISBOOT
|
||||
@ -42,47 +42,25 @@ 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
|
||||
${TOMCAT_SCRIPT} start-security >> $TOMCAT_LOG 2>&1
|
||||
else
|
||||
$SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start" >> $TOMCAT_LOG 2>&1
|
||||
${TOMCAT_SCRIPT} start #>> $TOMCAT_LOG 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
function stop() {
|
||||
parseOptions
|
||||
$SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1
|
||||
${TOMCAT_SCRIPT} stop >> $TOMCAT_LOG 2>&1
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
|
@ -149,7 +149,7 @@ function start() {
|
||||
return
|
||||
fi
|
||||
if [ -f "/var/lock/subsys/${NAME}" ]; then
|
||||
if [ -f "/var/run/${NAME}.pid" ]; then
|
||||
if [ -s "/var/run/${NAME}.pid" ]; then
|
||||
read kpid < /var/run/${NAME}.pid
|
||||
# if checkpid $kpid 2>&1; then
|
||||
if [ -d "/proc/${kpid}" ]; then
|
||||
@ -210,7 +210,7 @@ function stop() {
|
||||
fi
|
||||
if [ "$RETVAL" -eq "0" ]; then
|
||||
count="0"
|
||||
if [ -f "/var/run/${NAME}.pid" ]; then
|
||||
if [ -s "/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
|
||||
@ -262,7 +262,7 @@ case "$1" in
|
||||
start
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
if [ -f "/var/run/${NAME}.pid" ]; then
|
||||
if [ -s "/var/run/${NAME}.pid" ]; then
|
||||
stop
|
||||
start
|
||||
fi
|
||||
@ -271,13 +271,13 @@ case "$1" in
|
||||
RETVAL="3"
|
||||
;;
|
||||
force-reload)
|
||||
if [ -f "/var/run/${NAME}.pid" ]; then
|
||||
if [ -s "/var/run/${NAME}.pid" ]; then
|
||||
stop
|
||||
start
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
if [ -f "/var/run/${NAME}.pid" ]; then
|
||||
if [ -s "/var/run/${NAME}.pid" ]; then
|
||||
read kpid < /var/run/${NAME}.pid
|
||||
if [ -d "/proc/${kpid}" ]; then
|
||||
log_success_msg "${NAME} (pid ${kpid}) is running..."
|
||||
|
@ -14,6 +14,9 @@ After=syslog.target network.target
|
||||
Type=forking
|
||||
ExecStart=/usr/sbin/tomcat-sysd start
|
||||
ExecStop=/usr/sbin/tomcat-sysd stop
|
||||
User=tomcat
|
||||
Group=tomcat
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -8,16 +8,20 @@ else
|
||||
fi
|
||||
|
||||
# Get the tomcat config (use this for environment specific settings)
|
||||
#if [ -z "${TOMCAT_CFG}" ]; then
|
||||
# TOMCAT_CFG="/etc/tomcat/tomcat.conf"
|
||||
#fi
|
||||
if [ -z "${TOMCAT_CFG}" ]; then
|
||||
TOMCAT_CFG="/etc/tomcat/tomcat.conf"
|
||||
fi
|
||||
|
||||
#if [ -r "$TOMCAT_CFG" ]; then
|
||||
# . $TOMCAT_CFG
|
||||
#fi
|
||||
if [ -r "$TOMCAT_CFG" ]; then
|
||||
. $TOMCAT_CFG
|
||||
fi
|
||||
|
||||
# Get instance specific config file
|
||||
if [ -r "/etc/sysconfig/${NAME}" ]; then
|
||||
. /etc/sysconfig/${NAME}
|
||||
fi
|
||||
|
||||
set_javacmd
|
||||
|
||||
# CLASSPATH munging
|
||||
if [ -n "$JSSE_HOME" ]; then
|
||||
CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)"
|
||||
|
38
tomcat.spec
38
tomcat.spec
@ -31,7 +31,7 @@
|
||||
%global jspspec 2.2
|
||||
%global major_version 7
|
||||
%global minor_version 0
|
||||
%global micro_version 28
|
||||
%global micro_version 29
|
||||
%global packdname apache-tomcat-%{version}-src
|
||||
%global servletspec 3.0
|
||||
%global elspec 2.2
|
||||
@ -54,7 +54,7 @@
|
||||
Name: tomcat
|
||||
Epoch: 0
|
||||
Version: %{major_version}.%{minor_version}.%{micro_version}
|
||||
Release: 2%{?dist}
|
||||
Release: 1%{?dist}
|
||||
Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API
|
||||
|
||||
Group: System Environment/Daemons
|
||||
@ -324,6 +324,8 @@ zip -u output/build/bin/tomcat-juli.jar META-INF/MANIFEST.MF
|
||||
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{libdir}
|
||||
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{logdir}
|
||||
/bin/touch ${RPM_BUILD_ROOT}%{logdir}/catalina.out
|
||||
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{_localstatedir}/run
|
||||
/bin/touch ${RPM_BUILD_ROOT}%{_localstatedir}/run/%{name}.pid
|
||||
/bin/echo "%{name}-%{major_version}.%{minor_version}.%{micro_version} RPM installed" >> ${RPM_BUILD_ROOT}%{logdir}/catalina.out
|
||||
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{homedir}
|
||||
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{tempdir}
|
||||
@ -472,6 +474,11 @@ done
|
||||
# replace temporary copy with link
|
||||
%{__ln_s} -f %{bindir}/tomcat-juli.jar ${RPM_BUILD_ROOT}%{libdir}/
|
||||
|
||||
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/lib/tmpfiles.d
|
||||
cat > ${RPM_BUILD_ROOT}%{_prefix}/lib/tmpfiles.d/%{name}.conf <<EOF
|
||||
f %{_localstatedir}/run/%{name}.pid 0644 tomcat tomcat -
|
||||
EOF
|
||||
|
||||
|
||||
%pre
|
||||
# add the tomcat user and group
|
||||
@ -481,10 +488,7 @@ done
|
||||
|
||||
%post
|
||||
# install but don't activate
|
||||
if [ $1 -eq 1 ]; then
|
||||
#initial installation
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
fi
|
||||
%systemd_post %{name}.service
|
||||
|
||||
%post systemv
|
||||
# install but don't activate
|
||||
@ -509,19 +513,10 @@ fi
|
||||
%preun
|
||||
# clean tempdir and workdir on removal or upgrade
|
||||
%{__rm} -rf %{workdir}/* %{tempdir}/*
|
||||
if [ "$1" = "0" ]; then
|
||||
# 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
|
||||
%systemd_preun %{name}.service
|
||||
|
||||
%postun
|
||||
/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
|
||||
|
||||
%systemd_postun_with_restart %{name}.service
|
||||
|
||||
%postun jsp-%{jspspec}-api
|
||||
if [ "$1" = "0" ]; then
|
||||
@ -562,6 +557,7 @@ fi
|
||||
%defattr(0664,root,tomcat,0770)
|
||||
%attr(0770,root,tomcat) %dir %{logdir}
|
||||
%attr(0660,tomcat,tomcat) %{logdir}/catalina.out
|
||||
%attr(0644,tomcat,tomcat) %{_localstatedir}/run/%{name}.pid
|
||||
%attr(0770,root,tomcat) %dir %{cachedir}
|
||||
%attr(0770,root,tomcat) %dir %{tempdir}
|
||||
%attr(0770,root,tomcat) %dir %{workdir}
|
||||
@ -577,6 +573,7 @@ fi
|
||||
%attr(0660,tomcat,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml
|
||||
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/web.xml
|
||||
%dir %{homedir}
|
||||
%{_prefix}/lib/tmpfiles.d/%{name}.conf
|
||||
%{bindir}/bootstrap.jar
|
||||
%{bindir}/catalina-tasks.xml
|
||||
%{homedir}/lib
|
||||
@ -660,6 +657,13 @@ fi
|
||||
%attr(0644,root,root) %{_unitdir}/%{name}-jsvc.service
|
||||
|
||||
%changelog
|
||||
* Fri Aug 24 2012 Ivan Afonichev <ivan.afonichev@gmail.com> 0:7.0.29-1
|
||||
- Updated to 7.0.29
|
||||
- Add pidfile as tmpfile
|
||||
- Use systemd for running as unprivileged user
|
||||
- Resolves: rhbz 847751 upgrade path was broken
|
||||
- Resolves: rhbz 850343 use new systemd-rpm macros
|
||||
|
||||
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0:7.0.28-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user