Date: Fri, 16 Nov 2012 16:26:21 +0100 (CET) From: Victor Balada Diaz <victor@bsdes.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: ale@FreeBSD.org Subject: ports/173662: [Ports: www/tomcat7]: Add missing features to init script Message-ID: <20121116152621.244CE39832@equilibrium.bsdes.net> Resent-Message-ID: <201211161530.qAGFU0OY019060@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 173662 >Category: ports >Synopsis: [Ports: www/tomcat7]: Add missing features to init script >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Nov 16 15:30:00 UTC 2012 >Closed-Date: >Last-Modified: >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: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121116152621.244CE39832>