Add rc scripts for tomcat v5 and v6, and remove some stuff rendered

obsolete by the rc scripts.

While here, reword README files as suggested by ian@ and sthen@.

ok ian@, sthen@, jasper@
This commit is contained in:
dcoppa 2011-07-24 11:11:58 +00:00
parent 1906bcaa5e
commit e4b8b0caab
14 changed files with 76 additions and 141 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.17 2011/07/04 07:41:37 dcoppa Exp $
# $OpenBSD: Makefile,v 1.18 2011/07/24 11:11:58 dcoppa Exp $
COMMENT-main= Java servlet 2.4 and Java server pages 2.0 server
COMMENT-admin= administration web application
@ -10,6 +10,7 @@ PKGNAME= tomcat-${V}
PKGNAME-main= tomcat-${V}
PKGNAME-admin= tomcat-admin-${V}
PKGNAME-examples=tomcat-examples-${V}
REVISION-main= 0
CATEGORIES= www
DISTFILES= ${DISTNAME}.tar.gz \
@ -71,11 +72,6 @@ do-install:
${INSTALL_DATA_DIR} ${WRKINST}/${CONFDIR}/Catalina/localhost
${INSTALL_DATA} ${WRKDIST}/conf/Catalina/localhost/* \
${WRKINST}/${CONFDIR}/Catalina/localhost
@${SUBST_CMD} -o ${BINOWN} -g ${BINGRP} \
${PREFIX}/tomcat/bin/setclasspath.sh
@${SUBST_CMD} -o ${SHAREOWN} -g ${SHAREGRP} -c \
${FILESDIR}/tomcat.rc \
${SAMPLEDIR}/tomcat.rc
rm -r ${PREFIX}/tomcat/bin/[xi]64
find ${WRKINST} \
-name \*.beforesubst -or \

View File

@ -1,21 +0,0 @@
# $OpenBSD: tomcat.rc,v 1.3 2011/07/04 07:41:37 dcoppa Exp $
#
# Define JAVA_HOME for _tomcat here
# Start tomcat with following command:
# $ sudo -u _tomcat ${TRUEPREFIX}/tomcat/bin/startup.sh
#
# javaPathHelper will pickup JAVA_HOME from the env. if
# it is not set in the env it will default the jdk that
# satisfied the RUN_DEPEND.
JAVA_HOME=$(${LOCALBASE}/bin/javaPathHelper -h tomcat)
JAVA_OPTS=-server
# override other environment options:
#CATALINA_HOME=${TRUEPREFIX}/tomcat
#CATALINA_BASE=${CATALINA_BASE}
#CATALINA_TMPDIR=${CATALINA_BASE}/temp
#JAVA_OPTS="-server -Djava.net.preferIPv4Stack=true"
#JPDA_TRANSPORT=
#JPDA_ADDRESS=
#JSSE_HOME=

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-bin_catalina_sh,v 1.4 2010/11/29 21:26:01 sthen Exp $
--- bin/catalina.sh.orig Thu Jul 1 11:19:40 2010
+++ bin/catalina.sh Tue Aug 3 04:52:30 2010
@@ -156,7 +156,7 @@ fi
CLASSPATH="$CLASSPATH""$CATALINA_HOME"/bin/bootstrap.jar
if [ -z "$CATALINA_BASE" ] ; then
- CATALINA_BASE="$CATALINA_HOME"
+ CATALINA_BASE="/var/tomcat"
fi
if [ -z "$CATALINA_OUT" ] ; then

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-bin_setclasspath_sh,v 1.4 2011/07/04 07:41:37 dcoppa Exp $
--- bin/setclasspath.sh.orig Thu Jul 1 11:19:40 2010
+++ bin/setclasspath.sh Tue Aug 3 04:52:30 2010
@@ -22,4 +22,9 @@
# -----------------------------------------------------------------------------
+# Read $JAVA_HOME - sudo doesn't pass environment variables
+if [ -r "${SYSCONFDIR}/tomcat/tomcat.rc" ]; then
+ . ${SYSCONFDIR}/tomcat/tomcat.rc
+fi
+
# Make sure prerequisite environment variables are set
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-main,v 1.7 2010/11/29 21:26:01 sthen Exp $
@comment $OpenBSD: PLIST-main,v 1.8 2011/07/24 11:11:58 dcoppa Exp $
@conflict jakarta-tomcat-*
@pkgpath www/jakarta-tomcat/v5
@pkgpath www/tomcat/v5
@ -57,12 +57,6 @@ share/examples/tomcat/tomcat-users.xml
@mode
@owner
@group
share/examples/tomcat/tomcat.rc
@owner _tomcat
@group _tomcat
@sample ${SYSCONFDIR}/tomcat/tomcat.rc
@owner
@group
share/examples/tomcat/web.xml
@owner _tomcat
@group _tomcat
@ -178,4 +172,5 @@ tomcat/server/webapps/manager/manager-howto.html
tomcat/server/webapps/manager/manager.xml
tomcat/server/webapps/manager/status.xsd
tomcat/server/webapps/manager/xform.xsl
@rcscript ${RCDIR}/tomcat
@extraunexec rm -rf ${CATALINA_BASE}/logs/* ${CATALINA_BASE}/work/*

View File

@ -1,4 +1,4 @@
$OpenBSD: README-main,v 1.4 2011/07/04 07:41:37 dcoppa Exp $
$OpenBSD: README-main,v 1.5 2011/07/24 11:11:58 dcoppa Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
@ -25,20 +25,14 @@ Tomcat on OpenBSD uses the `${SYSCONFDIR}/tomcat' directory for its configuratio
files. `$CATALINA_BASE' is `${CATALINA_BASE}'. All files contained within
these directories should be owned by the _tomcat user.
The startup.sh script has been modified to get important environment
variables from `${SYSCONFDIR}/tomcat/tomcat.rc'. You should define environment
variables such as JAVA_HOME and JAVA_OPTS in `${SYSCONFDIR}/tomcat/tomcat.rc'.
With the following command Tomcat is started as user `_tomcat':
$ sudo -u _tomcat ${TRUEPREFIX}/tomcat/bin/startup.sh
If you want Tomcat to serve on privileged ports (e.g. 80), then makes
sure the Connector port is 80 in your `${SYSCONFDIR}/tomcat/server.xml', or even
more secure: redirect all tcp traffic to port 80 to Tomcat's default
listener port 8080 using a pf.conf(5) rule like:
If you want Tomcat to serve on privileged ports (e.g. 80), redirect all
tcp traffic to port 80 to Tomcat's default listener port 8080 using a
pf.conf(5) rule like:
pass in quick on $NIC proto tcp to port 80 rdr-to 127.0.0.1 port 8080
or use relayd(8) to forward the connection.
If you are upgrading and use database drivers, don't forget to copy them
into ${TRUEPREFIX}/tomcat/common/lib. If you use ssi or cgi, remember to
rename to jar the appropriate .renametojar files in

29
www/tomcat/v5/pkg/tomcat.rc Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
#
# $OpenBSD: tomcat.rc,v 1.1 2011/07/24 11:11:58 dcoppa Exp $
daemon="${TRUEPREFIX}/tomcat/bin/catalina.sh"
daemon_flags="-server"
daemon_user="_tomcat"
. /etc/rc.d/rc.subr
pexp="$(${LOCALBASE}/bin/javaPathHelper -h tomcat).*-Dcatalina.base=${CATALINA_BASE}.*org.apache.catalina.startup.Bootstrap.*"
rc_reload=NO
rc_start() {
${rcexec} \
"CATALINA_BASE=\"${CATALINA_BASE}\" \
CATALINA_OPTS=\"${daemon_flags}\" \
JAVA_HOME=\"$(${LOCALBASE}/bin/javaPathHelper -h tomcat)\" ${daemon} start"
}
rc_stop() {
CATALINA_BASE="${CATALINA_BASE}" \
CATALINA_OPTS="${daemon_flags}" \
JAVA_HOME="$(${LOCALBASE}/bin/javaPathHelper -h tomcat)" \
${daemon} stop
}
rc_cmd $1

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.11 2011/07/04 07:41:37 dcoppa Exp $
# $OpenBSD: Makefile,v 1.12 2011/07/24 11:11:58 dcoppa Exp $
COMMENT-main= Java servlet 2.5 and Java server pages 2.1 server
COMMENT-examples=example applications and full documentation
@ -8,6 +8,7 @@ DISTNAME= apache-tomcat-${V}
PKGNAME= tomcat-${V}
PKGNAME-main= tomcat-${V}
PKGNAME-examples=tomcat-examples-${V}
REVISION-main= 0
CATEGORIES= www
DISTFILES= ${DISTNAME}.tar.gz \
@ -72,11 +73,6 @@ do-install:
${INSTALL_DATA_DIR} ${WRKINST}/${CONFDIR}/Catalina/localhost
${INSTALL_DATA} ${WRKDIST}/webapps/host-manager/manager.xml \
${WRKINST}/${CONFDIR}/Catalina/localhost
@${SUBST_CMD} -o ${BINOWN} -g ${BINGRP} \
${PREFIX}/tomcat/bin/setclasspath.sh
@${SUBST_CMD} -o ${SHAREOWN} -g ${SHAREGRP} -c \
${FILESDIR}/tomcat.rc \
${SAMPLEDIR}/tomcat.rc
find ${WRKINST} \
-name \*.beforesubst -or \
-name \*.orig -or \

View File

@ -1,20 +0,0 @@
# $OpenBSD: tomcat.rc,v 1.2 2011/07/04 07:41:37 dcoppa Exp $
#
# Start tomcat with following command:
# $ sudo -u _tomcat ${TRUEPREFIX}/tomcat/bin/startup.sh
#
# javaPathHelper will pickup JAVA_HOME from the env or the
# path. If it is not set it will default the jdk that
# satisfied the RUN_DEPEND.
JAVA_HOME=$(${LOCALBASE}/bin/javaPathHelper -h tomcat)
JAVA_OPTS=-server
# override other environment options:
#CATALINA_HOME=${TRUEPREFIX}/tomcat
#CATALINA_BASE=${CATALINA_BASE}
#CATALINA_TMPDIR=${CATALINA_BASE}/temp
#JAVA_OPTS="-server -Djava.net.preferIPv4Stack=true"
#JPDA_TRANSPORT=
#JPDA_ADDRESS=
#JSSE_HOME=

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-bin_catalina_sh,v 1.2 2011/07/04 07:41:37 dcoppa Exp $
--- bin/catalina.sh.orig Wed Feb 2 20:04:54 2011
+++ bin/catalina.sh Wed Jun 22 11:03:34 2011
@@ -164,7 +164,7 @@ else
fi
if [ -z "$CATALINA_BASE" ] ; then
- CATALINA_BASE="$CATALINA_HOME"
+ CATALINA_BASE="/var/tomcat"
fi
# Add tomcat-juli.jar and bootstrap.jar to classpath

View File

@ -1,13 +0,0 @@
$OpenBSD: patch-bin_setclasspath_sh,v 1.2 2011/07/04 07:41:37 dcoppa Exp $
--- bin/setclasspath.sh.orig Mon Jul 21 20:01:12 2008
+++ bin/setclasspath.sh Thu Jan 1 14:59:02 2009
@@ -22,4 +22,9 @@
# -----------------------------------------------------------------------------
+# Read $JAVA_HOME - sudo doesn't pass environment variables
+if [ -r "${SYSCONFDIR}/tomcat/tomcat.rc" ]; then
+ . ${SYSCONFDIR}/tomcat/tomcat.rc
+fi
+
# Make sure prerequisite environment variables are set
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-main,v 1.3 2011/07/04 07:41:37 dcoppa Exp $
@comment $OpenBSD: PLIST-main,v 1.4 2011/07/24 11:11:59 dcoppa Exp $
@conflict jakarta-tomcat-*
@pkgpath www/tomcat/v6
@newgroup _tomcat:526
@ -49,12 +49,6 @@ share/examples/tomcat/tomcat-users.xml
@mode
@owner
@group
share/examples/tomcat/tomcat.rc
@owner _tomcat
@group _tomcat
@sample ${SYSCONFDIR}/tomcat/tomcat.rc
@owner
@group
share/examples/tomcat/web.xml
@owner _tomcat
@group _tomcat
@ -148,4 +142,5 @@ tomcat/webapps/manager/images/update.gif
tomcat/webapps/manager/images/void.gif
tomcat/webapps/manager/status.xsd
tomcat/webapps/manager/xform.xsl
@rcscript ${RCDIR}/tomcat
@extraunexec rm -rf ${CATALINA_BASE}/logs/* ${CATALINA_BASE}/work/*

View File

@ -1,4 +1,4 @@
$OpenBSD: README-main,v 1.3 2011/07/04 07:41:37 dcoppa Exp $
$OpenBSD: README-main,v 1.4 2011/07/24 11:11:59 dcoppa Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
@ -20,22 +20,14 @@ Tomcat on OpenBSD uses the `${SYSCONFDIR}/tomcat' directory for its
configuration files. `$CATALINA_BASE' is `${CATALINA_BASE}'. All files
contained within these directories should be owned by the _tomcat user.
The startup.sh script has been modified to get important environment
variables from `${SYSCONFDIR}/tomcat/tomcat.rc'. You should define
environment variables such as JAVA_HOME and JAVA_OPTS in
`${SYSCONFDIR}/tomcat/tomcat.rc'.
With the following command Tomcat is started as user `_tomcat':
$ sudo -u _tomcat ${TRUEPREFIX}/tomcat/bin/startup.sh
If you want Tomcat to serve on privileged ports (e.g. 80), then makes
sure the Connector port is 80 in your
`${SYSCONFDIR}/tomcat/server.xml', or even more secure: redirect all
If you want Tomcat to serve on privileged ports (e.g. 80), redirect all
tcp traffic to port 80 to Tomcat's default listener port 8080 using a
pf.conf(5) rule like:
pass in quick on $NIC proto tcp to port 80 rdr-to 127.0.0.1 port 8080
or use relayd(8) to forward the connection.
If you are upgrading and use database drivers, don't forget to copy them
into ${TRUEPREFIX}/tomcat/lib. You must also delete any work files in
`${CATALINA_BASE}/work' unless you are reinstalling the same full

29
www/tomcat/v6/pkg/tomcat.rc Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
#
# $OpenBSD: tomcat.rc,v 1.1 2011/07/24 11:11:59 dcoppa Exp $
daemon="${TRUEPREFIX}/tomcat/bin/catalina.sh"
daemon_flags="-server"
daemon_user="_tomcat"
. /etc/rc.d/rc.subr
pexp="$(${LOCALBASE}/bin/javaPathHelper -h tomcat).*-Dcatalina.base=${CATALINA_BASE}.*org.apache.catalina.startup.Bootstrap.*"
rc_reload=NO
rc_start() {
${rcexec} \
"CATALINA_BASE=\"${CATALINA_BASE}\" \
CATALINA_OPTS=\"${daemon_flags}\" \
JAVA_HOME=\"$(${LOCALBASE}/bin/javaPathHelper -h tomcat)\" ${daemon} start"
}
rc_stop() {
CATALINA_BASE="${CATALINA_BASE}" \
CATALINA_OPTS="${daemon_flags}" \
JAVA_HOME="$(${LOCALBASE}/bin/javaPathHelper -h tomcat)" \
${daemon} stop
}
rc_cmd $1