diff options
author | Herve Quiroz <hq@FreeBSD.org> | 2005-02-24 22:27:53 +0000 |
---|---|---|
committer | Herve Quiroz <hq@FreeBSD.org> | 2005-02-24 22:27:53 +0000 |
commit | a916dd1eb6962d469e76fa3e81c964a5dcc9838c (patch) | |
tree | 7739bcfa63a9195aeeaedea7c5c510afcc0ecac3 /www/resin2 | |
parent | 69e9d582e24caad39aaa16281b8f0060c0cda662 (diff) | |
download | ports-a916dd1eb6962d469e76fa3e81c964a5dcc9838c.tar.gz ports-a916dd1eb6962d469e76fa3e81c964a5dcc9838c.zip |
Notes
Diffstat (limited to 'www/resin2')
-rw-r--r-- | www/resin2/Makefile | 142 | ||||
-rw-r--r-- | www/resin2/distinfo | 4 | ||||
-rw-r--r-- | www/resin2/files/install.sh | 6 | ||||
-rw-r--r-- | www/resin2/files/patch-apache-Makefile.in | 2 | ||||
-rw-r--r-- | www/resin2/files/patch-apache2 | 2 | ||||
-rw-r--r-- | www/resin2/files/patch-apache2-Makefile.in | 2 | ||||
-rw-r--r-- | www/resin2/files/patch-resin.conf | 2 | ||||
-rw-r--r-- | www/resin2/files/patch-wrapper | 8 | ||||
-rw-r--r-- | www/resin2/files/pkg-message.in | 18 | ||||
-rw-r--r-- | www/resin2/files/resin.sh.in | 73 | ||||
-rw-r--r-- | www/resin2/files/resinctl | 189 | ||||
-rw-r--r-- | www/resin2/pkg-descr | 2 | ||||
-rw-r--r-- | www/resin2/pkg-plist | 2 |
13 files changed, 315 insertions, 137 deletions
diff --git a/www/resin2/Makefile b/www/resin2/Makefile index 321e550762d1..95c6296fb7d9 100644 --- a/www/resin2/Makefile +++ b/www/resin2/Makefile @@ -2,59 +2,60 @@ # Whom: Jean-Baptiste Quenot <jb.quenot@caraldi.com> # Date Created: 2002-07-15 15:00:43 # -# ex:ts=20:sw=20 -# # $FreeBSD$ # -PORTNAME= resin -PORTVERSION= 2.1.14 -CATEGORIES= www java -MASTER_SITES= http://www.caucho.com/download/ +PORTNAME= resin +PORTVERSION= 2.1.16 +CATEGORIES= www java +MASTER_SITES= http://www.caucho.com/download/ -MAINTAINER= jb.quenot@caraldi.com -COMMENT= Resin, a Java-based Application Server, 2.x branch +MAINTAINER= jb.quenot@caraldi.com +COMMENT= Resin, a Java-based Application Server, 2.x branch -USE_JAVA= 1.2+ -HAS_CONFIGURE= yes -USE_PERL5= yes -USE_REINPLACE= yes +USE_JAVA= yes +JAVA_VERSION= 1.2+ +HAS_CONFIGURE= yes +USE_PYTHON= yes +USE_REINPLACE= yes # Customizable settings -RUNASUSER?= www -RUNASUID?= 80 -GROUP?= ${RUNASUSER} -GID?= ${RUNASUID} -PORT?= 8080 +RUNASUSER?= www +RUNASUID?= 80 +GROUP?= ${RUNASUSER} +GID?= ${RUNASUID} +PORT?= 8080 # Do not use PKGNAMESUFFIX here because version info is already in PORTVERSION # If we used PKGNAMESUFFIX, the package name would be resin2-2.1.11 APP_NAME_SUFFIX= ${PORTVERSION:C/\..*$//} -APP_NAME?= ${PORTNAME}${APP_NAME_SUFFIX} -LATEST_LINK= ${APP_NAME} -APP_HOME?= ${PREFIX}/${APP_NAME} -WITH_APACHE?= NO -WITH_APACHE2?= NO -PID_FILE?= /var/run/${APP_NAME}.pid +APP_NAME?= ${PORTNAME}${APP_NAME_SUFFIX} +LATEST_LINK= ${APP_NAME} +APP_HOME?= ${PREFIX}/${APP_NAME} +WITH_APACHE?= NO +WITH_APACHE2?= NO +PID_FILE?= ${APP_HOME}/${APP_NAME}.pid +LOG_FILE?= ${APP_HOME}/${APP_NAME}.log # Other settings -APXS?= ${LOCALBASE}/sbin/apxs -MOD_DIR?= `${APXS} -q LIBEXECDIR` -PKGINSTALL= ${WRKDIR}/pkg-install -PKGDEINSTALL= ${WRKDIR}/pkg-deinstall -PKGMESSAGE= ${WRKDIR}/pkg-message +APXS?= ${LOCALBASE}/sbin/apxs +PKGINSTALL= ${WRKDIR}/pkg-install +PKGDEINSTALL= ${WRKDIR}/pkg-deinstall +PKGMESSAGE= ${WRKDIR}/pkg-message # We need WRKSRC and WRKDIR right now so define them "manually" -WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION} -WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work +WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION} +WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work REINPLACE_FILES= ${WRKSRC}/src/c/plugin/apache/Makefile.in \ - ${WRKSRC}/src/c/plugin/apache2/Makefile.in -REPLACE_FILES= ${FILESDIR}/pkg-install \ - ${FILESDIR}/pkg-deinstall \ - ${FILESDIR}/install.sh \ - ${FILESDIR}/pkg-message.in \ - ${WRKSRC}/conf/resin.conf \ - ${WRKSRC}/bin/wrapper.pl.in \ - ${FILESDIR}/resin.sh.in -COPYDIRS= doc lib libexec xsl + ${WRKSRC}/src/c/plugin/apache2/Makefile.in +REPLACE_FILES= ${FILESDIR}/pkg-install \ + ${FILESDIR}/pkg-deinstall \ + ${FILESDIR}/install.sh \ + ${FILESDIR}/pkg-message.in \ + ${WRKSRC}/conf/resin.conf \ + ${FILESDIR}/resinctl \ + ${FILESDIR}/resin.sh.in +COPYDIRS= doc lib libexec xsl + +.include <bsd.port.pre.mk> # Pass JAVA_HOME as determined by bsd.java.mk CONFIGURE_ARGS+= --with-java-home=${JAVA_HOME} @@ -64,48 +65,48 @@ CONFIGURE_ARGS+= --with-java-home=${JAVA_HOME} # # Apache 1.3 # -BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/www/apache13 +BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/www/apache13 CONFIGURE_ARGS+= --with-apxs=${APXS} -PLIST_SUB+= MOD_DIR=libexec/apache +PLIST_SUB+= MOD_DIR=libexec/apache # Allow apxs invocations -PLIST_SUB+= APACHE="" +PLIST_SUB+= APACHE="" .elif defined(WITH_APACHE2) && (${WITH_APACHE2} == yes || ${WITH_APACHE2} == YES) # # Apache 2 # -BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/www/apache2 +BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/www/apache2 CONFIGURE_ARGS+= --with-apxs=${APXS} -PLIST_SUB+= MOD_DIR=libexec/apache2 +PLIST_SUB+= MOD_DIR=libexec/apache2 # Allow apxs invocations -PLIST_SUB+= APACHE="" +PLIST_SUB+= APACHE="" .else -PLIST_SUB+= MOD_DIR="@comment " +PLIST_SUB+= MOD_DIR="@comment " # Prevent apxs invocations -PLIST_SUB+= APACHE="@comment " +PLIST_SUB+= APACHE="@comment " .endif -PLIST_SUB+= APP_NAME=${APP_NAME} -PLIST_SUB+= APXS=${APXS} +PLIST_SUB+= APP_NAME=${APP_NAME} +PLIST_SUB+= APXS=${APXS} -SUBSTITUTIONS= -e "s|%%APP_HOME%%|${APP_HOME}|g" \ - -e "s|%%APP_NAME%%|${APP_NAME}|g" \ - -e "s|%%APXS%%|${APXS}|g" \ - -e "s|%%COPYDIRS%%|${COPYDIRS}|g" \ - -e "s|%%FILESDIR%%|${FILESDIR}|g" \ - -e "s|%%GROUP%%|${GROUP}|g" \ - -e "s|%%GID%%|${GID}|g" \ - -e "s|%%JAVA_HOME%%|${JAVA_HOME}|g" \ - -e "s|%%PERL%%|${PERL}|g" \ - -e "s|%%PID_FILE%%|${PID_FILE}|g" \ - -e "s|%%PORT%%|${PORT}|g" \ - -e "s|%%PORTNAME%%|${PORTNAME}|g" \ - -e "s|%%PREFIX%%|${PREFIX}|g" \ - -e "s|%%RUNASUID%%|${RUNASUID}|g" \ - -e "s|%%RUNASUSER%%|${RUNASUSER}|g" \ - -e "s|%%WRKDIR%%|${WRKDIR}|g" \ - -e "s|%%WRKSRC%%|${WRKSRC}|g" - -.include <bsd.port.pre.mk> +SUBSTITUTIONS= -e "s|%%APP_HOME%%|${APP_HOME}|g" \ + -e "s|%%APP_NAME%%|${APP_NAME}|g" \ + -e "s|%%APXS%%|${APXS}|g" \ + -e "s|%%COPYDIRS%%|${COPYDIRS}|g" \ + -e "s|%%FILESDIR%%|${FILESDIR}|g" \ + -e "s|%%GROUP%%|${GROUP}|g" \ + -e "s|%%GID%%|${GID}|g" \ + -e "s|%%JAVA_HOME%%|${JAVA_HOME}|g" \ + -e "s|%%JAVA%%|${JAVA}|g" \ + -e "s|%%LOG_FILE%%|${LOG_FILE}|g" \ + -e "s|%%PYTHON_CMD%%|${PYTHON_CMD}|g" \ + -e "s|%%PID_FILE%%|${PID_FILE}|g" \ + -e "s|%%PORT%%|${PORT}|g" \ + -e "s|%%PORTNAME%%|${PORTNAME}|g" \ + -e "s|%%PREFIX%%|${PREFIX}|g" \ + -e "s|%%RUNASUID%%|${RUNASUID}|g" \ + -e "s|%%RUNASUSER%%|${RUNASUSER}|g" \ + -e "s|%%WRKDIR%%|${WRKDIR}|g" \ + -e "s|%%WRKSRC%%|${WRKSRC}|g" post-patch: .for FILE in ${REINPLACE_FILES} @@ -114,7 +115,7 @@ post-patch: .for FILE in ${REPLACE_FILES} @${SED} ${SUBSTITUTIONS} ${FILE} > ${WRKDIR}/`basename ${FILE}` .endfor - @fmt -w 80 < ${WRKDIR}/pkg-message.in > ${PKGMESSAGE} + @${FMT} -w 80 < ${WRKDIR}/pkg-message.in > ${PKGMESSAGE} .if (defined(WITH_APACHE2) && (${WITH_APACHE2} == yes || ${WITH_APACHE2} == YES) || \ defined(WITH_APACHE) && (${WITH_APACHE} == yes || ${WITH_APACHE} == YES)) @${ECHO_CMD} >> ${PKGMESSAGE} @@ -127,11 +128,10 @@ defined(WITH_APACHE) && (${WITH_APACHE} == yes || ${WITH_APACHE} == YES)) @${ECHO_CMD} " CauchoConfigFile ${PREFIX}/etc/${APP_NAME}.xml" >> ${PKGMESSAGE} @${ECHO_CMD} "</IfModule>" >> ${PKGMESSAGE} .endif - @${MV} ${WRKDIR}/wrapper.pl.in ${WRKSRC}/bin/wrapper.pl.in # Resin does not handle installation, so proceed now post-install: - @${SH} ${WRKDIR}/install.sh + @${SETENV} RUNASUSER=${RUNASUSER} GROUP=${GROUP} ${SH} ${WRKDIR}/install.sh @${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL @${ECHO_CMD} @${ECHO_CMD} "********************************************************************************" diff --git a/www/resin2/distinfo b/www/resin2/distinfo index 3a824baf5d0b..3e686834fee8 100644 --- a/www/resin2/distinfo +++ b/www/resin2/distinfo @@ -1,2 +1,2 @@ -MD5 (resin-2.1.14.tar.gz) = 03d1ce8746ba3a5082298fd617929620 -SIZE (resin-2.1.14.tar.gz) = 3305648 +MD5 (resin-2.1.16.tar.gz) = 0651cfa42705397be714cee27556b028 +SIZE (resin-2.1.16.tar.gz) = 3312495 diff --git a/www/resin2/files/install.sh b/www/resin2/files/install.sh index b7497633e60d..76eb53923d07 100644 --- a/www/resin2/files/install.sh +++ b/www/resin2/files/install.sh @@ -1,4 +1,6 @@ #! /bin/sh +# +# $FreeBSD$ set -e @@ -28,7 +30,7 @@ install %%WRKDIR%%/resin.sh.in %%PREFIX%%/etc/rc.d/%%APP_NAME%%.sh chmod 755 %%PREFIX%%/etc/rc.d/%%APP_NAME%%.sh echo Installed %%PREFIX%%/etc/rc.d/%%APP_NAME%%.sh -install %%WRKSRC%%/bin/wrapper.pl %%PREFIX%%/sbin/%%APP_NAME%%ctl +install %%WRKDIR%%/resinctl %%PREFIX%%/sbin/%%APP_NAME%%ctl echo Installed %%PREFIX%%/sbin/%%APP_NAME%%ctl test -d %%APP_HOME%% || mkdir %%APP_HOME%% @@ -45,4 +47,4 @@ list() ( cd %%WRKSRC%% && find %%COPYDIRS%% -type d -empty -delete ) echo Installing in %%APP_HOME%% -list | xargs tar -C %%WRKSRC%% -cf- | tar -C %%APP_HOME%% -xpf- +list | ( cd %%WRKSRC%% && cpio -pdm -L -R $RUNASUSER:$GROUP %%APP_HOME%% ) diff --git a/www/resin2/files/patch-apache-Makefile.in b/www/resin2/files/patch-apache-Makefile.in index 4b10a88f34b5..6b89cfe8cad9 100644 --- a/www/resin2/files/patch-apache-Makefile.in +++ b/www/resin2/files/patch-apache-Makefile.in @@ -1,3 +1,5 @@ +$FreeBSD$ + --- src/c/plugin/apache/Makefile.in.orig Thu Nov 13 09:27:52 2003 +++ src/c/plugin/apache/Makefile.in Thu Nov 13 09:28:36 2003 @@ -28,8 +28,7 @@ diff --git a/www/resin2/files/patch-apache2 b/www/resin2/files/patch-apache2 index 2130da28e974..fe82d355a226 100644 --- a/www/resin2/files/patch-apache2 +++ b/www/resin2/files/patch-apache2 @@ -1,3 +1,5 @@ +$FreeBSD$ + --- src/c/plugin/apache2/mod_caucho.c.orig Tue Apr 15 23:28:46 2003 +++ src/c/plugin/apache2/mod_caucho.c Fri Jun 6 01:37:29 2003 @@ -52,7 +52,7 @@ diff --git a/www/resin2/files/patch-apache2-Makefile.in b/www/resin2/files/patch-apache2-Makefile.in index 18707a7a3f77..5191bb938b6c 100644 --- a/www/resin2/files/patch-apache2-Makefile.in +++ b/www/resin2/files/patch-apache2-Makefile.in @@ -1,3 +1,5 @@ +$FreeBSD$ + --- src/c/plugin/apache2/Makefile.in.orig Thu Nov 13 09:28:46 2003 +++ src/c/plugin/apache2/Makefile.in Thu Nov 13 09:28:52 2003 @@ -27,8 +27,7 @@ diff --git a/www/resin2/files/patch-resin.conf b/www/resin2/files/patch-resin.conf index a90a144e6c7c..477194ff863e 100644 --- a/www/resin2/files/patch-resin.conf +++ b/www/resin2/files/patch-resin.conf @@ -1,3 +1,5 @@ +$FreeBSD$ + --- conf/resin.conf.orig Thu Mar 6 10:19:07 2003 +++ conf/resin.conf Wed Mar 5 21:05:50 2003 @@ -67,7 +67,7 @@ diff --git a/www/resin2/files/patch-wrapper b/www/resin2/files/patch-wrapper deleted file mode 100644 index 7d3f9aadfb18..000000000000 --- a/www/resin2/files/patch-wrapper +++ /dev/null @@ -1,8 +0,0 @@ ---- bin/wrapper.pl.in.orig Sat Oct 4 09:45:23 2003 -+++ bin/wrapper.pl.in Sat Oct 4 09:45:43 2003 -@@ -1,4 +1,4 @@ --#! @PERL@ -+#! %%PERL%% - # - # Copyright(c) 1998-2002 Caucho Technology - # diff --git a/www/resin2/files/pkg-message.in b/www/resin2/files/pkg-message.in index 820698b9dda9..414d86315969 100644 --- a/www/resin2/files/pkg-message.in +++ b/www/resin2/files/pkg-message.in @@ -1,4 +1,14 @@ -Resin is now installed in %%APP_HOME%%. You may want to start it using the -startup script installed as %%PREFIX%%/etc/rc.d/%%APP_NAME%%.sh, and then point -your web browser to the default home page at http://localhost:%%PORT%%/ to read -the doc. Resin can be configured using %%PREFIX%%/etc/%%APP_NAME%%.xml. +Resin is now installed in %%APP_HOME%% + +You may want to activate it in /etc/rc.conf: + +%%APP_NAME%%_enable="YES" + +Then start it: + +env - %%PREFIX%%/etc/rc.d/%%APP_NAME%%.sh start + +And point your web browser to the default home page at +http://localhost:%%PORT%%/ to read the documentation and test the samples. + +Resin configuration is located at %%PREFIX%%/etc/%%APP_NAME%%.xml diff --git a/www/resin2/files/resin.sh.in b/www/resin2/files/resin.sh.in index 8e023ee9b97d..a60b51bbcf68 100644 --- a/www/resin2/files/resin.sh.in +++ b/www/resin2/files/resin.sh.in @@ -1,54 +1,31 @@ #!/bin/sh # -# Resin startup script. +# $FreeBSD$ # -# Borrowed from jakarta-tomcat41 + +# PROVIDE: %%APP_NAME%% + # -# $FreeBSD$ +# Add the following line to /etc/rc.conf to enable %%APP_NAME%%: +# +# %%APP_NAME%%_enable="YES" # -# Determine PREFIX -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${0##*/}\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi - -# Set some variables -MYSELF=`basename $0` -ARGS="-conf $PREFIX/etc/%%APP_NAME%%.xml \ --chdir \ --name %%APP_NAME%% \ --class com.caucho.server.http.HttpServer \ --pid %%PID_FILE%%" -PATH=/usr/sbin:/usr/bin:/bin - -unset CLASSPATH -export JAVA_HOME=%%JAVA_HOME%% -export RESIN_HOME=$PREFIX/%%APP_NAME%% - -set -e - -case "$1" in - start) - echo -n ' ' - truncate -s 0 %%PID_FILE%% - chown %%RUNASUSER%%:%%GROUP%% %%PID_FILE%% - chmod 600 %%PID_FILE%% - su -f -m %%RUNASUSER%% -c "exec $PREFIX/sbin/%%APP_NAME%%ctl $ARGS start" \ - >/dev/null && echo -n '%%APP_NAME%%' - ;; - - stop) - echo -n ' ' - chown %%RUNASUSER%%:%%GROUP%% %%PID_FILE%% - chmod 600 %%PID_FILE%% - su -f -m %%RUNASUSER%% -c "exec $PREFIX/sbin/%%APP_NAME%%ctl $ARGS stop" \ - >/dev/null 2>&1 ; echo -n '%%APP_NAME%%' - ;; - *) - echo "" - echo "Usage: ${MYSELF} { start | stop }" - echo "" - exit 64 - ;; -esac +. /etc/rc.subr + +name=%%APP_NAME%% +rcvar=`set_rcvar` + +command=%%PREFIX%%/sbin/%%APP_NAME%%ctl +command_args="$1" +pidfile=%%PID_FILE%% +procname=%%JAVA%% + +# set defaults + +%%APP_NAME%%_enable=${%%APP_NAME%%_enable:-"NO"} +%%APP_NAME%%_user=${%%APP_NAME%%_user:-"www"} +%%APP_NAME%%_group=${%%APP_NAME%%_group:-"www"} + +load_rc_config ${name} +run_rc_command "$1" diff --git a/www/resin2/files/resinctl b/www/resin2/files/resinctl new file mode 100644 index 000000000000..07be5c788618 --- /dev/null +++ b/www/resin2/files/resinctl @@ -0,0 +1,189 @@ +#! %%PYTHON_CMD%% + +################################################################################ +# Author: Jean-Baptiste Quenot <jb.quenot@caraldi.com> +# Purpose: Manage resin pid file and log files +# Date Created: 2005-01-21 15:43:19 +# Revision: $FreeBSD$ +################################################################################ +# Copyright (c) 2004, Jean-Baptiste Quenot <jb.quenot@caraldi.com> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * The name of the contributors may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +################################################################################ +# +# Files handled by this script (pid file, log files) must reside in a writable +# directory, ie the directory must be owned by the user running the program. + +import sys, os, signal, time, stat, re + +def classpath(): + classpath = [] + resin_libdir = APP_HOME + "/lib" + java_libdir = os.environ['JAVA_HOME'] + "/lib" + for libdir in [resin_libdir, java_libdir]: + for file in os.listdir(libdir): + if re.search("\.jar$", file): + classpath.append(libdir + "/" + file) + return ':'.join(classpath) + +# -socketwait 12345 +# -stdout $APP_HOME/log/stdout.log +# -stderr $APP_HOME/log/stderr.log + +def readProcessId(): + f = open(PID_FILE, 'r') + pid = int(f.readline()) + f.close() + return pid + +def isProgramRunning(pid): + # Send a dummy signal to the process. If it died, an exception is + # thrown + try: + os.kill(pid, signal.SIGCONT) + return 1 + except OSError: + return 0 + +def usage(): + print >> sys.stderr, "Usage: %s {start|stop|restart}" % sys.argv[0] + +def start(): + cwd = os.getcwd() + if os.path.exists(PID_FILE): + # Read the process id + pid = readProcessId() + + if isProgramRunning(pid): + print >> sys.stderr, '%s already started' % APP_NAME + sys.exit(3) + + if not(os.path.exists(COMMAND)): + print >> sys.stderr, '%s cannot be found' % COMMAND + sys.exit(3) + + # Append program output to a log file + l = open(LOG_FILE, 'a') + orig_stderr = os.dup(sys.stderr.fileno()) + os.dup2(l.fileno(), sys.stdout.fileno()) + os.dup2(l.fileno(), sys.stderr.fileno()) + + finfo = os.stat(COMMAND)[stat.ST_MODE] + executable = stat.S_IMODE(finfo) & 0111 + if not(executable): + sys.stderr = os.fdopen(orig_stderr, 'w') + print >> sys.stderr, 'Cannot run %s, execute bit is missing' % COMMAND + sys.exit(5) + + if APP_HOME: + # Change current directory to APP_HOME + os.chdir(APP_HOME) + + # Start program in the background + pid = os.spawnv(os.P_NOWAIT, COMMAND, ARGS) + + # Wait a little + time.sleep(.4) + (unused_pid, status) = os.waitpid(pid, os.WNOHANG) + + # Check program exit status, if available + if unused_pid != 0 and os.WIFEXITED(status): + sys.stderr = os.fdopen(orig_stderr, 'w') + print >> sys.stderr, 'Could not start %s. Check %s for errors.' % (APP_NAME, LOG_FILE) + sys.exit(2) + + # It's alive, so write down the process id + os.chdir(cwd) + f = open(PID_FILE, 'w') + print >> f, pid + f.close() + +def warnNotRunning(): + if sys.argv[1] == "stop": + print >> sys.stderr, '%s is not running' % APP_NAME + else: + print >> sys.stderr, 'Warning: %s was not running' % APP_NAME + +def cleanup(): + os.unlink(PID_FILE) + +def stop(): + if os.path.exists(PID_FILE): + # Read the process id + pid = readProcessId() + else: + warnNotRunning() + return + + if not(isProgramRunning(pid)): + warnNotRunning() + cleanup() + return + + # Terminate program + os.kill(pid, signal.SIGTERM) + + while isProgramRunning(pid): + time.sleep(.1) + + cleanup() + +if __name__ == '__main__': + LOG_FILE = "%%LOG_FILE%%" + APP_NAME = "%%APP_NAME%%" + APP_HOME = "%%APP_HOME%%" + CONTROL_PROGRAM = "%%APP_NAME%%ctl" + PID_FILE = "%%PID_FILE%%" + COMMAND = "%%JAVA%%" + ARGS = [COMMAND] + + if os.environ.has_key('JAVA_OPTS'): + ARGS += os.environ['JAVA_OPTS'].split(" ") + + ARGS += [ + "-Dresin.home=%%APP_HOME%%", + "com.caucho.server.http.HttpServer", + "-conf", "%%PREFIX%%/etc/%%APP_NAME%%.xml" + ] + + os.environ['JAVA_HOME'] = "%%JAVA_HOME%%" + os.environ['CLASSPATH'] = classpath() + + if len(sys.argv) != 2: + usage() + sys.exit(1) + + if sys.argv[1] == "start": + start() + + elif sys.argv[1] == "stop": + stop() + + elif sys.argv[1] == "restart": + stop() + start() + + else: + usage() + sys.exit(1) diff --git a/www/resin2/pkg-descr b/www/resin2/pkg-descr index 015d3d5586de..2cb2a45e22cd 100644 --- a/www/resin2/pkg-descr +++ b/www/resin2/pkg-descr @@ -8,12 +8,10 @@ Sun. o You may use Resin for development, evaluation, and demos. o You must contact us to purchase a deployment license if either: - * You are paid to use Resin. * You are paying someone else to use Resin. o If no one is paid to use Resin, you may use Resin for deployment: - * students * private use * tiny startups with neither funding nor income. diff --git a/www/resin2/pkg-plist b/www/resin2/pkg-plist index 331d9f7e8917..f31105b3581e 100644 --- a/www/resin2/pkg-plist +++ b/www/resin2/pkg-plist @@ -1,3 +1,4 @@ +@comment $FreeBSD$ %%APP_NAME%%/doc/beta.xtp %%APP_NAME%%/doc/changes-1.xtp %%APP_NAME%%/doc/changes.xtp @@ -195,6 +196,7 @@ %%APP_NAME%%/doc/java_tut/javadoc/package-list %%APP_NAME%%/doc/java_tut/javadoc/resources/inherit.gif %%APP_NAME%%/doc/java_tut/javadoc/stylesheet.css +%%APP_NAME%%/doc/java_tut/jndi-appconfig.xtp %%APP_NAME%%/doc/java_tut/linux-boot.xtp %%APP_NAME%%/doc/java_tut/linux-init.xtp %%APP_NAME%%/doc/java_tut/mail_form.xtp |