diff options
author | Herve Quiroz <hq@FreeBSD.org> | 2005-09-29 15:08:23 +0000 |
---|---|---|
committer | Herve Quiroz <hq@FreeBSD.org> | 2005-09-29 15:08:23 +0000 |
commit | 7d30d6ec1569d599b4335d959d4528b468b075e7 (patch) | |
tree | 07fec7c70c1039ec5fcafd046fc62008b1556e54 /www/tomcat55 | |
parent | e541e8ce9609a2fd97a2ae79ca488b0cde352d7e (diff) | |
download | ports-7d30d6ec1569d599b4335d959d4528b468b075e7.tar.gz ports-7d30d6ec1569d599b4335d959d4528b468b075e7.zip |
Notes
Diffstat (limited to 'www/tomcat55')
-rw-r--r-- | www/tomcat55/Makefile | 35 | ||||
-rw-r--r-- | www/tomcat55/pkg-deinstall | 8 | ||||
-rw-r--r-- | www/tomcat55/pkg-install | 33 |
3 files changed, 44 insertions, 32 deletions
diff --git a/www/tomcat55/Makefile b/www/tomcat55/Makefile index 8c918e8f5339..e02b300e6a6b 100644 --- a/www/tomcat55/Makefile +++ b/www/tomcat55/Makefile @@ -37,8 +37,8 @@ CONTROL_SCRIPT_MANPAGE_TITLE= ${CONTROL_SCRIPT_NAME:U} STARTUP_ORDER?= 020 STARTUP_SCRIPT_NAME= ${PORTNAME}${MAJOR_VER:S/.//}.sh STARTUP_SCRIPT= ${PREFIX}/etc/rc.d/${STARTUP_ORDER}.${STARTUP_SCRIPT_NAME} -USER= www -GROUP= www +TOMCAT_USER?= www +TOMCAT_GROUP?= www PW?= /usr/sbin/pw HTTP_PORT?= 8180 SHUTDOWN_PORT?= 8005 @@ -54,7 +54,7 @@ REPLACE_FILES= ${PORTSDIR}/www/jakarta-tomcat4/files/daemonctl.c \ ${WRKSRC}/conf/server.xml JAR_FILE= bin/bootstrap.jar WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/work -PLIST_SUB+= T=${APP_HOME:S/^${PREFIX}\///} WWWOWN=${USER} WWWGRP=${GROUP} +PLIST_SUB+= T=${APP_HOME:S/^${PREFIX}\///} WWWOWN=${TOMCAT_USER} WWWGRP=${TOMCAT_GROUP} LATEST_LINK= ${APP_SHORTNAME} CONF_EXT= sample PLIST_SUB+= CONF_EXT=${CONF_EXT} @@ -62,10 +62,15 @@ PLIST_SUB+= CONF_EXT=${CONF_EXT} SUB_FILES= tomcat.sh SUB_LIST= TOMCAT_VERSION=${MAJOR_VER:S/.//} \ TOMCAT_HOME=${APP_HOME} \ - USER=${USER} \ + USER=${TOMCAT_USER} \ STDOUT_LOG=${STDOUT_LOG} \ STDERR_LOG=${STDERR_LOG} +REPLACE_FILES+= ${PKGDIR}/pkg-install \ + ${PKGDIR}/pkg-deinstall +PKGINSTALL= ${WRKDIR}/pkg-install +PKGDEINSTALL= ${WRKDIR}/pkg-deinstall + .include <bsd.port.pre.mk> .if ${JAVA_PORT_VERSION:C/^([0-9])\.([0-9])(.*)$/\1.\2/} == "1.4" @@ -82,7 +87,7 @@ pre-patch: @${ECHO_MSG} " Startup script location: ${STARTUP_SCRIPT}" @${ECHO_MSG} " Location of JDK: ${JAVA_HOME}" @${ECHO_MSG} " Location of Java port: ${JAVA_PORT}" - @${ECHO_MSG} " Running as (user/group): ${USER}/${GROUP}" + @${ECHO_MSG} " Running as (user/group): ${TOMCAT_USER}/${TOMCAT_GROUP}" @${ECHO_MSG} " HTTP port: ${HTTP_PORT}" @${ECHO_MSG} " Shutdown listener port: ${SHUTDOWN_PORT}" @${ECHO_MSG} " WARP port: ${WARP_PORT}" @@ -91,7 +96,6 @@ pre-patch: @${ECHO_MSG} " Logfile stderr: ${STDERR_LOG}" @${ECHO_MSG} " Starting after install: ${AUTO_START}" @${ECHO_MSG} " Stop time-out: ${STOP_TIMEOUT} sec." - @PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL post-patch: @${ECHO_MSG} -n ">> Removing unneeded files..." @@ -108,7 +112,7 @@ post-patch: -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 "/%%GROUP%%/s//${TOMCAT_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" \ @@ -124,12 +128,15 @@ post-patch: -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 "/%%USER%%/s//${TOMCAT_USER}/g" \ -e "/%%WARP_PORT%%/s//${WARP_PORT}/g" \ $f > ${WRKDIR}/`basename $f` @${ECHO_MSG} " [ DONE ]" .endfor +pre-install: + @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL + do-install: @${ECHO_MSG} -n ">> Creating destination directory..." @${MKDIR} ${APP_HOME} @@ -158,7 +165,7 @@ do-install: ${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} + @${CHOWN} ${TOMCAT_USER}:${TOMCAT_GROUP} ${CONTROL_SCRIPT} @${CHMOD} 6754 ${CONTROL_SCRIPT} @${ECHO_MSG} " [ DONE ]" @@ -173,8 +180,8 @@ do-install: .endif @${ECHO_MSG} -n ">> Creating log files..." - @${INSTALL} -m 664 -o ${USER} -g ${GROUP} /dev/null ${STDOUT_LOG} - @${INSTALL} -m 664 -o ${USER} -g ${GROUP} /dev/null ${STDERR_LOG} + @${INSTALL} -m 664 -o ${TOMCAT_USER} -g ${TOMCAT_GROUP} /dev/null ${STDOUT_LOG} + @${INSTALL} -m 664 -o ${TOMCAT_USER} -g ${TOMCAT_GROUP} /dev/null ${STDERR_LOG} @${ECHO_MSG} " [ DONE ]" @${ECHO_MSG} -n ">> Creating symlink to tools.jar..." @@ -182,7 +189,7 @@ do-install: @${ECHO_MSG} " [ DONE ]" @${ECHO_MSG} -n ">> Fixing ownership settings..." - @${CHOWN} -R ${USER}:${GROUP} ${APP_HOME} + @${CHOWN} -R ${TOMCAT_USER}:${TOMCAT_GROUP} ${APP_HOME} @${ECHO_MSG} " [ DONE ]" @${ECHO_MSG} -n ">> Fixing permissions..." @@ -191,13 +198,13 @@ do-install: @${ECHO_MSG} -n ">> Creating PID file..." @${TOUCH} ${PID_FILE} - @${CHOWN} ${USER}:${GROUP} ${PID_FILE} + @${CHOWN} ${TOMCAT_USER}:${TOMCAT_GROUP} ${PID_FILE} @${CHMOD} 0600 ${PID_FILE} @${ECHO_MSG} " [ DONE ]" post-install: @${ECHO_MSG} "${APP_TITLE} ${PORTVERSION} has been installed in ${APP_HOME}." - @${ECHO_MSG} "If a user should be able to use ${CONTROL_SCRIPT_NAME}, then put this user in the group ${GROUP}." + @${ECHO_MSG} "If a user should be able to use ${CONTROL_SCRIPT_NAME}, then put this user in the group ${TOMCAT_GROUP}." .if !defined(NOPORTDOCS) @${ECHO_MSG} "Use 'man ${CONTROL_SCRIPT_NAME}' for information about starting and stopping ${APP_TITLE}." .endif diff --git a/www/tomcat55/pkg-deinstall b/www/tomcat55/pkg-deinstall index 52c321ce5f69..41ceb563a42e 100644 --- a/www/tomcat55/pkg-deinstall +++ b/www/tomcat55/pkg-deinstall @@ -5,10 +5,10 @@ # * 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 +# * Checks if the '%%USER%%' user exists. If it does, then it displays # a message. # -# $FreeBSD: /tmp/pcvs/ports/www/tomcat55/Attic/pkg-deinstall,v 1.2 2004-01-02 12:31:11 znerd Exp $ +# $FreeBSD: /tmp/pcvs/ports/www/tomcat55/Attic/pkg-deinstall,v 1.3 2005-09-29 15:08:23 hq Exp $ # # Make sure we're in the right stage of the process @@ -37,8 +37,8 @@ fi if [ "$2" = "POST-DEINSTALL" ]; then # If the user exists, then display a message - if pw usershow "www" 2>/dev/null 1>&2; then - echo "To delete the www user permanently, use 'pw userdel www'" + if pw usershow "%%USER%%" 2>/dev/null 1>&2; then + echo "To delete the %%USER%% user permanently, use 'pw userdel %%USER%%'" fi fi diff --git a/www/tomcat55/pkg-install b/www/tomcat55/pkg-install index a934f0068bff..9ba5ce4c17eb 100644 --- a/www/tomcat55/pkg-install +++ b/www/tomcat55/pkg-install @@ -1,9 +1,9 @@ #!/bin/sh # -# Checks if the 'www' user and group exist. If they don't, then +# Checks if the '%%USER%%' user and %%GROUP%% group exist. If they don't, then # an attempt is made to create both. # -# $FreeBSD: /tmp/pcvs/ports/www/tomcat55/Attic/pkg-install,v 1.2 2005-06-13 14:08:34 hq Exp $ +# $FreeBSD: /tmp/pcvs/ports/www/tomcat55/Attic/pkg-install,v 1.3 2005-09-29 15:08:23 hq Exp $ # # Make sure we're called during the 'make install' process @@ -12,34 +12,39 @@ if [ "$2" != "PRE-INSTALL" ]; then fi # Set some constants -USER=www -GROUP=${USER} UID=80 GID=${UID} # See if the group already exists -if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then +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}\"." + if pw groupadd "%%GROUP%%" -g ${GID}; then + echo "Added group \"%%GROUP%%\"." + elif pw groupadd "%%GROUP%%"; then + echo "Added group \"%%GROUP%%\"." else - echo "Adding group \"${GROUP}\" failed..." + echo "Adding group \"%%GROUP%%\" failed..." exit 1 fi fi # See if the user already exists -if ! pw usershow "${USER}" 2>/dev/null 1>&2; then +if ! pw usershow "%%USER%%" 2>/dev/null 1>&2; then # If not, try to create it - if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ - -s "/sbin/nologin" -d "/nonexistent" \ - -c "World Wide Web Owner"; \ + if pw useradd "%%USER%%" -u ${UID} -g "%%GROUP%%" -h - \ + -s "/sbin/nologin" -d "/nonexistent" \ + -c "World Wide Web Owner"; then - echo "Added user \"${USER}\"." + echo "Added user \"%%USER%%\"." + elif pw useradd "%%USER%%" -g "%%GROUP%%" -h - \ + -s "/sbin/nologin" -d "/nonexistent" \ + -c "World Wide Web Owner"; + then + echo "Added user \"%%USER%%\"." else - echo "Adding user \"${USER}\" failed..." + echo "Adding user \"%%USER%%\" failed..." exit 1 fi fi |