diff options
author | Greg Lewis <glewis@FreeBSD.org> | 2003-11-20 21:44:14 +0000 |
---|---|---|
committer | Greg Lewis <glewis@FreeBSD.org> | 2003-11-20 21:44:14 +0000 |
commit | 81c8db1a2b05e0e5d6791d77ff0e628f131f0ce7 (patch) | |
tree | 87b57f9f6f5b1f60533a0b8961c5ed7a278b5f1d /www/resin3/files | |
parent | e462215b1bb7b96086160206c70e749d55d22979 (diff) | |
download | ports-81c8db1a2b05e0e5d6791d77ff0e628f131f0ce7.tar.gz ports-81c8db1a2b05e0e5d6791d77ff0e628f131f0ce7.zip |
. Avoid conflict between resin2 and resin3
. Fix resin{2,3}ctl first line (perl path)
. Pid file is no more created in the Makefile
. New resin.sh startup script, manages pid file
. pkg-[de]install and pkg-message are now generated
. Do not write anything after including bsd.port.post.mk
. Packages are now supported (reported by Arcadius Ahouansou)
. Integration with apxs for [de]activating mod_caucho
PR: 57566
Submitted by: Jean-Baptiste Quenot <jbq@caraldi.com> (maintainer)
Notes
Notes:
svn path=/head/; revision=94546
Diffstat (limited to 'www/resin3/files')
-rw-r--r-- | www/resin3/files/install.sh | 51 | ||||
-rw-r--r-- | www/resin3/files/patch-apache-Makefile.in | 12 | ||||
-rw-r--r-- | www/resin3/files/patch-apache2-Makefile.in | 12 | ||||
-rw-r--r-- | www/resin3/files/patch-wrapper | 8 | ||||
-rw-r--r-- | www/resin3/files/pkg-deinstall | 52 | ||||
-rw-r--r-- | www/resin3/files/pkg-install | 50 | ||||
-rw-r--r-- | www/resin3/files/pkg-message.in | 4 | ||||
-rw-r--r-- | www/resin3/files/resin.sh.in | 53 |
8 files changed, 242 insertions, 0 deletions
diff --git a/www/resin3/files/install.sh b/www/resin3/files/install.sh new file mode 100644 index 000000000000..24794c4e9be9 --- /dev/null +++ b/www/resin3/files/install.sh @@ -0,0 +1,51 @@ +#! /bin/sh + +set -e + +warning() { + echo "Kept %%PREFIX%%/etc/%%APP_NAME%%.xml intact from previous installation, please diff" + echo "against %%APP_NAME%%.xml-dist" +} + +# Install config file only if none is already there +if test -e %%PREFIX%%/etc/%%APP_NAME%%.xml && \ + ! cmp -s %%WRKDIR%%/resin.conf %%PREFIX%%/etc/%%APP_NAME%%.xml ; then + echo + echo "********************************************************************************" + warning | fmt -w 80 + echo "********************************************************************************" + echo +else + install %%WRKDIR%%/resin.conf %%PREFIX%%/etc/%%APP_NAME%%.xml + echo Installed %%PREFIX%%/etc/%%APP_NAME%%.xml +fi + +# Install new config file with '-dist' appended +install %%WRKDIR%%/resin.conf %%PREFIX%%/etc/%%APP_NAME%%.xml-dist +echo Installed %%PREFIX%%/etc/%%APP_NAME%%.xml-dist + +install %%WRKSRC%%/conf/app-default.xml %%PREFIX%%/etc/ +echo Installed %%PREFIX%%/etc/app-default.xml + +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 +echo Installed %%PREFIX%%/sbin/%%APP_NAME%%ctl + +test -d %%APP_HOME%% || mkdir %%APP_HOME%% +echo Created installation directory %%APP_HOME%% + +list() +{ + for dir in doc lib libexec xsl ; do + ( cd %%WRKSRC%% ; find $dir ) + done +} + +# Remove all empty dirs +( cd %%WRKSRC%% ; find doc -type d -empty -delete ) + +echo Installing in %%APP_HOME%% +list | xargs tar -C %%WRKSRC%% -cf- | tar -C %%APP_HOME%% -xpf- diff --git a/www/resin3/files/patch-apache-Makefile.in b/www/resin3/files/patch-apache-Makefile.in new file mode 100644 index 000000000000..4b10a88f34b5 --- /dev/null +++ b/www/resin3/files/patch-apache-Makefile.in @@ -0,0 +1,12 @@ +--- 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 @@ + $(CC) -c $(INCLUDES) $(CFLAGS) $< + + install : +- sh install.sh -conf $(apache_conf) -libexec $(apache_libexec) \ +- -resin_home $(resin_home) ++ %%APXS%% -i -a -n caucho mod_caucho.so + + clean : + - rm *.o *.lo *.la *.so diff --git a/www/resin3/files/patch-apache2-Makefile.in b/www/resin3/files/patch-apache2-Makefile.in new file mode 100644 index 000000000000..21abaf49de07 --- /dev/null +++ b/www/resin3/files/patch-apache2-Makefile.in @@ -0,0 +1,12 @@ +--- src/c/plugin/apache2/Makefile.in.orig Tue Sep 23 00:54:34 2003 ++++ src/c/plugin/apache2/Makefile.in Mon Nov 17 11:33:19 2003 +@@ -30,8 +30,7 @@ + $(CC) -c $(INCLUDES) $(CFLAGS) $< + + install : +- sh install.sh -conf $(apache_conf) -apache_dir $(apache_dir) \ +- -libexec $(apache_libexec) -resin_home $(resin_home) ++ %%APXS%% -i -a -n caucho mod_caucho.so + + clean : + - rm *.o *.lo *.so diff --git a/www/resin3/files/patch-wrapper b/www/resin3/files/patch-wrapper new file mode 100644 index 000000000000..7d3f9aadfb18 --- /dev/null +++ b/www/resin3/files/patch-wrapper @@ -0,0 +1,8 @@ +--- 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/resin3/files/pkg-deinstall b/www/resin3/files/pkg-deinstall new file mode 100644 index 000000000000..b56243508443 --- /dev/null +++ b/www/resin3/files/pkg-deinstall @@ -0,0 +1,52 @@ +#!/bin/sh +# +# This script does the following. +# +# * Checks if the PID file exists. If it does, it kills the +# process and removes the PID file. +# +# * Checks if the 'www' user exists. If it does, then it displays +# a message. +# +# $FreeBSD: /tmp/pcvs/ports/www/resin3/files/Attic/pkg-deinstall,v 1.1 2003-11-20 21:44:14 glewis Exp $ +# +# Borrowed from the jakarta-tomcat port +# + +set -e + +PID_FILE=%%PID_FILE%% +RUNASUSER=%%RUNASUSER%% + +# Make sure we're in the right stage of the process +if [ "$2" = "DEINSTALL" ]; then + + # Kill the process if it is still running + if [ -s ${PID_FILE} ]; then + PID=`cat ${PID_FILE}` + echo -n ">> Killing %%APP_NAME%% process (${PID})..." + + if /bin/kill ${PID} > /dev/null 2> /dev/null ; then + echo " [ DONE ]" + else + echo " [ FAILED ]" + fi + + echo -n ">> Removing PID file (${PID_FILE})..." + + if rm ${PID_FILE} > /dev/null 2> /dev/null ; then + echo " [ DONE ]" + else + echo " [ FAILED ]" + fi + fi +fi + +if [ "$2" = "POST-DEINSTALL" ]; then + # If the user exists, then display a message + if pw usershow "$RUNASUSER" 2>/dev/null 1>&2; then + echo "To delete the $RUNASUSER user permanently, use 'pw userdel $RUNASUSER'" + fi +fi + +exit 0 diff --git a/www/resin3/files/pkg-install b/www/resin3/files/pkg-install new file mode 100644 index 000000000000..09c24fd66750 --- /dev/null +++ b/www/resin3/files/pkg-install @@ -0,0 +1,50 @@ +#!/bin/sh +# +# Checks if the requested user and group exist. If they don't, then +# an attempt is made to create both. +# +# $FreeBSD: /tmp/pcvs/ports/www/resin3/files/Attic/pkg-install,v 1.1 2003-11-20 21:44:14 glewis Exp $ +# +# Borrowed from the jakarta-tomcat port +# + +set -e + +RUNASUSER=%%RUNASUSER%% +RUNASUID=%%RUNASUID%% +GROUP=%%GROUP%% +GID=%%GID%% + +if [ "$2" = "POST-INSTALL" ]; then + # We're called after the 'make install' process + # See if the group already exists + if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then + + # If not, try to create it + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi + fi + + # See if the user already exists + if ! pw usershow "${RUNASUSER}" 2>/dev/null 1>&2; then + + # If not, try to create it + if pw useradd ${RUNASUSER} -u ${RUNASUID} -g ${GROUP} -h - \ + -s "/sbin/nologin" -d "/nonexistent" \ + -c "World Wide Web Owner"; \ + then + echo "Added user \"${RUNASUSER}\"." + else + echo "Adding user \"${RUNASUSER}\" failed..." + exit 1 + fi + fi + + chown -R %%RUNASUSER%%:%%GROUP%% $PKG_PREFIX/%%APP_NAME%% +fi + +exit 0 diff --git a/www/resin3/files/pkg-message.in b/www/resin3/files/pkg-message.in new file mode 100644 index 000000000000..820698b9dda9 --- /dev/null +++ b/www/resin3/files/pkg-message.in @@ -0,0 +1,4 @@ +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. diff --git a/www/resin3/files/resin.sh.in b/www/resin3/files/resin.sh.in new file mode 100644 index 000000000000..425dd0f8a8f7 --- /dev/null +++ b/www/resin3/files/resin.sh.in @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Resin startup script. +# +# Borrowed from jakarta-tomcat41 +# +# $FreeBSD$ +# + +# 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.resin.Resin \ +-pid %%PID_FILE%%" +PATH=/usr/sbin:/usr/bin:/bin + +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 |