[pkg-java] r12781 - trunk/tomcat6/debian

Thierry Carrez ttx-guest at alioth.debian.org
Tue Jul 20 13:52:14 UTC 2010


Author: ttx-guest
Date: 2010-07-20 13:52:13 +0000 (Tue, 20 Jul 2010)
New Revision: 12781

Added:
   trunk/tomcat6/debian/defaults.md5sum
   trunk/tomcat6/debian/defaults.template
Removed:
   trunk/tomcat6/debian/tomcat6.default
Modified:
   trunk/tomcat6/debian/changelog
   trunk/tomcat6/debian/control
   trunk/tomcat6/debian/rules
   trunk/tomcat6/debian/tomcat6.install
   trunk/tomcat6/debian/tomcat6.postinst
   trunk/tomcat6/debian/tomcat6.postrm
Log:
* Add debconf questions for user, group and Java options.
* Use ucf to install /etc/default/tomcat6 from a template
* Drop CATALINA_BASE and CATALINA_HOME from /etc/default/tomcat6 since we
  shouldn't encourage users to change those anyway

Modified: trunk/tomcat6/debian/changelog
===================================================================
--- trunk/tomcat6/debian/changelog	2010-07-19 16:29:31 UTC (rev 12780)
+++ trunk/tomcat6/debian/changelog	2010-07-20 13:52:13 UTC (rev 12781)
@@ -1,3 +1,12 @@
+tomcat6 (6.0.28-2) UNRELEASED; urgency=low
+
+  * Add debconf questions for user, group and Java options.
+  * Use ucf to install /etc/default/tomcat6 from a template
+  * Drop CATALINA_BASE and CATALINA_HOME from /etc/default/tomcat6 since we
+    shouldn't encourage users to change those anyway
+
+ -- Thierry Carrez <thierry.carrez at ubuntu.com>  Tue, 20 Jul 2010 14:36:48 +0200
+
 tomcat6 (6.0.28-1) unstable; urgency=low
 
   [ Niels Thykier ]

Modified: trunk/tomcat6/debian/control
===================================================================
--- trunk/tomcat6/debian/control	2010-07-19 16:29:31 UTC (rev 12780)
+++ trunk/tomcat6/debian/control	2010-07-20 13:52:13 UTC (rev 12781)
@@ -25,7 +25,7 @@
 
 Package: tomcat6
 Architecture: all
-Depends: tomcat6-common (>= ${source:Version}),
+Depends: tomcat6-common (>= ${source:Version}), ucf,
 	adduser, ${misc:Depends}
 Recommends: authbind
 Suggests: tomcat6-docs (>= ${source:Version}),

Added: trunk/tomcat6/debian/defaults.md5sum
===================================================================
--- trunk/tomcat6/debian/defaults.md5sum	                        (rev 0)
+++ trunk/tomcat6/debian/defaults.md5sum	2010-07-20 13:52:13 UTC (rev 12781)
@@ -0,0 +1 @@
+8db3c173dfe0df41b6515d946324d415 lucid

Added: trunk/tomcat6/debian/defaults.template
===================================================================
--- trunk/tomcat6/debian/defaults.template	                        (rev 0)
+++ trunk/tomcat6/debian/defaults.template	2010-07-20 13:52:13 UTC (rev 12781)
@@ -0,0 +1,45 @@
+# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
+# default of tomcat6.
+TOMCAT6_USER=tomcat6
+
+# Run Tomcat as this group ID. Not setting this or leaving it blank will use
+# the default of tomcat6.
+TOMCAT6_GROUP=tomcat6
+
+# The home directory of the Java development kit (JDK). You need at least
+# JDK version 1.5. If JAVA_HOME is not set, some common directories for 
+# OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried.
+#JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk
+
+# You may pass JVM startup parameters to Java here. If unset, the default
+# options will be: -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC
+#
+# Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved
+# response time). If you use that option and you run Tomcat on a machine with
+# exactly one CPU chip that contains one or two cores, you should also add
+# the "-XX:+CMSIncrementalMode" option.
+JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"
+
+# To enable remote debugging uncomment the following line.
+# You will then be able to use a java debugger on port 8000.
+#JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
+
+# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
+# compilers that are accepted by Ant's build.compiler property.
+#JSP_COMPILER=javac
+
+# Use the Java security manager? (yes/no, default: no)
+#TOMCAT6_SECURITY=no
+
+# Number of days to keep logfiles in /var/log/tomcat6. Default is 14 days.
+#LOGFILE_DAYS=14
+
+# Location of the JVM temporary directory
+# WARNING: This directory will be destroyed and recreated at every startup !
+#JVM_TMP=/tmp/tomcat6-temp
+
+# If you run Tomcat on port numbers that are all higher than 1023, then you
+# do not need authbind.  It is used for binding Tomcat to lower port numbers.
+# NOTE: authbind works only with IPv4.  Do not enable it when using IPv6.
+# (yes/no, default: no)
+#AUTHBIND=no

