From 41ff5cd14d1efbcc9a9be2f64ae2186a680f6c2f Mon Sep 17 00:00:00 2001 From: dwalluck Date: Mon, 13 Oct 2008 20:15:33 +0000 Subject: [PATCH] - use lsb_release instead of lsb-release to get the distributor 6.0.18-5 - fix initscript messages on Mandriva Linux - fix help message in initscript 6.0.18-4 - redefine %%_initrddir for FHS-compliance - make initscript LSB-complaint 6.0.18-3 - fix status in initscript 6.0.18-2 - remove initscripts and /sbin/service requirement - call initscript directly without using /sbin/service - require /sbin/chkconfig instead of chkconfig - remove chkconfig requirement from packages that don't require it --- tomcat6-6.0.init | 58 +++++++++++++++++++++++++++++++++--------------- tomcat6.spec | 44 +++++++++++++++++++++++++----------- 2 files changed, 71 insertions(+), 31 deletions(-) diff --git a/tomcat6-6.0.init b/tomcat6-6.0.init index 1d3ee42..930c0fc 100644 --- a/tomcat6-6.0.init +++ b/tomcat6-6.0.init @@ -18,8 +18,16 @@ # - heavily rewritten by Deepak Bhole and Jason Corley # -# Source function library. -. /etc/rc.d/init.d/functions +## Source function library. +#. /etc/rc.d/init.d/functions +# 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 @@ -137,9 +145,12 @@ function start() { if [ -f "/var/lock/subsys/${NAME}" ] ; then if [ -f "/var/run/${NAME}.pid" ]; then read kpid < /var/run/${NAME}.pid - if checkpid $kpid 2>&1; then - echo_success - echo +# if checkpid $kpid 2>&1; then + if [ -d "/proc/${kpid}" ]; then + log_success_msg + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo + fi return 0 fi fi @@ -169,12 +180,14 @@ function start() { fi RETVAL="$?" if [ "$RETVAL" -eq 0 ]; then - echo_success + log_success_msg touch /var/lock/subsys/${NAME} else - echo_failure + log_failure_msg + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo fi - echo return $RETVAL } @@ -203,16 +216,18 @@ function stop() { fi kill -9 $kpid fi - echo_success + log_success_msg fi rm -f /var/lock/subsys/${NAME} /var/run/${NAME}.pid else - echo_failure + log_failure_msg fi else - echo_success + log_success_msg + fi + if [ "$DISTRIB_ID" = "MandrivaLinux" ]; then + echo fi - echo return $RETVAL } @@ -245,13 +260,20 @@ case "$1" in ;; status) if [ -f "/var/run/${NAME}.pid" ]; then - status ${NAME} - RETVAL="$?" +# status ${NAME} +# RETVAL="$?" + read kpid < /var/run/${NAME}.pid + if [ -d "/proc/${kpid}" ]; then + echo "${NAME} (pid ${kpid}) is running..." + RETVAL="0" + fi else - pid="$(/usr/bin/pgrep -d , -u tomcat -G tomcat java)" + pid="$(/usr/bin/pgrep -d , -u ${TOMCAT_USER} -G ${TOMCAT_USER} java)" if [ -z "$pid" ]; then - status ${NAME} - RETVAL="$?" +# status ${NAME} +# RETVAL="$?" + echo "${NAME} is stopped" + RETVAL="3" else echo "${NAME} (pid $pid) is running..." RETVAL="0" @@ -262,7 +284,7 @@ case "$1" in ${TOMCAT_SCRIPT} version ;; *) - echo -n "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|version}" + echo "Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|version}" RETVAL="2" esac diff --git a/tomcat6.spec b/tomcat6.spec index fb1bcec..32564f4 100644 --- a/tomcat6.spec +++ b/tomcat6.spec @@ -47,11 +47,12 @@ %define logdir %{_var}/log/%{name} %define tempdir %{_var}/cache/%{name}/temp %define workdir %{_var}/cache/%{name}/work +%define _initrddir %{_sysconfdir}/init.d Name: tomcat6 Epoch: 0 Version: %{major_version}.%{minor_version}.%{micro_version} -Release: 1.1%{?dist} +Release: 6.1%{?dist} Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API Group: Networking/Daemons @@ -76,20 +77,20 @@ BuildRequires: ecj BuildRequires: findutils BuildRequires: jakarta-commons-collections BuildRequires: jakarta-commons-daemon -BuildRequires: java-1.6.0-devel +BuildRequires: java-devel BuildRequires: jpackage-utils >= 0:1.7.0 BuildRequires: junit Requires(pre): shadow-utils Requires(pre): shadow-utils Requires: jakarta-commons-daemon Requires: jakarta-commons-logging -Requires: java-1.6.0 +Requires: java Requires: procps Requires: %{name}-lib = %{epoch}:%{version}-%{release} -Requires(post): chkconfig -Requires(preun): chkconfig -# for /sbin/service -Requires(preun): initscripts +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +Requires(post): /lib/lsb/init-functions +Requires(preun): /lib/lsb/init-functions %description Tomcat is the servlet container that is used in the official Reference @@ -130,8 +131,6 @@ Summary: Apache Tomcat JSP API implementation classes Provides: jsp = %{jspspec} Provides: jsp21 Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} -Requires(post): chkconfig -Requires(postun): chkconfig %description jsp-%{jspspec}-api Apache Tomcat JSP API implementation classes. @@ -142,6 +141,7 @@ Summary: Libraries needed to run the Tomcat Web container Requires: %{name}-jsp-%{jspspec}-api = %{epoch}:%{version}-%{release} Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} Requires(post): ecj +Requires(post): %{_javadir}/ecj.jar Requires(post): jakarta-commons-collections-tomcat5 Requires(post): jakarta-commons-dbcp-tomcat5 Requires(post): jakarta-commons-pool-tomcat5 @@ -156,8 +156,6 @@ Summary: Apache Tomcat Servlet API implementation classes Provides: servlet = %{servletspec} Provides: servlet6 Provides: servlet25 -Requires(post): chkconfig -Requires(postun): chkconfig %description servlet-%{servletspec}-api Apache Tomcat Servlet API implementation classes. @@ -352,7 +350,7 @@ popd # clean tempdir and workdir on removal or upgrade %{__rm} -rf %{workdir}/* %{tempdir}/* if [ "$1" = "0" ]; then - /sbin/service %{name} stop >/dev/null 2>&1 + %{_initrddir}/%{name} stop >/dev/null 2>&1 /sbin/chkconfig --del %{name} fi @@ -434,7 +432,27 @@ fi %{appdir}/sample %changelog -* Tue Aug 26 2008 David Walluck 0:6.0.18-1.1 +* Tue Oct 07 2008 David Walluck 0:6.0.18-6.1 +- use lsb_release instead of lsb-release to get the distributor + +* Tue Oct 07 2008 David Walluck 0:6.0.18-5 +- fix initscript messages on Mandriva Linux +- fix help message in initscript + +* Wed Oct 01 2008 David Walluck 0:6.0.18-4 +- redefine %%_initrddir for FHS-compliance +- make initscript LSB-complaint + +* Fri Sep 26 2008 David Walluck 0:6.0.18-3 +- fix status in initscript + +* Thu Sep 25 2008 David Walluck 0:6.0.18-2 +- remove initscripts and /sbin/service requirement +- call initscript directly without using /sbin/service +- require /sbin/chkconfig instead of chkconfig +- remove chkconfig requirement from packages that don't require it + +* Tue Aug 26 2008 David Walluck 0:6.0.18-1 - 6.0.18 - Resolves: CVE-2008-1232, CVE-2008-1947, CVE-2008-2370, CVE-2008-2938 - fix definition of java.security.policy with d%%{name} start-security