head	1.34;
access;
symbols
	RELEASE_5_0_DP1:1.25
	RELEASE_4_5_0:1.10
	RELEASE_4_4_0:1.8
	RELEASE_4_3_0:1.5
	RELEASE_4_2_0:1.2;
locks; strict;
comment	@# @;


1.34
date	2002.04.09.19.00.48;	author znerd;	state dead;
branches;
next	1.33;

1.33
date	2002.04.08.21.50.23;	author znerd;	state Exp;
branches;
next	1.32;

1.32
date	2002.04.08.19.19.31;	author znerd;	state Exp;
branches;
next	1.31;

1.31
date	2002.04.06.20.16.21;	author znerd;	state Exp;
branches;
next	1.30;

1.30
date	2002.04.04.22.48.18;	author znerd;	state Exp;
branches;
next	1.29;

1.29
date	2002.04.04.22.03.26;	author znerd;	state Exp;
branches;
next	1.28;

1.28
date	2002.04.03.21.28.50;	author znerd;	state Exp;
branches;
next	1.27;

1.27
date	2002.04.03.20.42.07;	author znerd;	state Exp;
branches;
next	1.26;

1.26
date	2002.04.03.19.49.24;	author znerd;	state Exp;
branches;
next	1.25;

1.25
date	2002.04.01.22.01.22;	author znerd;	state Exp;
branches;
next	1.24;

1.24
date	2002.03.30.21.08.55;	author znerd;	state Exp;
branches;
next	1.23;

1.23
date	2002.03.30.19.53.17;	author znerd;	state Exp;
branches;
next	1.22;

1.22
date	2002.03.30.18.51.01;	author znerd;	state Exp;
branches;
next	1.21;

1.21
date	2002.03.30.18.42.23;	author znerd;	state Exp;
branches;
next	1.20;

1.20
date	2002.03.30.18.15.21;	author znerd;	state Exp;
branches;
next	1.19;

1.19
date	2002.03.30.16.45.40;	author znerd;	state Exp;
branches;
next	1.18;

1.18
date	2002.03.30.14.51.12;	author znerd;	state Exp;
branches;
next	1.17;

1.17
date	2002.02.21.20.31.20;	author znerd;	state Exp;
branches;
next	1.16;

1.16
date	2002.02.21.20.06.55;	author znerd;	state Exp;
branches;
next	1.15;

1.15
date	2002.02.21.11.03.08;	author znerd;	state Exp;
branches;
next	1.14;

1.14
date	2002.02.19.13.52.30;	author znerd;	state Exp;
branches;
next	1.13;

1.13
date	2002.02.19.08.20.38;	author znerd;	state Exp;
branches;
next	1.12;

1.12
date	2002.02.04.13.38.25;	author znerd;	state Exp;
branches;
next	1.11;

1.11
date	2002.01.29.12.08.28;	author knu;	state Exp;
branches;
next	1.10;

1.10
date	2001.11.23.17.08.42;	author dirk;	state Exp;
branches;
next	1.9;

1.9
date	2001.10.01.21.01.46;	author mharo;	state Exp;
branches;
next	1.8;

1.8
date	2001.08.05.09.37.23;	author dirk;	state Exp;
branches;
next	1.7;

1.7
date	2001.05.21.08.05.37;	author dirk;	state Exp;
branches;
next	1.6;

1.6
date	2001.05.20.17.10.56;	author dirk;	state Exp;
branches;
next	1.5;

1.5
date	2001.04.08.13.09.03;	author dirk;	state Exp;
branches;
next	1.4;

1.4
date	2001.04.08.12.00.16;	author dirk;	state Exp;
branches;
next	1.3;

1.3
date	2001.04.07.17.05.22;	author des;	state Exp;
branches;
next	1.2;

1.2
date	2000.11.14.00.07.47;	author asami;	state Exp;
branches;
next	1.1;

1.1
date	2000.10.21.14.44.26;	author des;	state Exp;
branches;
next	;


desc
@@


1.34
log
@This port moved to www/jakarta-tomcat4.
@
text
@# New ports collection makefile for:	jakarta-tomcat
# Date created:		20 Oct 2000
# Whom:			des
#
# $FreeBSD: ports/www/jakarta-tomcat/Makefile,v 1.33 2002/04/08 21:50:23 znerd Exp $
#

