rpms/tomcat5/devel tomcat5-5.5-catalina.sh.patch, 1.2, 1.3 tomcat5-5.5.conf, 1.2, 1.3 tomcat5-5.5.init, 1.2, 1.3 tomcat5-5.5.relink, 1.3, 1.4 tomcat5.spec, 1.93, 1.94

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Oct 4 20:19:06 UTC 2006


Author: fnasser

Update of /cvs/dist/rpms/tomcat5/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv23797

Modified Files:
	tomcat5-5.5-catalina.sh.patch tomcat5-5.5.conf 
	tomcat5-5.5.init tomcat5-5.5.relink tomcat5.spec 
Log Message:
Merge with upstream



tomcat5-5.5-catalina.sh.patch:
 catalina.sh |   90 +++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 71 insertions(+), 19 deletions(-)

Index: tomcat5-5.5-catalina.sh.patch
===================================================================
RCS file: /cvs/dist/rpms/tomcat5/devel/tomcat5-5.5-catalina.sh.patch,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tomcat5-5.5-catalina.sh.patch	5 Jul 2006 22:50:50 -0000	1.2
+++ tomcat5-5.5-catalina.sh.patch	4 Oct 2006 20:19:04 -0000	1.3
@@ -1,16 +1,18 @@
 --- container/catalina/src/bin/catalina.sh.sav	2006-03-23 17:04:08.000000000 +0100
 +++ container/catalina/src/bin/catalina.sh	2006-03-23 17:12:52.000000000 +0100
-@@ -52,6 +52,9 @@
+@@ -52,6 +52,11 @@
  Darwin*) darwin=true;;
  esac
  
-+TOMCAT_CFG="@@@TCCONF@@@/tomcat5.conf"
++if [ -z "$CATALINA_HOME" ]; then
++    TOMCAT_CFG="@@@TCCONF@@@/tomcat5.conf"
++fi
 +JAVADIR="/usr/share/java"
 +
  # resolve links - $0 may be a softlink
  PRG="$0"
  
-@@ -97,30 +100,71 @@
+@@ -97,30 +100,73 @@
    export QIBM_MULTI_THREADED=Y
  fi
  
@@ -31,7 +33,9 @@
 -    echo "This file is needed to run this program"
 -    exit 1
 -  fi
-+[ -r "$TOMCAT_CFG" ] && . "${TOMCAT_CFG}"
++if [ -z "$CATALINA_HOME" ]; then
++    [ -r "$TOMCAT_CFG" ] && . "${TOMCAT_CFG}"
++fi
 +
 +### Set up defaults if they were omitted in TOMCAT_CFG
 +###  JVM lookup
@@ -100,7 +104,7 @@
  
  if [ -z "$CATALINA_BASE" ] ; then
    CATALINA_BASE="$CATALINA_HOME"
-@@ -131,6 +175,10 @@
+@@ -131,6 +179,10 @@
    CATALINA_TMPDIR="$CATALINA_BASE"/temp
  fi
  
@@ -111,7 +115,7 @@
  # For Cygwin, switch paths to Windows format before running java
  if $cygwin; then
    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
-@@ -290,7 +338,7 @@
+@@ -290,7 +342,7 @@
  
  else
  


Index: tomcat5-5.5.conf
===================================================================
RCS file: /cvs/dist/rpms/tomcat5/devel/tomcat5-5.5.conf,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tomcat5-5.5.conf	5 Jul 2006 22:50:50 -0000	1.2
+++ tomcat5-5.5.conf	4 Oct 2006 20:19:04 -0000	1.3
@@ -32,6 +32,9 @@
 # Set the TOMCAT_PID location
 CATALINA_PID=/var/run/tomcat5.pid
 
+# Connector port is 8080 for this tomcat5 instance
+#CONNECTOR_PORT=8080
+
 # If you wish to further customize your tomcat environment,
 # put your own definitions here
 # (i.e. LD_LIBRARY_PATH for some jdbc drivers)


Index: tomcat5-5.5.init
===================================================================
RCS file: /cvs/dist/rpms/tomcat5/devel/tomcat5-5.5.init,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tomcat5-5.5.init	5 Jul 2006 22:50:50 -0000	1.2
+++ tomcat5-5.5.init	4 Oct 2006 20:19:04 -0000	1.3
@@ -41,6 +41,14 @@
 . /etc/rc.d/init.d/functions
 fi
 
+NAME=`basename $0`
+unset ISBOOT
+if [ ${NAME:0:1} = "S" -o ${NAME:0:1} = "K" ]
+then
+        NAME=${NAME:3}
+        ISBOOT=1
+fi
+
 # For SELinux we need to use 'runuser' not 'su'
 if [ -x /sbin/runuser ]
 then
@@ -55,14 +63,20 @@
 
 [ -r "$TOMCAT_CFG" ] && . "${TOMCAT_CFG}"
 