Modified: trunk/tomcat6/debian/rules
===================================================================
--- trunk/tomcat6/debian/rules	2010-07-19 16:29:31 UTC (rev 12780)
+++ trunk/tomcat6/debian/rules	2010-07-20 13:52:13 UTC (rev 12781)
@@ -77,6 +77,7 @@
 	dh_installman -ptomcat6-user debian/tomcat6-instance-create.1
 	dh_installexamples
 	dh_installinit --error-handler=true -- defaults 92 08
+	dh_installdebconf
 	dh_installcron
 	mkdir -p debian/poms
 	cp res/maven/*.pom debian/poms

Deleted: trunk/tomcat6/debian/tomcat6.default
===================================================================
--- trunk/tomcat6/debian/tomcat6.default	2010-07-19 16:29:31 UTC (rev 12780)
+++ trunk/tomcat6/debian/tomcat6.default	2010-07-20 13:52:13 UTC (rev 12781)
@@ -1,58 +0,0 @@
-# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
-# default of tomcat6.
-#TOMCAT6_USER=tomcat6
-
-# Run Tomcat as this group ID. Not setting this or leaving it blank will use
-# the default of tomcat6.
-#TOMCAT6_GROUP=tomcat6
-
-# The home directory of the Java development kit (JDK). You need at least
-# JDK version 1.5. If JAVA_HOME is not set, some common directories for 
-# OpenJDK, the Sun JDK, and various J2SE 1.5 versions are tried.
-#JAVA_HOME=/usr/lib/jvm/openjdk-6-jdk
-
-# Directory where the Tomcat 6 binary distribution resides.  This a read-only
-# directory that can be shared by all Tomcat instances running on the machine.
-# Default: /usr/share/tomcat6
-#CATALINA_HOME=/usr/share/$NAME
-
-# Directory for per-instance configuration files and webapps. It contains the
-# directories conf, logs, webapps, work and temp. See RUNNING.txt for details.
-# Default: /var/lib/tomcat6
-#CATALINA_BASE=/var/lib/$NAME
-
-# You may pass JVM startup parameters to Java here. If unset, the default
-# options (-Djava.awt.headless=true -Xmx128m) will be used.
-#JAVA_OPTS="-Djava.awt.headless=true -Xmx128m"
-
-# Use a CMS garbage collector for improved response time
-JAVA_OPTS="${JAVA_OPTS} -XX:+UseConcMarkSweepGC"
-
-# When using the CMS garbage collector, you should enable the following option
-# if you run Tomcat on a machine with exactly one CPU chip that contains one
-# or two cores.
-#JAVA_OPTS="$JAVA_OPTS -XX:+CMSIncrementalMode"
-
-# To enable remote debugging uncomment the following line.
-# You will then be able to use a java debugger on port 8000.
-#JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
-
-# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
-# compilers that are accepted by Ant's build.compiler property.
-#JSP_COMPILER=javac
-
-# Use the Java security manager? (yes/no, default: no)
-#TOMCAT6_SECURITY=no
-
-# Number of days to keep logfiles in /var/log/tomcat6. Default is 14 days.
-#LOGFILE_DAYS=14
-
-# Location of the JVM temporary directory
-# WARNING: This directory will be destroyed and recreated at every startup !
-#JVM_TMP=/tmp/tomcat6-temp
-
-# If you run Tomcat on port numbers that are all higher than 1023, then you
-# do not need authbind.  It is used for binding Tomcat to lower port numbers.
-# NOTE: authbind works only with IPv4.  Do not enable it when using IPv6.
-# (yes/no, default: no)
-#AUTHBIND=no

Modified: trunk/tomcat6/debian/tomcat6.install
===================================================================
--- trunk/tomcat6/debian/tomcat6.install	2010-07-19 16:29:31 UTC (rev 12780)
+++ trunk/tomcat6/debian/tomcat6.install	2010-07-20 13:52:13 UTC (rev 12781)
@@ -3,3 +3,5 @@
 conf/*.xml /etc/tomcat6/
 debian/policy/*.policy /etc/tomcat6/policy.d/
 debian/default_root /usr/share/tomcat6-root/
+debian/defaults.template /usr/share/tomcat6/
+debian/defaults.md5sum /usr/share/tomcat6/

Modified: trunk/tomcat6/debian/tomcat6.postinst
===================================================================
--- trunk/tomcat6/debian/tomcat6.postinst	2010-07-19 16:29:31 UTC (rev 12780)
+++ trunk/tomcat6/debian/tomcat6.postinst	2010-07-20 13:52:13 UTC (rev 12781)
@@ -1,11 +1,30 @@
 #!/bin/sh
 set -e
 
+. /usr/share/debconf/confmodule
+TEMPLATE="/usr/share/tomcat6/defaults.template"
+CONFFILE="/etc/default/tomcat6"
+JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"
+
 case "$1" in
     configure)
-	[ -f /etc/default/tomcat6 ] && . /etc/default/tomcat6
-	[ -z "$TOMCAT6_USER" ] && TOMCAT6_USER="tomcat6"
-	[ -z "$TOMCAT6_GROUP" ] && TOMCAT6_GROUP="tomcat6"
+
+	# Generate $CONFFILE from debconf seetings and $TEMPLATE
+	db_version 2.0
+	db_get tomcat6/username && TOMCAT6_USER="$RET" || TOMCAT6_USER="tomcat6"
+	db_get tomcat6/groupname && TOMCAT6_GROUP="$RET" || TOMCAT6_GROUP="tomcat6"
+	db_get tomcat6/javaopts && JAVA_OPTS="$RET" || JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"
+
+	tmpfile=`mktemp /tmp/tomcat6.XXXXXXXXXX`
+	chmod 644 $tmpfile
+	cat $TEMPLATE \
+		| sed "s/^TOMCAT6_USER=.*$/TOMCAT6_USER=$TOMCAT6_USER/" \
+		| sed "s/^TOMCAT6_GROUP=.*$/TOMCAT6_GROUP=$TOMCAT6_GROUP/" \
+		| sed "s/^JAVA_OPTS=.*$/JAVA_OPTS=\"$JAVA_OPTS\"/" \
+		>> $tmpfile
+	ucf --debconf-ok --sum-file /usr/share/tomcat6/defaults.md5sum $tmpfile $CONFFILE
+	rm -f $tmpfile
+
 	addgroup --system "$TOMCAT6_GROUP" --quiet
 	if ! id $TOMCAT6_USER > /dev/null 2>&1 ; then
 	    adduser --system --home /usr/share/tomcat6 --no-create-home \

Modified: trunk/tomcat6/debian/tomcat6.postrm
===================================================================
--- trunk/tomcat6/debian/tomcat6.postrm	2010-07-19 16:29:31 UTC (rev 12780)
+++ trunk/tomcat6/debian/tomcat6.postrm	2010-07-20 13:52:13 UTC (rev 12781)
@@ -3,6 +3,8 @@
 
 #DEBHELPER#
 
+CONFFILE=/etc/default/tomcat6
+
 # Remove cached files and auto-generated catalina.policy
 rm -rf /var/cache/tomcat6/*
 
@@ -41,6 +43,9 @@
     ;;
 
     purge)
+        if [ -x "/usr/bin/ucf" ]; then
+            ucf --purge $CONFFILE
+        fi
         rm -rf /var/log/tomcat6 /var/lib/tomcat6/temp
         if [ -d "/var/lib/tomcat6" ] ; then
             rmdir --ignore-fail-on-non-empty /var/lib/tomcat6 || true




More information about the pkg-java-commits mailing list