PORTNAME=	jakarta-tomcat
PORTVERSION=	4.0.3
PORTREVISION=	6
CATEGORIES=	www java
MASTER_SITES=	http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v${PORTVERSION}/bin/ \
		http://www.metaverse.nl/~ernst/ \
		${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR=	znerd

MAINTAINER=	znerd@@FreeBSD.org

USE_JAVA=	1.2+
NO_BUILD=	YES

WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
APP_HOME?=	${PREFIX}/${PKGBASE}${PORTVERSION}
LOG_DIR=	${APP_HOME}/logs
PLIST_SUB+=	T=${APP_HOME:S/^${PREFIX}\///}
APP_TITLE=	Jakarta Tomcat
APP_SHORTNAME=	tomcat4
CONTROL_SCRIPT_NAME=	${APP_SHORTNAME}ctl
CONTROL_SCRIPT=	${PREFIX}/bin/${CONTROL_SCRIPT_NAME}
STARTUP_ORDER?=	020
STARTUP_SCRIPT_NAME=	${PORTNAME}4.sh
STARTUP_SCRIPT=	${PREFIX}/etc/rc.d/${STARTUP_ORDER}.${STARTUP_SCRIPT_NAME}
USER=		www
GROUP=		www
PW?=		/usr/sbin/pw
HTTP_PORT?=	8180
SHUTDOWN_PORT?=	8005
WARP_PORT?=	8008
AJP_1_3_PORT?=	8009
STDOUT_LOG=	${LOG_DIR}/stdout.log
STDERR_LOG=	${LOG_DIR}/stderr.log
AUTO_START?=	NO
STOP_TIMEOUT?=	5
PID_FILE=	/var/run/${APP_SHORTNAME}.pid
REPLACE_FILES=	${FILESDIR}/daemonctl.c \
		${FILESDIR}/tomcatctl.1 \
		${FILESDIR}/jakarta-tomcat.sh \
		${WRKSRC}/conf/server.xml
JAR_FILE=	bin/bootstrap.jar
CONTROL_SCRIPT_MANPAGE_TITLE=	TOMCAT4CTL
WRKDIR?=	${.CURDIR}/work

.include <bsd.port.pre.mk>

pre-install:
	@@${ECHO_CMD} "Installation settings:"
	@@${ECHO_CMD} "   Destination directory:    ${APP_HOME}"
	@@${ECHO_CMD} "   Control program location: ${CONTROL_SCRIPT}"
	@@${ECHO_CMD} "   Startup script location:  ${STARTUP_SCRIPT}"
	@@${ECHO_CMD} "   Location of JDK:          ${JAVA_HOME}"
	@@${ECHO_CMD} "   Location of Java port:    ${JAVA_PORT}"
	@@${ECHO_CMD} "   Running as (user/group):  ${USER}/${GROUP}"
	@@${ECHO_CMD} "   HTTP port:                ${HTTP_PORT}"
	@@${ECHO_CMD} "   Shutdown listener port:   ${SHUTDOWN_PORT}"
	@@${ECHO_CMD} "   WARP port:                ${WARP_PORT}"
	@@${ECHO_CMD} "   AJP 1.3 connector port:   ${AJP_1_3_PORT}"
	@@${ECHO_CMD} "   Logfile stdout:           ${STDOUT_LOG}"
	@@${ECHO_CMD} "   Logfile stderr:           ${STDERR_LOG}"
	@@${ECHO_CMD} "   Starting after install:   ${AUTO_START}"
	@@${ECHO_CMD} "   Stop time-out:            ${STOP_TIMEOUT} sec."
	@@PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL

do-install:
	@@${ECHO_CMD} -n ">> Removing unneeded files..."
	@@${RM} -f `${FIND} ${WRKSRC} -name '*.bat'` `${FIND} ${WRKSRC} -name '*.orig'` `${FIND} ${WRKSRC} -name '*.exe'`
	@@${ECHO_CMD} " [ DONE ]"

.for f in ${REPLACE_FILES}
	@@${ECHO_CMD} -n ">> Customizing `basename $f`..."
	@@${SED} \
	-e "/%%AJP_1_3_PORT%%/s//${AJP_1_3_PORT}/g" \
	-e "/%%APP_HOME%%/s//${APP_HOME:S/\//\\\//g}/g" \
	-e "/%%APP_SHORTNAME%%/s//${APP_SHORTNAME}/g" \
	-e "/%%APP_TITLE%%/s//${APP_TITLE}/g" \
	-e "/%%CONTROL_SCRIPT%%/s//${CONTROL_SCRIPT:S/\//\\\//g}/g" \
	-e "/%%CONTROL_SCRIPT_MANPAGE_TITLE%%/s//${CONTROL_SCRIPT_MANPAGE_TITLE}/g" \
	-e "/%%CONTROL_SCRIPT_NAME%%/s//${CONTROL_SCRIPT_NAME}/g" \
	-e "/%%GROUP%%/s//${GROUP}/g" \
	-e "/%%HTTP_PORT%%/s//${HTTP_PORT}/g" \
	-e "/%%JAVA_CMD%%/s//bin\/java/g" \
	-e "/%%JAVA_HOME%%/s//${JAVA_HOME:S/\//\\\//g}/g" \
	-e "/%%JAR_FILE%%/s//${JAR_FILE:S/\//\\\//g}/g" \
	-e "/%%LOG_DIR%%/s//${LOG_DIR:S/\//\\\//g}/g" \
	-e "/%%PID_FILE%%/s//${PID_FILE:S/\//\\\//g}/g" \
	-e "/%%PORTNAME%%/s//${PORTNAME}/g" \
	-e "/%%PORTVERSION%%/s//${PORTVERSION}/g" \
	-e "/%%PREFIX%%/s//${PREFIX:S/\//\\\//g}/g" \
	-e "/%%SHUTDOWN_PORT%%/s//${SHUTDOWN_PORT}/g" \
	-e "/%%STARTUP_SCRIPT_NAME%%/s//${STARTUP_SCRIPT_NAME}/g" \
	-e "/%%STARTUP_SCRIPT%%/s//${STARTUP_SCRIPT:S/\//\\\//g}/g" \
	-e "/%%STDERR_LOG%%/s//${STDERR_LOG:S/\//\\\//g}/g" \
	-e "/%%STDOUT_LOG%%/s//${STDOUT_LOG:S/\//\\\//g}/g" \
	-e "/%%STOP_TIMEOUT%%/s//${STOP_TIMEOUT}/g" \
	-e "/%%USER%%/s//${USER}/g" \
	-e "/%%WARP_PORT%%/s//${WARP_PORT}/g" \
	$f > ${WRKDIR}/`basename $f`
	@@${ECHO_CMD} " [ DONE ]"
.endfor

	@@${ECHO_CMD} -n ">> Creating destination directory..."
	@@${MKDIR} ${APP_HOME}
	@@${MKDIR} ${LOG_DIR}
	@@${ECHO_CMD} " [ DONE ]"

	@@${ECHO_CMD} -n ">> Copying files to destination directory..."
	@@${CP} -R ${WRKSRC}/* ${APP_HOME}
	@@${CP} ${WRKDIR}/server.xml ${APP_HOME}/conf/
	@@${ECHO_CMD} " [ DONE ]"

	@@${ECHO_CMD} -n ">> Compiling and installing control program..."
	@@${SED} \
	-e "/%%JAVA_ARGS%%/s//\"-Dcatalina.home=${APP_HOME:S/\//\\\//g}\",/g" \
	-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_CMD} " [ DONE ]"

	@@${ECHO_CMD} -n ">> Installing startup script..."
	@@${CP} ${WRKDIR}/jakarta-tomcat.sh ${STARTUP_SCRIPT}
	@@${CHMOD} 0544 ${STARTUP_SCRIPT}
	@@${ECHO_CMD} " [ DONE ]"

.if !defined(NOPORTDOCS)
	@@${ECHO_CMD} -n ">> Installing man pages..."
	@@${CP} ${WRKDIR}/tomcatctl.1 ${WRKDIR}/${CONTROL_SCRIPT_NAME}.1
	@@${INSTALL_MAN} ${WRKDIR}/${CONTROL_SCRIPT_NAME}.1 ${MANPREFIX}/man/man1
	@@${ECHO_CMD} " [ DONE ]"
.endif

	@@${ECHO_CMD} -n ">> Creating log files..."
	@@${INSTALL} /dev/null ${STDOUT_LOG}
	@@${INSTALL} /dev/null ${STDERR_LOG}
	@@${ECHO_CMD} " [ DONE ]"

	@@${ECHO_CMD} -n ">> Creating symlink to tools.jar..."
	@@${LN} -sf ${JAVA_HOME}/lib/tools.jar ${APP_HOME}/common/lib/tools.jar
	@@${ECHO_CMD} " [ DONE ]"

	@@${ECHO_CMD} -n ">> Fixing ownership settings..."
	@@${CHOWN} -R ${USER}:${GROUP} ${APP_HOME}
	@@${ECHO_CMD} " [ DONE ]"

	@@${ECHO_CMD} -n ">> Fixing permissions..."
	@@${CHMOD} 755 `find ${APP_HOME} -type d`
	@@${ECHO_CMD} " [ DONE ]"

	@@${ECHO_CMD} -n ">> Creating PID file..."
	@@${TOUCH} ${PID_FILE}
	@@${CHOWN} ${USER}:${GROUP} ${PID_FILE}
	@@${CHMOD} 0600 ${PID_FILE}
	@@${ECHO_CMD} " [ DONE ]"

post-install:
	@@${ECHO_CMD} "${APP_TITLE} ${PORTVERSION} has been installed in ${APP_HOME}."
	@@${ECHO_CMD} "If a user should be able to use ${CONTROL_SCRIPT_NAME}, put it in the group ${GROUP}."
.if !defined(NOPORTDOCS)
	@@${ECHO_CMD} "Use 'man ${CONTROL_SCRIPT_NAME}' for information about starting and stopping ${APP_TITLE}."
.endif
.if ${AUTO_START} == "YES"
	@@${CONTROL_SCRIPT} start || true
.endif

.include <bsd.port.post.mk>
@


1.33
log
@Daemon control program now checks if process is really
terminated. If not, it will send the process a SIGKILL
after a certain time-out period. The time-out can be
passed to the port Makefile as a parameter.

Improved documentation a bit here and there.

Added some explicit casts to make lint(1) a bit
happier :-)

Applied some refactoring here and there. Moved some
functionality into a new function 'existsProcess'.

Slightly changed the output of the program.

Bumped PORTREVISION.
@
text
@d5 1
a5 1
# $FreeBSD$
@


1.32
log
@Made the daemon control program less verbose.
Bumped PORTREVISION.

Prompted by:	Kees Jan Koster <K.J.Koster@@kpn.com>
@
text
@d10 1
a10 1
PORTREVISION=	5
d43 1
d70 1
d103 1
@


1.31
log
@Now installs the shell scripts as well. They were previously
not installed because there was the control program tomcat4ctl
already. For some instances, however, tomcat4ctl is not
powerful enough. For instance when setting up multiple
instances of Tomcat, see
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/RUNNING.txt.

Also added tools.jar to pkg-plist. It should have been added
previously.

Bumped PORTREVISION.

Prompted by:	Gavin Cameron <gavin@@itworks.com.au>
@
text
@d10 1
a10 1
PORTREVISION=	4
@


1.30
log
@Fixed a problem where the extracted files would
sometimes (?) be looked for in the directory
'work/work' instead of just 'work'.
Bumped PORTREVISION.
@
text
@d10 1
a10 1
PORTREVISION=	3
d73 1
a73 1
	@@${RM} -f `${FIND} ${WRKSRC} -name '*.bat'` `${FIND} ${WRKSRC} -name '*.orig'` `${FIND} ${WRKSRC} -name '*.exe'` ${WRKSRC}/bin/*.sh
@


1.29
log
@Creating symlink to tools.jar. Bumped PORTREVISION.

Prompted by:	Calvin NG <calvinng@@brel.com>
@
text
@d10 1
a10 1
PORTREVISION=	2
d50 1
a50 1
WRKDIR?=	work
@


1.28
log
@Minor cleanup.
@
text
@d10 1
a10 1
PORTREVISION=	1
d143 4
@


1.27
log
@Now checking for the Java VM too in the control
program. Bumped PORTREVISION.
@
text
@d122 1
a122 1
	@@cd ${WRKDIR} && ${CC} -DJAR_ARGS=${JAR_ARGS} -DJAVA_ARGS=${JAVA_ARGS} -ansi -o ${CONTROL_SCRIPT_NAME} daemonctl_.c
@


1.26
log
@Little generalization and cleanup. Nothing
spectacular. Not bumped PORTREVISION.
@
text
@d10 1
@


1.25
log
@Upgrade to Jakarta Tomcat 4.0.3. The Jakarta Tomcat 3
branch has moved to www/jakarta-tomcat3.

PR:	31096, 32022
@
text
@a47 2
JAVA_ARGS=	'"-Dcatalina.home=${APP_HOME}"'
JAR_ARGS=	'"start"'
d55 13
a67 13
	@@${ECHO_CMD} "   Destination directory:   ${APP_HOME}"
	@@${ECHO_CMD} "   Control script location: ${CONTROL_SCRIPT}"
	@@${ECHO_CMD} "   Startup script location: ${STARTUP_SCRIPT}"
	@@${ECHO_CMD} "   Location of JDK:         ${JAVA_HOME}"
	@@${ECHO_CMD} "   Location of Java port:   ${JAVA_PORT}"
	@@${ECHO_CMD} "   Running as (user/group): ${USER}/${GROUP}"
	@@${ECHO_CMD} "   HTTP port:               ${HTTP_PORT}"
	@@${ECHO_CMD} "   Shutdown listener port:  ${SHUTDOWN_PORT}"
	@@${ECHO_CMD} "   WARP port:               ${WARP_PORT}"
	@@${ECHO_CMD} "   AJP 1.3 connector port:  ${AJP_1_3_PORT}"
	@@${ECHO_CMD} "   Logfile stdout:          ${STDOUT_LOG}"
	@@${ECHO_CMD} "   Logfile stderr:          ${STDERR_LOG}"
	@@${ECHO_CMD} "   Starting after install:  ${AUTO_START}"
d116 6
a121 2
	@@${ECHO_CMD} -n ">> Compiling and installing control script..."
	@@cd ${WRKDIR} && ${CC} -DJAR_ARGS=${JAR_ARGS} -DJAVA_ARGS=${JAVA_ARGS} -ansi -o ${CONTROL_SCRIPT_NAME} daemonctl.c
@


1.24
log
@Changed a message to make it more generic.
@
text
@d9 1
a9 2
PORTVERSION=	3.3.1
PORTREVISION=	5
d11 1
a11 1
MASTER_SITES=	http://jakarta.apache.org/builds/jakarta-tomcat/release/v${PORTVERSION}/bin/ \
d26 1
a26 1
APP_SHORTNAME=	tomcat
d30 1
a30 1
STARTUP_SCRIPT_NAME=	${PORTNAME}.sh
d35 4
a38 1
HTTP_PORT?=	8080
d44 2
a45 2
		${FILESDIR}/${CONTROL_SCRIPT_NAME}.1 \
		${FILESDIR}/${STARTUP_SCRIPT_NAME} \
d47 4
a50 4
JAR_FILE=	lib/${APP_SHORTNAME}.jar
JAVA_ARGS=	'"-Dtomcat.install=${APP_HOME}"'
JAR_ARGS=	'"run"'
CONTROL_SCRIPT_MANPAGE_TITLE=	TOMCATCTL
d64 3
d74 1
a74 1
	@@${RM} -f `${FIND} ${WRKSRC} -name '*.bat'` `${FIND} ${WRKSRC} -name '*.orig'`
d80 1
d97 1
d103 1
d126 1
a126 1
	@@${CP} ${WRKDIR}/${STARTUP_SCRIPT_NAME} ${STARTUP_SCRIPT}
d132 1
@


1.23
log
@Replacing the man page title (in capitals) in order
to make the man page fully generic for jakarta-tomcat,
jakarta-tomcat4, orion and possibly others.

PORTREVISION is not bumped, since the resulting man
page is exactly the same.
@
text
@d68 1
a68 1
	@@${ECHO_CMD} -n ">> Removing all .bat and .orig files..."
@


1.22
log
@Now replacing STARTUP_SCRIPT in man page. Bumped PORTREVISION again.
@
text
@d48 1
d79 1
@


1.21
log
@Stopping the server from pkg-deinstall. Applying
replacements to server.xml. Bumped PORTREVISION.
@
text
@d10 1
a10 1
PORTREVISION=	4
d90 1
@


1.20
log
@Removed reference to workers.properties since it no
longer exists. Bumped PORTREVISION.
@
text
@d10 1
a10 1
PORTREVISION=	2
d104 1
@


1.19
log
@Removed reference to non-existent ${FILESDIR}/MANIFEST.MF.
Bumped PORTREVISION.
@
text
@d10 1
a10 1
PORTREVISION=	1
a103 1
	@@${CP} ${WRKDIR}/workers.properties ${APP_HOME}/conf
@


1.18
log
@Lot of changes: Using USE_JAVA infrastructure. Upgraded port
to 3.3.1. Using HTTP_PORT i.s.o. LISTEN_PORT. Using
daemonctl.c i.s.o. tomcatctl shell script. Displaying steps
i.s.o. commands being executed. Synced man page.
@
text
@d10 1
a40 1
MANIFEST=	MANIFEST.MF
d44 1
a44 3
		${WRKSRC}/conf/server.xml \
		${FILESDIR}/${MANIFEST}
#		${WRKSRC}/conf/workers.properties
@


1.17
log
@Fixed the man page for tomcatctl.
@
text
@d9 1
a9 2
PORTVERSION=	3.2.4
PORTREVISION=	2
d18 1
a18 2
RUN_DEPENDS=	${JAVA_HOME}/bin/javac:${JAVA_PORT}

d30 4
a33 5
STARTUP_SCRIPT=	${PREFIX}/etc/rc.d/${STARTUP_ORDER}.${PORTNAME}.sh
JAVA_HOME?=	${LOCALBASE}/jdk1.3.1
JAVA_PORT?=	${PORTSDIR}/java/jdk13
USER_NAME=	www
GROUP_NAME=	www
d35 1
a35 1
LISTEN_PORT?=	8080
d39 14
d61 2
a62 2
	@@${ECHO_CMD} "   Running as (user/group): ${USER_NAME}/${GROUP_NAME}"
	@@${ECHO_CMD} "   Port to listen at:       ${LISTEN_PORT}"
d66 1
d69 51
a119 50
	@@# Create the destination directory
	${MKDIR} ${APP_HOME}

	@@# Copy all files except .bat and .orig files
	${RM} -f `${FIND} ${WRKSRC} -name '*.bat'`
	${RM} -f `${FIND} ${WRKSRC} -name '*.orig'`
	${CP} -R ${WRKSRC}/* ${APP_HOME}
	${CHMOD} 755 `find ${APP_HOME} -type d`

	@@# Install the workers.properties file after processing it
	${CAT} ${WRKSRC}/conf/workers.properties \
	| ${SED} "/%%TOMCAT_HOME%%/s//${APP_HOME:S/\//\\\//g}/" \
	| ${SED} "/%%JAVA_HOME%%/s//${JAVA_HOME:S/\//\\\//g}/" \
	> ${WRKDIR}/workers.properties
	${MV} ${WRKDIR}/workers.properties ${APP_HOME}/conf/workers.properties

	@@# Install the startup script
	${CAT} ${FILESDIR}/${PORTNAME}.sh \
	| ${SED} "/%%USER_NAME%%/s//${USER_NAME}/" \
	| ${SED} "/%%APP_SHORTNAME%%/s//${APP_SHORTNAME}/" \
	| ${SED} "/%%CONTROL_SCRIPT%%/s//${CONTROL_SCRIPT:S/\//\\\//g}/" \
	> ${STARTUP_SCRIPT}
	${CHMOD} 0554 ${STARTUP_SCRIPT}

	@@# Install the control script
	${CAT} ${FILESDIR}/${CONTROL_SCRIPT_NAME} \
	| ${SED} "/%%PORTNAME%%/s//${PORTNAME}/" \
	| ${SED} "/%%APP_TITLE%%/s//${APP_TITLE}/" \
	| ${SED} "/%%APP_SHORTNAME%%/s//${APP_SHORTNAME}/" \
	| ${SED} "/%%APP_HOME%%/s//${APP_HOME:S/\//\\\//g}/" \
	| ${SED} "/%%LOG_DIR%%/s//${LOG_DIR:S/\//\\\//g}/" \
	| ${SED} "/%%STARTUP_SCRIPT_NAME%%/s//${PORTNAME}.sh/" \
	| ${SED} "/%%JAVA_HOME%%/s//${JAVA_HOME:S/\//\\\//g}/" \
	| ${SED} "/%%USER_NAME%%/s//${USER_NAME}/" \
	| ${SED} "/%%STDOUT_LOG%%/s//${STDOUT_LOG:S/\//\\\//g}/" \
	| ${SED} "/%%STDERR_LOG%%/s//${STDERR_LOG:S/\//\\\//g}/" \
	> ${CONTROL_SCRIPT}
	${CHOWN} ${USER_NAME}:${GROUP_NAME} ${CONTROL_SCRIPT}
	${CHMOD} 6554 ${CONTROL_SCRIPT}

	@@# Create the directories that the application will create at the
	@@# first run
	${MKDIR} ${LOG_DIR}
	${CHMOD} 6775 ${LOG_DIR}

	@@# Install the server.xml file after processing it
	${CAT} ${WRKSRC}/conf/server.xml \
	| ${SED} "/%%LISTEN_PORT%%/s//${LISTEN_PORT}/" \
	> ${WRKDIR}/server.xml
	${MV} ${WRKDIR}/server.xml ${APP_HOME}/conf/server.xml
a120 7
	@@# Change ownership for the files
	${CHOWN} -R ${USER_NAME}:${GROUP_NAME} ${APP_HOME}

	@@# Change the execute permissions for all shell scripts
	${CHMOD} 0554 ${APP_HOME}/bin/*

	@@# Install the man page
d122 3
a124 7
	${CAT} ${FILESDIR}/${CONTROL_SCRIPT_NAME}.1 \
	| ${SED} "/%%APP_TITLE%%/s//${APP_TITLE}/" \
	| ${SED} "/%%PREFIX%%/s//${PREFIX:S/\//\\\//g}/" \
	| ${SED} "/%%CONTROL_SCRIPT_NAME%%/s//${CONTROL_SCRIPT_NAME}/" \
	| ${SED} "/%%STARTUP_ORDER%%/s//${STARTUP_ORDER}.sh/" \
	> ${WRKDIR}/${CONTROL_SCRIPT_NAME}.1
	${INSTALL_MAN} ${WRKDIR}/${CONTROL_SCRIPT_NAME}.1 ${MANPREFIX}/man/man1
d127 19
d148 1
a148 1
	@@${ECHO_CMD} "If you would like a user to be able to use ${CONTROL_SCRIPT_NAME}, then put this user in the group ${GROUP_NAME}."
a152 1
	@@${ECHO_CMD} "Starting ${APP_TITLE}..."
d156 1
a156 1
.include <bsd.port.mk>
@


1.16
log
@Cleaned things up. Made things working :-) Both the startup script
in ${PREFIX}/etc/rc.d and the control script in ${PREFIX}/bin have
been refactored and now actually work very well.

Using the 'www' user and group, creating them if they don't exist.
I've used the same approach as www/apache13.

STDOUT_LOG and STDERR_LOG are now fixed (no ?= anymore) since the
package deinstall does not support a different location.

This fixes the first half of PR 28624.
See: http://www.freebsd.org/cgi/query-pr.cgi?pr=34931

Reported by:	Kees Jan Koster <k.j.koster@@kpn.com>
@
text
@d10 1
a10 1
PORTREVISION=	1
d117 1
d119 2
@


1.15
log
@Upgraded from Jakarta 3.2.3 to 3.2.4.
Not using DIST_SUBDIR anymore.
@
text
@d10 1
d29 2
a30 2
APPCTL_NAME=	${APP_SHORTNAME}ctl
CTL_SCRIPT=	${PREFIX}/bin/${APPCTL_NAME}
d35 2
a36 4
USER_NAME?=	${APP_SHORTNAME}
GROUP_NAME?=	${USER_NAME}
USER_ID?=	7103
GROUP_ID?=	${USER_ID}
d39 2
a40 2
STDOUT_LOG?=	${LOG_DIR}/stdout.log
STDERR_LOG?=	${LOG_DIR}/stderr.log
d46 1
a46 1
	@@${ECHO_CMD} "   Control script location: ${CTL_SCRIPT}"
d50 1
a50 1
	@@${ECHO_CMD} "   Running as (user/group): ${USER_NAME}/${GROUP_NAME} (${USER_ID}:${GROUP_ID})"
a56 4
	@@# Add the group and the user if they do not exist
	${PW} groupadd -n ${GROUP_NAME} -g ${GROUP_ID} || true
	${PW} useradd -n ${USER_NAME} -u ${USER_ID} -g ${GROUP_NAME} -c "${APP_TITLE} account" -d ${APP_HOME} -s ${SH} -h - || true

d73 8
d82 1
a82 1
	${CAT} ${FILESDIR}/${APPCTL_NAME} \
a83 1
	| ${SED} "/%%PORTVERSION%%/s//${PORTVERSION}/" \
d93 3
a95 7
	> ${CTL_SCRIPT}
	${CHOWN} ${USER_NAME}:${GROUP_NAME} ${CTL_SCRIPT}
	${CHMOD} 6554 ${CTL_SCRIPT}

	@@# Install the startup script
	${CP} ${FILESDIR}/${PORTNAME}.sh ${STARTUP_SCRIPT}
	${CHMOD} 0554 ${STARTUP_SCRIPT}
d116 1
a116 1
	${CAT} ${FILESDIR}/${APPCTL_NAME}.1 \
d118 2
a119 2
	> ${WRKDIR}/${APPCTL_NAME}.1
	${INSTALL_MAN} ${WRKDIR}/${APPCTL_NAME}.1 ${MANPREFIX}/man/man1
d124 1
a124 1
	@@${ECHO_CMD} "If you would like a user to be able to use ${APPCTL_NAME}, then put this user in the group ${GROUP_NAME}."
d126 1
a126 1
	@@${ECHO_CMD} "Use 'man ${APPCTL_NAME}' for information about starting and stopping ${APP_TITLE}."
d130 1
a130 1
	@@${CTL_SCRIPT} start || true
@


1.14
log
@Reverting changes. Accidentally committed *all* changes in my working copy, instead of only removing the second APP_TITLE. Bumped the PORTREVISION.
@
text
@d9 1
a9 2
PORTVERSION=	3.2.3
PORTREVISION=	3
d11 1
a11 1
MASTER_SITES=	http://www.apache.org/dist/jakarta/jakarta-tomcat/release/v${PORTVERSION}/bin/ \
a14 1
DIST_SUBDIR=	jakarta/tomcat/${PORTVERSION}
@


1.13
log
@APP_TITLE was set twice.

Reported by: Kimura Fuyuki <fuyuki@@mj.0038.net>
@
text
@d10 1
a10 1
PORTREVISION=	2
@


1.12
log
@A lot of changes:
* Bumped PORTREVISION
* Now displays installation settings
* Now possible to choose JDK. By default uses FreeBSD JDK 1.3.1 (instead of FreeBSD JDK 1.1.8)
* Does not depend on pinstall anymore
* Now possible to change TOMCAT_HOME. By default uses /jakarta-tomcat-3.2.3 (instead of /tomcat)
* Now possible to change LISTEN_PORT. Default is 8080 (unchanged)
* Added support for running Tomcat as a different user/group. By default a new user 'tomcat' and a new group 'tomcat' are created and used
* A 'tomcatctl' script is installed in /usr/local/bin/, which uses interprocess communication to start/stop/restart Tomcat
* Option is added for automatically starting Tomcat after install (AUTO_START). By default Tomcat is started right away
* Appends stdout and stderr to log files
* Uses a numeric prefix for the script in /etc/rc.d (now by default 020.jakarta-tomcat.sh instead of tomcat.sh)
@
text
@d10 1
a10 1
PORTREVISION=	1
d33 1
a33 2
RC_SCRIPT=	${PREFIX}/etc/rc.d/${STARTUP_ORDER}.${PORTNAME}.sh
APP_TITLE=	Jakarta Tomcat
d44 1
a44 1
AUTO_START?=	YES
d50 1
a50 1
	@@${ECHO_CMD} "   Startup script location: ${RC_SCRIPT}"
d88 1
a88 1
	| ${SED} "/%%RC_SCRIPT_NAME%%/s//${PORTNAME}.sh/" \
d94 2
a95 1
	${CHMOD} 755 ${CTL_SCRIPT}
d98 2
a99 1
	${LN} -sf ${CTL_SCRIPT} ${RC_SCRIPT}
d101 1
a101 1
	@@# Create the directories that the application will create it at the
d103 2
a104 1
	${MKDIR} ${APP_HOME}/logs
d115 3
d128 1
@


1.11
log
@Use ${ECHO_CMD} instead of ${ECHO} where you mean the echo command;
the ECHO macro is set to "echo" by default, but it is set to "true" if
make(1) is invoked with the -s option while ECHO_CMD is always set to
the echo command.
@
text
@d10 6
a15 2
CATEGORIES=	www
MASTER_SITES=	http://www.apache.org/dist/jakarta/jakarta-tomcat/release/v${PORTVERSION}/bin/
d20 1
a20 2
BUILD_DEPENDS=	pinstall:${PORTSDIR}/devel/pinstall
RUN_DEPENDS=	${LOCALBASE}/jdk1.1.8/bin/javac:${PORTSDIR}/java/jdk
d22 37
a58 1
NO_BUILD=	yes
d61 59
a119 5
	@@/usr/bin/perl -i -pe "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/conf/workers.properties
	@@${LN} -fs ${WRKSRC} ${WRKDIR}/tomcat
	@@pinstall -v -d ${WRKDIR}
	@@${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/tomcat.sh > ${WRKDIR}/tomcat.sh
	@@${INSTALL_SCRIPT} ${WRKDIR}/tomcat.sh /usr/local/etc/rc.d
d122 8
a129 1
	@@${ECHO_CMD} "etc/rc.d/tomcat.sh" >> ${TMPPLIST}
@


1.10
log
@Give maintainership to znerd.
@
text
@d29 1
a29 1
	@@${ECHO} "etc/rc.d/tomcat.sh" >> ${TMPPLIST}
@


1.9
log
@MASTER_SITE moved

Approved by: maintainer
@
text
@d5 1
a5 1
# $FreeBSD: ports/www/jakarta-tomcat/Makefile,v 1.8 2001/08/05 09:37:23 dirk Exp $
d14 1
a14 1
MAINTAINER=	dirk@@FreeBSD.org
@


1.8
log
@Upgrade to 3.2.3.
@
text
@d5 1
a5 1
# $FreeBSD: ports/www/jakarta-tomcat/Makefile,v 1.7 2001/05/21 08:05:37 dirk Exp $
d11 1
a11 1
MASTER_SITES=	http://jakarta.apache.org/builds/jakarta-tomcat/release/v${PORTVERSION}/bin/
@


1.7
log
@- provide startup script
- log tomcat messages to a file (logs/tomcat.log)
- fix plist
@
text
@d5 1
a5 1
# $FreeBSD: ports/www/jakarta-tomcat/Makefile,v 1.6 2001/05/20 17:10:56 dirk Exp $
d9 1
a9 2
PORTVERSION=	3.2.1
PORTREVISION=	2
@


1.6
log
@Give jakarta-tomcat a chance of working with mod_jk.
@
text
@d5 1
a5 1
# $FreeBSD: ports/www/jakarta-tomcat/Makefile,v 1.5 2001/04/08 13:09:03 dirk Exp $
d10 1
a10 1
PORTREVISION=	1
d23 1
a23 1
	/usr/bin/perl -i -pe "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/conf/workers.properties
d26 5
@


1.5
log
@Upgrade to 3.2.1.

PR:		ports/26027
Submitted by:	Michael Lyngbl <michael@@lyngbol.dk>
@
text
@d5 1
a5 1
# $FreeBSD: ports/www/jakarta-tomcat/Makefile,v 1.4 2001/04/08 12:00:16 dirk Exp $
d10 1
d23 1
@


1.4
log
@Overtake maintainership.
@
text
@d5 1
a5 1
# $FreeBSD: ports/www/jakarta-tomcat/Makefile,v 1.3 2001/04/07 17:05:22 des Exp $
d9 1
a9 1
PORTVERSION=	3.1
d11 1
a11 2
MASTER_SITES=	http://jakarta.apache.org/builds/tomcat/release/v${PORTVERSION}/bin/
DISTNAME=	${PORTNAME}
@


1.3
log
@It ain't me.
@
text
@d5 1
a5 1
# $FreeBSD: ports/www/jakarta-tomcat/Makefile,v 1.2 2000/11/14 00:07:47 asami Exp $
d15 1
a15 1
MAINTAINER=	ports@@FreeBSD.org
@


1.2
log
@javac is in a jdk version specific directory, not ${LOCALBASE}/bin, so
spell it out.

Submitted by:	bento
@
text
@d5 1
a5 1
# $FreeBSD: ports/www/jakarta-tomcat/Makefile,v 1.1 2000/10/21 14:44:26 des Exp $
d15 1
a15 1
MAINTAINER=	des@@FreeBSD.org
@


1.1
log
@The Apache Project's Jakarta Tomcat web server.
@
text
@d5 1
a5 1
# $FreeBSD$
d18 1
a18 1
RUN_DEPENDS=	javac:${PORTSDIR}/java/jdk
@

