aboutsummaryrefslogtreecommitdiffstats
path: root/www/tomcat6
diff options
context:
space:
mode:
authorhq <hq@FreeBSD.org>2005-09-02 20:45:34 +0800
committerhq <hq@FreeBSD.org>2005-09-02 20:45:34 +0800
commitad2421228fa088cdafa179775effa4f03f944b03 (patch)
treef0acbc2796061f3399f0ba900f70741566f17967 /www/tomcat6
parent69fcd0c746e34cf0c04735b6d83631eb35c97a8f (diff)
downloadfreebsd-ports-gnome-ad2421228fa088cdafa179775effa4f03f944b03.tar.gz
freebsd-ports-gnome-ad2421228fa088cdafa179775effa4f03f944b03.tar.zst
freebsd-ports-gnome-ad2421228fa088cdafa179775effa4f03f944b03.zip
- New RCng stratup script with no use of tomcat55ctl. Several extra flags are
provided to customize the behavior of the Tomcat process. See the header of the script for further information. - Fix permission issue with ${STDOUT_LOG} and ${STDERR_LOG} PR: 38018 [1], 38020 [2], 59571 [3], 74344 [4], 75143 [5] Submitted by: Ari Suutari <ari.suutari@syncrontech.com> [1] [2], ve <ve@hardcore.lt> [3], SimpleRezo Team <freebsd@simplerezo.com> [4], Anton Yudin <toha@toha.org.ua> [5] Discussed on: freebsd-java@ Reviewed by: Jan Grant <Jan.Grant@bristol.ac.uk> Approved by: maintainer timeout
Diffstat (limited to 'www/tomcat6')
-rw-r--r--www/tomcat6/Makefile20
-rw-r--r--www/tomcat6/files/tomcat.sh.in114
-rw-r--r--www/tomcat6/pkg-plist2
3 files changed, 127 insertions, 9 deletions
diff --git a/www/tomcat6/Makefile b/www/tomcat6/Makefile
index c0aade630ceb..379cb52a453b 100644
--- a/www/tomcat6/Makefile
+++ b/www/tomcat6/Makefile
@@ -19,6 +19,8 @@ USE_JAVA= yes
JAVA_VERSION= 1.4+
NO_BUILD= YES
+USE_RC_SUBR= yes
+
.if !defined(NOPORTDOCS)
MAN1= ${CONTROL_SCRIPT_NAME}.1
.endif
@@ -49,7 +51,6 @@ STOP_TIMEOUT?= 5
PID_FILE= /var/run/${APP_SHORTNAME}.pid
REPLACE_FILES= ${PORTSDIR}/www/jakarta-tomcat4/files/daemonctl.c \
${PORTSDIR}/www/jakarta-tomcat4/files/daemonctl.1 \
- ${PORTSDIR}/www/jakarta-tomcat4/files/startup.sh \
${WRKSRC}/conf/server.xml
JAR_FILE= bin/bootstrap.jar
WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work
@@ -58,6 +59,13 @@ LATEST_LINK= ${APP_SHORTNAME}
CONF_EXT= sample
PLIST_SUB+= CONF_EXT=${CONF_EXT}
+SUB_FILES= tomcat.sh
+SUB_LIST= TOMCAT_VERSION=${MAJOR_VER:S/.//} \
+ TOMCAT_HOME=${APP_HOME} \
+ USER=${USER} \
+ STDOUT_LOG=${STDOUT_LOG} \
+ STDERR_LOG=${STDERR_LOG}
+
.include <bsd.port.pre.mk>
.if ${JAVA_PORT_VERSION:C/^([0-9])\.([0-9])(.*)$/\1.\2/} == "1.4"
@@ -149,14 +157,10 @@ do-install:
-e "/%%JAR_ARGS%%/s//\"start\",/g" \
${WRKDIR}/daemonctl.c > ${WRKDIR}/daemonctl_.c
@cd ${WRKDIR} && ${CC} -ansi -o ${CONTROL_SCRIPT_NAME} daemonctl_.c
- @${CP} ${WRKDIR}/${CONTROL_SCRIPT_NAME} ${CONTROL_SCRIPT}
- @${CHOWN} ${USER}:${GROUP} ${CONTROL_SCRIPT}
- @${CHMOD} 6754 ${CONTROL_SCRIPT}
@${ECHO_MSG} " [ DONE ]"
@${ECHO_MSG} -n ">> Installing startup script..."
- @${CP} ${WRKDIR}/startup.sh ${STARTUP_SCRIPT}
- @${CHMOD} 0544 ${STARTUP_SCRIPT}
+ @${INSTALL_SCRIPT} ${WRKDIR}/tomcat.sh ${PREFIX}/etc/rc.d/jakarta-tomcat${MAJOR_VER:S/.//}.sh
@${ECHO_MSG} " [ DONE ]"
.if !defined(NOPORTDOCS)
@@ -166,8 +170,8 @@ do-install:
.endif
@${ECHO_MSG} -n ">> Creating log files..."
- @${INSTALL} /dev/null ${STDOUT_LOG}
- @${INSTALL} /dev/null ${STDERR_LOG}
+ @${INSTALL} -m 664 -o ${USER} -g ${GROUP} /dev/null ${STDOUT_LOG}
+ @${INSTALL} -m 664 -o ${USER} -g ${GROUP} /dev/null ${STDERR_LOG}
@${ECHO_MSG} " [ DONE ]"
@${ECHO_MSG} -n ">> Creating symlink to tools.jar..."
diff --git a/www/tomcat6/files/tomcat.sh.in b/www/tomcat6/files/tomcat.sh.in
new file mode 100644
index 000000000000..dcc46e56a21c
--- /dev/null
+++ b/www/tomcat6/files/tomcat.sh.in
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: jakarta-tomcat%%TOMCAT_VERSION%%
+# REQUIRE: NETWORKING SERVERS
+# BEFORE: DAEMON
+# KEYWORD: FreeBSD shutdown
+
+#
+# Configuration settings for jakarta-tomcat%%TOMCAT_VERSION%% in /etc/rc.conf:
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_enable (bool):
+# Set to "NO" by default.
+# Set it to "YES" to enable jakarta-tomcat%%TOMCAT_VERSION%%
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_flags (str):
+# Set to "" by default.
+# Extra flags passed to start command
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home (str)
+# Set to "%%TOMCAT_HOME%%" by default.
+# Set the CATALINA_HOME variable for the Tomcat process
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_catalina_base (str)
+# Set to "%%TOMCAT_HOME%%" by default.
+# Set the CATALINA_BASE variable for the Tomcat process
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_catalina_tmpdir (str)
+# Set to "%%TOMCAT_HOME%%/temp" by default.
+# Set the CATALINA_TMPDIR variable for the Tomcat process
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log (str)
+# Set to "%%STDOUT_LOG%%" by default.
+# Set the location for the Tomcat process log (standard output)
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log (str)
+# Set to "%%STDERR_LOG%%" by default.
+# Set the location for the Tomcat process log (error output)
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_java_home (str):
+# jakarta_tomcat%%TOMCAT_VERSION%%_java_vendor (str):
+# jakarta_tomcat%%TOMCAT_VERSION%%_java_version (str):
+# jakarta_tomcat%%TOMCAT_VERSION%%_java_os (str):
+# Specify the requirements of the Java VM to use. See javavm(1).
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_classpath (str):
+# Set to "" by default.
+# Addtional classes to add to the CLASSPATH
+#
+# jakarta_tomcat%%TOMCAT_VERSION%%_java_opts (str):
+# Set to "" by default.
+# Java VM args to use.
+#
+
+jakarta_tomcat%%TOMCAT_VERSION%%_enable="${jakarta_tomcat%%TOMCAT_VERSION%%_enable:-"NO"}"
+jakarta_tomcat%%TOMCAT_VERSION%%_java_version="${jakarta_tomcat%%TOMCAT_VERSION%%_java_version:-"%%JAVA_VERSION%%"}"
+jakarta_tomcat%%TOMCAT_VERSION%%_user="${jakarta_tomcat%%TOMCAT_VERSION%%_user:-"%%USER%%"}"
+jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home="${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home:-"%%TOMCAT_HOME%%"}"
+jakarta_tomcat%%TOMCAT_VERSION%%_catalina_base="${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_base:-"%%TOMCAT_HOME%%"}"
+jakarta_tomcat%%TOMCAT_VERSION%%_catalina_tmpdir="${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_tmpdir:-"%%TOMCAT_HOME%%/temp"}"
+jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log="${jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log:-"%%STDOUT_LOG%%"}"
+jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log="${jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log:-"%%STDERR_LOG%%"}"
+
+. %%RC_SUBR%%
+
+name="jakarta_tomcat%%TOMCAT_VERSION%%"
+rcvar=`set_rcvar`
+
+if [ -n "${jakarta_tomcat%%TOMCAT_VERSION%%_java_home}" ] ; then
+ export JAVA_HOME="${jakarta_tomcat%%TOMCAT_VERSION%%_java_home}"
+fi
+
+if [ -n "${jakarta_tomcat%%TOMCAT_VERSION%%_java_version}" ] ; then
+ export JAVA_VERSION="${jakarta_tomcat%%TOMCAT_VERSION%%_java_version}"
+fi
+
+if [ -n "${jakarta_tomcat%%TOMCAT_VERSION%%_java_vendor}" ] ; then
+ export JAVA_VENDOR="${jakarta_tomcat%%TOMCAT_VERSION%%_java_vendor}"
+fi
+
+if [ -n "${jakarta_tomcat%%TOMCAT_VERSION%%_java_os}" ] ; then
+ export JAVA_OS="${jakarta_tomcat%%TOMCAT_VERSION%%_java_os}"
+fi
+
+java_command="%%LOCALBASE%%/bin/java \
+ ${jakarta_tomcat%%TOMCAT_VERSION%%_java_opts} \
+ -Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS \
+ -classpath %%TOMCAT_HOME%%/bin/bootstrap.jar:%%TOMCAT_HOME%%/bin/commons-logging-api.jar:${jakarta_tomcat%%TOMCAT_VERSION%%_classpath} \
+ -Dcatalina.base=${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_base} \
+ -Dcatalina.home=${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home} \
+ -Djava.io.tmpdir=${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_tmpdir} \
+ org.apache.catalina.startup.Bootstrap"
+
+log_args=">> ${jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log} \
+ 2>> ${jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log} "
+
+procname="java"
+required_files="${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home}/conf/server.xml"
+
+command="/usr/sbin/daemon"
+flags="${command} ${java_command} start ${jakarta_tomcat%%TOMCAT_VERSION%%_flags} ${log_args}"
+
+stop_cmd="jakarta_tomcat%%TOMCAT_VERSION%%_stop"
+
+jakarta_tomcat%%TOMCAT_VERSION%%_stop() {
+ echo "Stopping ${name}."
+ ${java_command} stop
+ wait_for_pids
+}
+
+load_rc_config "${name}"
+run_rc_command "$1"
diff --git a/www/tomcat6/pkg-plist b/www/tomcat6/pkg-plist
index 84265d604fa4..e9965bc7d358 100644
--- a/www/tomcat6/pkg-plist
+++ b/www/tomcat6/pkg-plist
@@ -20,7 +20,7 @@
@unexec if cmp -s %D/%%T%%/conf/workers2.properties %D/%%T%%/conf/workers2.properties.%%CONF_EXT%%; then rm -f %D/%%T%%/conf/workers2.properties; else echo If permanently deleting this package, %D/%%T%%/conf/workers2.properties must be removed manually; fi
@unexec if cmp -s %D/%%T%%/conf/workers2.properties.minimal %D/%%T%%/conf/workers2.properties.minimal.%%CONF_EXT%%; then rm -f %D/%%T%%/conf/workers2.properties.minimal; else echo If permanently deleting this package, %D/%%T%%/conf/workers2.properties.minimal must be removed manually; fi
bin/tomcat55ctl
-etc/rc.d/020.jakarta-tomcat55.sh
+etc/rc.d/jakarta-tomcat55.sh
%%T%%/LICENSE
%%T%%/NOTICE
%%T%%/RELEASE-NOTES