+# Get instance specific config file
+[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
+
+#define which connector port to use
+CONNECTOR_PORT=${CONNECTOR_PORT:-"8080"}
+
 # Path to the tomcat launch script (direct don't use wrapper)
 TOMCAT_SCRIPT=/usr/bin/dtomcat5
 
 # Path to the script that will refresh jar symlinks on startup
-TOMCAT_RELINK_SCRIPT="/usr/share/tomcat5/bin/relink"
+TOMCAT_RELINK_SCRIPT="$CATALINA_HOME/bin/relink"
 
 # Tomcat name :)
-TOMCAT_PROG=tomcat5
+TOMCAT_PROG=$NAME
         
 # if TOMCAT_USER is not set, use tomcat5 like Apache HTTP server
 if [ -z "$TOMCAT_USER" ]; then
@@ -76,13 +90,38 @@
 
 RETVAL=0
 
+function findFreePorts {
+   lower=8000
+   randomPort1=0
+   randomPort2=0
+   randomPort3=0
+   for ((  i = 0 ;  i <= 20;  i++  )); do
+      RANDOM=$(date +%s)
+      randomPort1=$((RANDOM%2000+lower))
+      randomPort2=$((RANDOM%2000+lower))
+      randomPort3=$((RANDOM%2000+lower))
+      `netstat -apntl|grep $randomPort1`
+      ret1=$?
+      `netstat -apntl|grep $randomPort2`
+      ret2=$?
+      `netstat -apntl|grep $randomPort3`
+      ret3=$?
+      if [ $ret1 -eq 1 ] && [ $ret2 -eq 1 ] && [ $ret3 -eq 1 ]; then
+         return
+      fi
+   done
+   randomPort1=0
+   randomPort2=0
+   randomPort3=0
+}
+
 # See how we were called.
 start() {
     echo -n "Starting $TOMCAT_PROG: "
 
-	if [ -f /var/lock/subsys/tomcat5 ] ; then
- 		if [ -f /var/run/tomcat5.pid ]; then
-   	      		read kpid < /var/run/tomcat5.pid
+	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 "process allready running"
              			return -1
@@ -92,30 +131,82 @@
  		fi
  	fi
  
- 	export CATALINA_PID=/var/run/tomcat5.pid
+ 	export CATALINA_PID=/var/run/$NAME.pid
  	touch $CATALINA_PID
  	chown $TOMCAT_USER:$TOMCAT_USER $CATALINA_PID
 
+        if [ $CATALINA_HOME != "/usr/share/tomcat5" ]; then
+            # if CATALINA_HOME does not exist
+            if [ ! -d "$CATALINA_HOME" ]; then
+                if [ ! -d "/var/lib/$NAME" ]; then
+                    mkdir -p /var/lib/$NAME
+                    cp -pL -R /var/lib/tomcat5/* /var/lib/$NAME
+                fi
+                mkdir -p $CATALINA_HOME
+                cp -pL -R /usr/share/tomcat5/bin $CATALINA_HOME
+                ln -fs /var/lib/$NAME/common $CATALINA_HOME/common
+                mkdir -p $CATALINA_HOME/conf
+                cp -pL -R /etc/tomcat5/* $CATALINA_HOME/conf/
+                mkdir -p /var/log/$NAME
+                chown $TOMCAT_USER:$TOMCAT_USER /var/log/$NAME
+                ln -fs /var/log/$NAME $CATALINA_HOME/logs
+                ln -fs /var/lib/$NAME/server $CATALINA_HOME/server
+                ln -fs /var/lib/$NAME/shared $CATALINA_HOME/shared
+                mkdir -p /var/cache/$NAME/temp
+                ln -fs /var/cache/$NAME/temp $CATALINA_HOME/temp
+                ln -fs /var/lib/$NAME/webapps $CATALINA_HOME/webapps
+                mkdir -p /var/cache/$NAME/work
+                ln -fs /var/cache/$NAME/work $CATALINA_HOME/work
+                cp -pL -R /var/cache/tomcat5/work/* $CATALINA_HOME/work/
+            fi
+            # modify port number so that multiple instances doesn't
+            # interfere with each other.
+            findFreePorts
+            if [ $randomPort1 -eq 0 ] || [ $randomPort2 -eq 0 ] || [ $randomPort3 -eq 0 ]; then
+                failure $"${NAME} startup"
+                echo "Can't find free ports"
+                return 1;
+            fi
+            cp $CATALINA_HOME/conf/server.xml $CATALINA_HOME/conf/server.xml.orig
+            sed -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.orig >  $CATALINA_HOME/conf/server.xml
+        fi
+
+        options=""
+        for i in `grep -v "^#" /etc/tomcat5/tomcat5.conf |grep -v "^$"`; do
+            j=`echo $i| sed 's/\"//g'`
+            export $j
+            options="${options} export $j ;"
+        done
+        if [ -r /etc/sysconfig/$NAME ]; then
+            for i in `grep -v "^#" /etc/sysconfig/$NAME |grep -v "^$"`; do
+                j=`echo $i| sed 's/\"//g'`
+                export $j
+                options="${options} export $j ;"
+            done
+        fi
+
         $TOMCAT_RELINK_SCRIPT
 
+        TOMCAT_SCRIPT="$options $TOMCAT_SCRIPT"
+
         if [ -x /etc/rc.d/init.d/functions ]; then
-        	daemon --user $TOMCAT_USER $TOMCAT_SCRIPT start 
+        	daemon --user $TOMCAT_USER "$TOMCAT_SCRIPT" start 
     	else
         	$SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start"
     	fi
 
     	RETVAL=$?
     	echo
-    	[ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat5
+    	[ $RETVAL = 0 ] && touch /var/lock/subsys/$NAME
     	return $RETVAL
 }
 
 stop() {
     echo -n "Stopping $TOMCAT_PROG: "
 
-    if [ -f /var/lock/subsys/tomcat5 ] ; then
+    if [ -f /var/lock/subsys/$NAME ] ; then
       if [ -x /etc/rc.d/init.d/functions ]; then
-          daemon --user $TOMCAT_USER $TOMCAT_SCRIPT stop
+          daemon --user $TOMCAT_USER "$TOMCAT_SCRIPT" stop
       else
           $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT stop"
       fi
@@ -124,9 +215,9 @@
       if [ $RETVAL = 0 ]; then
         count=0;
 
-        if [ -f /var/run/tomcat5.pid ]; then
+        if [ -f /var/run/$NAME.pid ]; then
 
-            read kpid < /var/run/tomcat5.pid
+            read kpid < /var/run/$NAME.pid
             let kwait=$SHUTDOWN_WAIT
 
             until [ `ps --pid $kpid | grep -c $kpid` = '0' ] || [ $count -gt $kwait ]
@@ -146,7 +237,7 @@
             fi
         fi
     
-		rm -f /var/lock/subsys/tomcat5 /var/run/tomcat5.pid
+		rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
     fi
 
     fi
@@ -167,7 +258,7 @@
         start
         ;;
   condrestart)
-        if [ -f /var/run/tomcat5.pid ] ; then
+        if [ -f /var/run/$NAME.pid ] ; then
                 stop
                 start
         fi


Index: tomcat5-5.5.relink
===================================================================
RCS file: /cvs/dist/rpms/tomcat5/devel/tomcat5-5.5.relink,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- tomcat5-5.5.relink	27 Jul 2006 16:29:54 -0000	1.3
+++ tomcat5-5.5.relink	4 Oct 2006 20:19:04 -0000	1.4
@@ -3,18 +3,21 @@
 # (c) Nicolas Mailhot, JPackage project 2003
 # $Id$
 
+if [ -z "$CATALINA_HOME" ]; then
+    . @@@TCCONF@@@/tomcat5.conf
+fi
+
 # Load JAVA_HOME
-. @@@TCCONF@@@/tomcat5.conf
 [ -z "$JAVA_HOME" ] && JAVA_HOME=/usr/lib/jvm/java
 
 export JAVA_HOME
 
 # Relink tomcat jar repositories
-for repository in @@@TCCOMMON@@@/lib @@@TCCOMMON@@@/endorsed \
-                  @@@TCSERVER@@@/lib @@@TCSHARED@@@/lib ; do
+for repository in $CATALINA_HOME/common/lib $CATALINA_HOME/common/endorsed \
+                  $CATALINA_HOME/server/lib $CATALINA_HOME/shared/lib ; do
     rebuild-jar-repository $repository
 done
 
-for webapp in $(find @@@TCAPP@@@ -mindepth 1 -maxdepth 2 -type d) ; do
+for webapp in $(find $CATALINA_HOME/webapps -mindepth 1 -maxdepth 2 -type d) ; do
     [ -d "$webapp/WEB-INF/lib" ] && rebuild-jar-repository $webapp/WEB-INF/lib
 done


Index: tomcat5.spec
===================================================================
RCS file: /cvs/dist/rpms/tomcat5/devel/tomcat5.spec,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- tomcat5.spec	30 Aug 2006 19:36:03 -0000	1.93
+++ tomcat5.spec	4 Oct 2006 20:19:04 -0000	1.94
@@ -69,7 +69,7 @@
 Summary: Apache Servlet/JSP Engine, RI for Servlet 2.4/JSP 2.0 API
 Name: tomcat5
 Version: 5.5.17
-Release: 6jpp.2
+Release: 8jpp.1
 Epoch: 0
 License: Apache Software License
 #Vendor: JPackage Project
@@ -570,12 +570,15 @@
 install -d -m 755 $RPM_BUILD_ROOT{%{confdir},%{logdir},%{homedir},%{bindir}}
 install -d -m 755 $RPM_BUILD_ROOT{%{serverdir},%{tempdir},%{workdir}}
 install -d -m 755 $RPM_BUILD_ROOT{%{appdir},%{commondir},%{shareddir}}
-install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/{init.d,logrotate.d}
+install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/{rc.d,logrotate.d}
+install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
 install -d -m 755 $RPM_BUILD_ROOT%{_bindir}
 install -d -m 755 $RPM_BUILD_ROOT%{_javadir}/%{name}
 install -m 755 %{SOURCE5} $RPM_BUILD_ROOT/%{bindir}/relink
 # SysV init and configuration
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/%{name}
+install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
+install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/%{name}
 install %{SOURCE2} $RPM_BUILD_ROOT%{confdir}/%{name}.conf
 pushd $RPM_BUILD_DIR/%{name}-%{version}/%{packdname}/build
     export usejikes=false
@@ -630,9 +633,10 @@
 rm -f  $RPM_BUILD_ROOT%{bindir}/*.sh $RPM_BUILD_ROOT%{bindir}/*.bat
 # FHS compliance patches, not easy to track them all boys :)
 for i in $RPM_BUILD_ROOT%{confdir}/%{name}.conf \
+         $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} \
          $RPM_BUILD_ROOT%{_bindir}/d%{name} \
          $RPM_BUILD_ROOT%{_bindir}/%{name} \
-         $RPM_BUILD_ROOT%{_sysconfdir}/init.d/%{name} \
+         $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/%{name} \
          $RPM_BUILD_ROOT%{bindir}/relink \
          $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}; do
     perl -pi -e "s|\@\@\@TCCONF\@\@\@|%{confdir}|g;" $i
@@ -988,8 +992,8 @@
 # Always clean up workdir and tempdir on upgrade/removal
 rm -fr %{workdir}/* %{tempdir}/*
 if [ $1 = 0 ]; then
-    [ -f /var/lock/subsys/%{name} ] && %{_sysconfdir}/init.d/%{name} stop
-    [ -f %{_sysconfdir}/init.d/%{name} ] && /sbin/chkconfig --del %{name}
+    [ -f /var/lock/subsys/%{name} ] && %{_sysconfdir}/rc.d/init.d/%{name} stop
+    [ -f %{_sysconfdir}/rc.d/init.d/%{name} ] && /sbin/chkconfig --del %{name}
     # Remove automated symlinks
     for repository in %{commondir}/endorsed ; do
         find $repository -name '\[*\]*.jar' -not -type d | xargs rm -f
@@ -1064,7 +1068,7 @@
 %attr(775,root,tomcat) %dir %{confdir}/Catalina/localhost
 %attr(755,root,root) %{_bindir}/*
 %attr(755,root,root) %{bindir}/*
-%attr(755,root,root) %{_sysconfdir}/init.d/%{name}
+%attr(755,root,root) %{_sysconfdir}/rc.d/init.d/%{name}
 %attr(644,root,tomcat) %config(noreplace) %{confdir}/catalina.policy
 %attr(644,root,tomcat) %config(noreplace) %{confdir}/catalina.properties
 %attr(660,root,tomcat) %config(noreplace) %{confdir}/jk2.properties
@@ -1086,6 +1090,7 @@
 %config(noreplace) %{confdir}/workers2.properties
 %config(noreplace) %{confdir}/workers2.properties.minimal
 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
+%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
 %{commondir}/i18n/*
 %attr(-,root,root) %{_libdir}/gcj/%{name}/bootstrap*
 %attr(-,root,root) %{_libdir}/gcj/%{name}/commons-daemon*
@@ -1206,6 +1211,18 @@
 %ghost %doc %{_javadocdir}/%{name}-jsp-%{jspspec}-api
 
 %changelog
+* Wed Oct 4 2006 Fernando Nasser <fnasser at redhat.com> 0:5.5.17-8jpp.1
+- Merge with upstream
+
+* Wed Oct 4 2006 Permaine Cheung <pcheung at redhat.com> 0:5.5.17-8jpp
+- Fix condrestart in init script and location of init script in the spec file.
+
+* Mon Oct 2 2006 Permaine Cheung <pcheung at redhat.com> 0:5.5.17-7jpp
+- Add the new config file, and add the CONNECTOR_PORT variable in it.
+
+* Mon Oct 2 2006 Permaine Cheung <pcheung at redhat.com> 0:5.5.17-6jpp
+- Add the ability to start multiple instances of tomcat on the same machine.
+
 * Wed Aug 30 2006 Deepak Bhole <dbhole at redhat.com> 5.5.17-6jpp.2
 - Rebuilding.
 




More information about the fedora-cvs-commits mailing list