From victor@equilibrium.bsdes.net  Fri Nov 16 15:26:22 2012
Return-Path: <victor@equilibrium.bsdes.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 777E2175;
	Fri, 16 Nov 2012 15:26:22 +0000 (UTC)
	(envelope-from victor@equilibrium.bsdes.net)
Received: from equilibrium.bsdes.net (244.Red-217-126-240.staticIP.rima-tde.net [217.126.240.244])
	by mx1.freebsd.org (Postfix) with ESMTP id 152538FC13;
	Fri, 16 Nov 2012 15:26:22 +0000 (UTC)
Received: by equilibrium.bsdes.net (Postfix, from userid 1001)
	id 244CE39832; Fri, 16 Nov 2012 16:26:21 +0100 (CET)
Message-Id: <20121116152621.244CE39832@equilibrium.bsdes.net>
Date: Fri, 16 Nov 2012 16:26:21 +0100 (CET)
From: Victor Balada Diaz <victor@bsdes.net>
Reply-To: Victor Balada Diaz <victor@bsdes.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: ale@FreeBSD.org
Subject: [Ports: www/tomcat7]: Add missing features to init script
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         173662
>Category:       ports
>Synopsis:       www/tomcat7: Add missing features to init script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ale
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 16 15:30:00 UTC 2012
>Closed-Date:    Fri Nov 16 15:34:47 UTC 2012
>Last-Modified:  Fri Nov 16 18:16:14 UTC 2012
>Originator:     Victor Balada Diaz
>Release:        FreeBSD 7.4-RELEASE-p3 i386
>Organization:
>Environment:
	
>Description:
	www/tomcat6 init script does have the following variables that are missing on www/tomcat7:

	tomcat7_java_vendor (str):
	tomcat7_java_version (str):
	tomcat7_java_os (str):

	These are very useful if you have more than one JVM installed to select which want
	to use. As they existed on tomcat6 port, i was expecting to find them on tomcat7.

	
>How-To-Repeat:
	
>Fix:
	The following patch adds them. The reason to run java in dry mode is that
	unless you specify JAVA_HOME jsvc doesn't work. The easiest way that i've
	found to get a proper JAVA_HOME from other settings is just running on dry
	mode and let javavm tell me what's the proper JAVA_HOME.

	Probably there's a better way to do this, but i think this is good enough.

	This work is based on www/tomcat6 init script.


--- tomcat7.patch begins here ---
Index: files/tomcat7.in
===================================================================
--- files/tomcat7.in	(revision 307487)
+++ files/tomcat7.in	(working copy)
@@ -43,8 +43,10 @@
 #   Set the JUL config file 
 #
 # tomcat7_java_home (str):
-#   Set to "%%JAVA_HOME%%" by default.
-#   Specify the Java VM to use.
+# tomcat7_java_vendor (str):
+# tomcat7_java_version (str):
+# tomcat7_java_os (str):
+#   Specify the requirements of the Java VM to use. See javavm(1).
 #
 # tomcat7_classpath (str):
 #   Set to "" by default.
@@ -80,8 +82,32 @@
 
 load_rc_config "${name}"
 
+if [ -n "${tomcat7_java_version}" ] ; then
+	export JAVA_VERSION="${tomcat7_java_version}"
+fi
+
+if [ -n "${tomcat7_java_vendor}" ] ; then
+	export JAVA_VENDOR="${tomcat7_java_vendor}"
+fi
+
+if [ -n "${tomcat7_java_os}" ] ; then
+	export JAVA_OS="${tomcat7_java_os}"
+fi
+
+if [ -n "${tomcat7_java_home}" ] ; then
+	export JAVA_HOME="${tomcat7_java_home}"
+else
+	# Create a sane environment
+	export JAVAVM_DRYRUN=1
+	OUTPUT=$(java)
+	for i in $OUTPUT
+	do
+	    export $i
+	done
+	unset JAVAVM_DRYRUN
+fi
+
 eval "${rcvar}=\${${rcvar}:-'NO'}"
-eval "_tomcat_java_home=\${${name}_java_home:-'%%JAVA_HOME%%'}"
 eval "_tomcat_catalina_user=\${${name}_catalina_user:-'%%TOMCAT_USER%%'}"
 eval "_tomcat_catalina_home='%%TOMCAT_HOME%%'"
 eval "_tomcat_catalina_base=\${${name}_catalina_base:-'%%TOMCAT_HOME%%'}"
@@ -103,8 +129,7 @@
 extra_commands="reload"
 
 command="%%LOCALBASE%%/bin/jsvc"
-command_args="-java-home '${_tomcat_java_home}' \
-	-server \
+command_args="-server \
 	-user ${_tomcat_catalina_user} \
 	-pidfile '${pidfile}' \
 	-wait ${_tomcat_wait} \
--- tomcat7.patch ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->ale 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Nov 16 15:30:08 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173662 
State-Changed-From-To: open->closed 
State-Changed-By: ale 
State-Changed-When: Fri Nov 16 15:33:40 UTC 2012 
State-Changed-Why:  
Which part of tomcat7_java_home (Specify the Java VM to use.) is not clear? :-) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173662 
>Unformatted:
