diff -urN tmp/tomcat5.5-5.5.20/debian/changelog tomcat5.5-5.5.20/debian/changelog
--- tmp/tomcat5.5-5.5.20/debian/changelog	2007-11-21 16:35:31.000000000 +0100
+++ tomcat5.5-5.5.20/debian/changelog	2007-11-21 16:33:46.000000000 +0100
@@ -1,3 +1,16 @@
+tomcat5.5 (5.5.20-3) experimental; urgency=low
+
+  * Really fix the "/etc/init.d/tomcat5.5 status" command this
+    time. (Closes: #398044)
+  * Use jsvc for daemon startup, instead of the catalina.sh script. Daemon
+    shutdown is now faster and more reliable.
+  * Add missing permissions required by the admin webapp. Thanks to
+    Jonathan-Marc Lapointe.
+  * The CATALINA_OPTS variable in /etc/default/tomcat5.5 has been renamed
+    to the more intuitive JAVA_OPTS.
+
+ -- Marcus Better <marcus@better.se>  Sat, 25 Nov 2006 21:20:18 +0100
+
 tomcat5.5 (5.5.20-2) unstable; urgency=medium
 
   * Now runs with java-gcj-compat. (Closes: #395167)
diff -urN tmp/tomcat5.5-5.5.20/debian/control tomcat5.5-5.5.20/debian/control
--- tmp/tomcat5.5-5.5.20/debian/control	2007-11-21 16:35:31.000000000 +0100
+++ tomcat5.5-5.5.20/debian/control	2007-11-21 16:33:46.000000000 +0100
@@ -4,67 +4,57 @@
 Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
 Uploaders: Stefan Gybas <sgybas@debian.org>, Arnaud Vandyck <avdyk@debian.org>, Wolfgang Baer <WBaer@gmx.de>, Marcus Better <marcus@better.se>
 Build-Depends: debhelper (>= 5.0.0)
-Build-Depends-Indep: java-gcj-compat-dev, ant, ant-optional, libcommons-beanutils-java, libcommons-daemon-java, libcommons-digester-java, libcommons-el-java, libcommons-fileupload-java (>= 1.0-1), libcommons-httpclient-java, libcommons-launcher-java, libcommons-logging-java, libcommons-modeler-java (>= 1.1-1), libgnujaf-java, libgnumail-java, libjessie-java, liblog4j1.2-java, libmx4j-java, libstruts1.2-java, libxerces2-java, libxalan2-java, junit, unzip
+Build-Depends-Indep: java-gcj-compat-dev, ant, ant-optional, libcommons-beanutils-java, libcommons-daemon-java, libcommons-digester-java, libcommons-el-java, libcommons-fileupload-java (>= 1.0-1), libcommons-httpclient-java, libcommons-launcher-java, libcommons-logging-java, libcommons-modeler-java (>= 1.1-1), liblog4j1.2-java, libmx4j-java, libstruts1.2-java, libxerces2-java, libxalan2-java, junit, unzip
 Standards-Version: 3.7.2
+XS-Vcs-Svn: svn://svn.debian.org/pkg-java/trunk/tomcat5.5
+XS-Vcs-Browse: http://svn.debian.org/wsvn/pkg-java/trunk/tomcat5.5/
 
 Package: tomcat5.5
 Architecture: all
-Depends: java-gcj-compat-dev (>= 1.0.30-5) | kaffe (>= 2:1.1.6-3) | java2-runtime, libtomcat5.5-java (>= ${Source-Version}), adduser (>= 3.34), apache2-utils | apache-utils | apache2.2-common, ecj-bootstrap
-Suggests: java-virtual-machine, libapache-mod-jk | libapache2-mod-jk, tomcat5.5-webapps (>= ${Source-Version}), tomcat5.5-admin (>= ${Source-Version}), jsvc
-Description: Java Servlet 2.4 engine with JSP 2.0 support
- Apache Tomcat 5 is the reference implementation for the Java Servlet 2.4
- and JavaServer Pages (JSP) 2.0 specification from the Apache Jakarta project.
- .
- This package just contains the startup scripts for Tomcat 5. No documentation
- or web applications (webapps) are included here, please install the
- tomcat5.5-webapps package if you want them.
- .
- For more information about Tomcat please take a look at the Tomcat
- home page at http://tomcat.apache.org/index.html.
- .
- The official Servlet 2.4 and JSP 2.0 specifications can be found at
- http://java.sun.com/products/servlet/ and http://java.sun.com/products/jsp/
- 
+Depends: java-gcj-compat-dev (>= 1.0.30-5) | kaffe (>= 2:1.1.6-3) | java2-runtime, libtomcat5.5-java (>= ${Source-Version}), adduser (>= 3.34), apache2-utils | apache-utils, ecj-bootstrap, jsvc
+Suggests: java-virtual-machine, libapache-mod-jk | libapache2-mod-jk, tomcat5.5-webapps (>= ${Source-Version}), tomcat5.5-admin (>= ${Source-Version})
+Description: Servlet and JSP engine
+ Apache Tomcat is the reference implementation for the Java Servlet
+ and JavaServer Pages technologies.
+ .
+ This package just contains the startup scripts for the daemon. No
+ documentation or web applications are included here, please install
+ the tomcat5.5-webapps package if you want them.
+ .
+  Homepage: http://tomcat.apache.org
+
 Package: libtomcat5.5-java
 Architecture: all
 Depends: libxerces2-java, libservlet2.4-java, libcommons-el-java, ant, libcommons-launcher-java, libcommons-logging-java, libcommons-modeler-java (>= 1.1-1), libmx4j-java, libcommons-collections3-java, libcommons-dbcp-java, libcommons-pool-java
 Suggests: tomcat5.5 
 Description: Java Servlet engine -- core libraries
- Apache Tomcat 5 is the reference implementation for the Java Servlet 2.4
- and JavaServer Pages (JSP) 2.0 specification from the Apache Jakarta project.
+ Apache Tomcat is the reference implementation for the Java Servlet
+ and JavaServer Pages technologies.
  .
  This package contains the Tomcat core classes which can be used by other
- Java applications to embed Tomcat. If you want to run Tomcat you need to
- install the tomcat5.5 package.
+ Java applications to embed Tomcat.
  .
- For more information about Tomcat please take a look at the Tomcat
- home page at http://tomcat.apache.org/index.html.
+  Homepage: http://tomcat.apache.org
 
 Package: tomcat5.5-webapps
 Architecture: all
 Depends: tomcat5.5 (>= ${Source-Version})
 Description: Java Servlet engine -- documentation and example web applications
- Apache Tomcat 5 is the reference implementation for the Java Servlet 2.4
- and JavaServer Pages (JSP) 2.0 specification from the Apache Jakarta project.
+ Apache Tomcat is the reference implementation for the Java Servlet
+ and JavaServer Pages technologies.
  .
  This package contains the HTML documentation and some web applications
- (webapps) that were bundled with Tomcat 5:
-  * examples: Example servlets and JSP pages with source code
-  * tomcat-docs: HTML documentation for Tomcat
-  * webdav: WebDAV access to local files (e.g. using cadaver)
+ that are bundled with Tomcat.
  .
- For more information about Tomcat please take a look at the Tomcat
- home page at http://tomcat.apache.org/index.html.
+  Homepage: http://tomcat.apache.org
 
 Package: tomcat5.5-admin
 Architecture: all
 Depends: tomcat5.5 (>= ${Source-Version}), libstruts1.2-java, libcommons-fileupload-java (>= 1.0-1), libcommons-beanutils-java
 Description: Java Servlet engine -- admin & manager web interfaces
- Apache Tomcat 5 is the reference implementation for the Java Servlet 2.4
- and JavaServer Pages (JSP) 2.0 specification from the Apache Jakarta project.
+ Apache Tomcat is the reference implementation for the Java Servlet
+ and JavaServer Pages technologies.
  .
- This package contains two administrative web interfaces as admin and
- manager and host-manager web applications (webapps).
+ This package contains the administrative web interfaces.
  .
- For more information about Tomcat please take a look at the Tomcat
- home page at http://tomcat.apache.org/index.html.
+  Homepage: http://tomcat.apache.org
diff -urN tmp/tomcat5.5-5.5.20/debian/copyright tomcat5.5-5.5.20/debian/copyright
--- tmp/tomcat5.5-5.5.20/debian/copyright	2007-11-21 16:35:31.000000000 +0100
+++ tomcat5.5-5.5.20/debian/copyright	2007-11-21 16:33:46.000000000 +0100
@@ -1,11 +1,11 @@
 This package was debianized by Stefan Gybas <sgybas@debian.org> on
-12-Feb-2002. The source was downloaded from
-http://www.apache.de/dist/jakarta/tomcat-5/.
+12-Feb-2002.
 
-Modifications for Debian are copyright (C) 2005 Arnaud Vandyck and are
-released under the same license as Tomcat itself.
+The source was downloaded from <http://tomcat.apache.org>.
 
-The following copyright applies to this package (BSD-style license):
+The modifications and packaging for Debian are Copyright (C) 2005
+Arnaud Vandyck, Copyright (C) 2006 Marcus Better, and are released
+under the same license as Tomcat itself.
 
                                  Apache License
                            Version 2.0, January 2004
diff -urN tmp/tomcat5.5-5.5.20/debian/policy/10admin.policy tomcat5.5-5.5.20/debian/policy/10admin.policy
--- tmp/tomcat5.5-5.5.20/debian/policy/10admin.policy	1970-01-01 01:00:00.000000000 +0100
+++ tomcat5.5-5.5.20/debian/policy/10admin.policy	2007-11-21 16:33:46.000000000 +0100
@@ -0,0 +1,3 @@
+grant codeBase "file:/usr/share/struts1.2/struts.jar" {
+  permission java.security.AllPermission;
+};
diff -urN tmp/tomcat5.5-5.5.20/debian/tomcat5.5.default tomcat5.5-5.5.20/debian/tomcat5.5.default
--- tmp/tomcat5.5-5.5.20/debian/tomcat5.5.default	2007-11-21 16:35:31.000000000 +0100
+++ tomcat5.5-5.5.20/debian/tomcat5.5.default	2007-11-21 16:33:46.000000000 +0100
@@ -16,7 +16,7 @@
 # Arguments to pass to the Java virtual machine (JVM)
 # "-Djava.awt.headless=true -Xmx128M" is automatically set if CATALINA_OPTS
 # is left empty here
-#CATALINA_OPTS="-Djava.awt.headless=true -Xmx128M -server"
+#JAVA_OPTS="-Djava.awt.headless=true -Xmx128M -server"
 
 # Java compiler to use for translating JavaServer Pages (JSPs). You can use all
 # compilers that are accepted by Ant's build.compiler property.
diff -urN tmp/tomcat5.5-5.5.20/debian/tomcat5.5.init tomcat5.5-5.5.20/debian/tomcat5.5.init
--- tmp/tomcat5.5-5.5.20/debian/tomcat5.5.init	2007-11-21 16:35:31.000000000 +0100
+++ tomcat5.5-5.5.20/debian/tomcat5.5.init	2007-11-21 16:33:46.000000000 +0100
@@ -23,8 +23,8 @@
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 NAME=tomcat5.5
 DESC="Tomcat servlet engine"
+DAEMON=/usr/bin/jsvc
 CATALINA_HOME=/usr/share/$NAME
-DAEMON=$CATALINA_HOME/bin/catalina.sh
 DEFAULT=/etc/default/$NAME
 
 . /lib/lsb/init-functions
@@ -72,42 +72,53 @@
 done
 export JAVA_HOME
 
-# Set java.awt.headless=true if CATALINA_OPTS is not set so the
+# Set java.awt.headless=true if JAVA_OPTS is not set so the
 # Xalan XSL transformer can work without X11 display on JDK 1.4+
 # It also looks like the default heap size of 64M is not enough for most cases
 # se the maximum heap size is set to 128M
-if [ -z "$CATALINA_OPTS" ]; then
-	CATALINA_OPTS="-Djava.awt.headless=true -Xmx128M"
+if [ -z "$JAVA_OPTS" ]; then
+	JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"
 fi
 
+JAVA_OPTS="$JAVA_OPTS -Djava.endorsed.dirs=$CATALINA_HOME/common/endorsed -Dcatalina.base=$CATALINA_BASE -Dcatalina.home=$CATALINA_HOME -Djava.io.tmpdir=$CATALINA_BASE/temp"
+
 # Set the JSP compiler if set in the tomcat5.5.default file
 if [ -n "$JSP_COMPILER" ]; then
-	CATALINA_OPTS="$CATALINA_OPTS -Dbuild.compiler=$JSP_COMPILER"
+	JAVA_OPTS="$JAVA_OPTS -Dbuild.compiler=$JSP_COMPILER"
 fi
 
-# Define other required variables
-CATALINA_PID="$CATALINA_BASE/temp/$NAME.pid"
-STARTUP_OPTS=""
 if [ "$TOMCAT5_SECURITY" = "yes" ]; then
-	STARTUP_OPTS="-security"
+	JAVA_OPTS="$JAVA_OPTS -Djava.security.manager -Djava.security.policy=$CATALINA_BASE/conf/catalina.policy"
 fi
 
+# juli LogManager disabled if running under libgcj (see bug #395167)
+gcj=no
+"$JAVA_HOME/bin/java" -version 2>&1 | grep -q "^gij (GNU libgcj)" && gcj=yes
+if [ "$gcj" != "yes" ]; then
+  JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"
+fi
+
+# Define other required variables
+CATALINA_PID="/var/run/$NAME.pid"
+LOGFILE="$CATALINA_BASE/logs/catalina.out"
+BOOTSTRAP_CLASS=org.apache.catalina.startup.Bootstrap
+JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar"
+
 # Look for Java Secure Sockets Extension (JSSE) JARs
 if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then
     JSSE_HOME="${JAVA_HOME}/jre/"
 fi
-
-export CATALINA_HOME CATALINA_BASE CATALINA_OPTS CATALINA_PID JSSE_HOME
+export JSSE_HOME
 
 case "$1" in
   start)
 	if [ -z "$JAVA_HOME" ]; then
-		log_failure_msg "Not starting Tomcat: no Java Development Kit found."
+		log_failure_msg "no JDK found - please set JAVA_HOME"
 		exit 1
 	fi
 
 	if [ ! -d "$CATALINA_BASE/conf" ]; then
-		log_failure_msg "Not starting Tomcat: invalid CATALINA_BASE specified."
+		log_failure_msg "invalid CATALINA_BASE specified"
 		exit 1
 	fi
 
@@ -128,30 +139,16 @@
 			>> "$CATALINA_BASE/conf/catalina.policy"
 
 		# Clean up and set permissions on required files
-		rm -rf "$CATALINA_BASE"/temp/* \
-			"$CATALINA_BASE/logs/catalina.out"
-		mkfifo -m700 "$CATALINA_BASE/logs/catalina.out"
+		rm -rf "$CATALINA_BASE"/temp/*
 		chown --dereference "$TOMCAT5_USER" "$CATALINA_BASE/conf" \
 			"$CATALINA_BASE/conf/tomcat-users.xml" \
 			"$CATALINA_BASE/logs" "$CATALINA_BASE/temp" \
 			"$CATALINA_BASE/webapps" "$CATALINA_BASE/work" \
 			"$CATALINA_BASE/logs/catalina.out" || true
 
-		# Look for rotatelogs/rotatelogs2
-		if [ -x /usr/sbin/rotatelogs ]; then
-			ROTATELOGS=/usr/sbin/rotatelogs
-		else
-			ROTATELOGS=/usr/sbin/rotatelogs2
-		fi
-
-		# -p preserves the environment (for $JAVA_HOME etc.)
-		# -s is required because tomcat5.5's login shell is /bin/false
-		su -p -s /bin/sh $TOMCAT5_USER \
-				-c "$ROTATELOGS \"$CATALINA_BASE/logs/catalina_%F.log\" 86400" \
-				< "$CATALINA_BASE/logs/catalina.out" &
-		su -p -s /bin/sh $TOMCAT5_USER \
-			-c "\"$DAEMON\" start $STARTUP_OPTS" \
-			>> "$CATALINA_BASE/logs/catalina.out" 2>&1
+		$DAEMON -user "$TOMCAT5_USER" -cp "$JSVC_CLASSPATH" \
+		    -outfile "$LOGFILE"  -errfile '&1' \
+		    -pidfile "$CATALINA_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS"
 	else
 	        log_progress_msg "(already running)"
 	fi
@@ -164,24 +161,8 @@
 		>/dev/null; then
 		log_progress_msg "(not running)"
 	else
-		su -p -s /bin/sh $TOMCAT5_USER -c "\"$DAEMON\" stop" \
-			>/dev/null 2>&1 || true
-		# Fallback to kill the JVM process in case stopping didn't work
-		sleep 1
-		while ! start-stop-daemon --test --start \
-			--pidfile "$CATALINA_PID" --user "$TOMCAT5_USER" \
-			--startas "$JAVA_HOME/bin/java" >/dev/null; do
-			sleep 1
-			log_progress_msg "."
-			TOMCAT5_SHUTDOWN=`expr $TOMCAT5_SHUTDOWN - 1` || true
-			if [ $TOMCAT5_SHUTDOWN -le 0 ]; then
-				log_progress_msg "(killing)"
-				start-stop-daemon --stop --signal 9 --oknodo \
-					--quiet --pidfile "$CATALINA_PID" \
-					--user "$TOMCAT5_USER"
-			fi
-		done
-		rm -f "$CATALINA_PID" "$CATALINA_BASE/logs/catalina.out"
+		$DAEMON -cp "$JSVC_CLASSPATH" -pidfile "$CATALINA_PID" \
+		     -stop -wait "$TOMCAT5_SHUTDOWN" "$BOOTSTRAP_CLASS"
 	fi
 	log_end_msg 0
 	;;
@@ -198,7 +179,7 @@
 		    exit 3
 		fi
 	else
-		log_success_msg "$DESC is running with Java pid $CATALINA_PID"
+		log_success_msg "$DESC is running with pid `cat $CATALINA_PID`"
 		exit 0
 	fi
         ;;
diff -urN tmp/tomcat5.5-5.5.20/debian/tomcat5.5.postinst tomcat5.5-5.5.20/debian/tomcat5.5.postinst
--- tmp/tomcat5.5-5.5.20/debian/tomcat5.5.postinst	2007-11-21 16:35:31.000000000 +0100
+++ tomcat5.5-5.5.20/debian/tomcat5.5.postinst	2007-11-21 16:33:46.000000000 +0100
@@ -7,6 +7,9 @@
 		--ingroup nogroup --disabled-password --shell /bin/false \
 		tomcat55
 	fi
+	if [ ! -r /var/log/tomcat5.5/catalina.out ]; then
+	    mkfifo -m600 /var/log/tomcat5.5/catalina.out
+	fi
 	chown -R tomcat55:nogroup /var/log/tomcat5.5 /var/cache/tomcat5.5
 	chown tomcat55:adm /var/log/tomcat5.5 /var/cache/tomcat5.5 \
 	    /var/lib/tomcat5.5/conf
