ports/159695: [patch] www/tomcat6: configurable user/groups breaks if configured
Jason Helfman
jhelfman at experts-exchange.com
Thu Aug 11 17:40:08 UTC 2011
>Number: 159695
>Category: ports
>Synopsis: [patch] www/tomcat6: configurable user/groups breaks if configured
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Aug 11 17:40:07 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Jason Helfman
>Release: FreeBSD 8.2-RELEASE i386
>Organization:
Experts Exchange, LLC.
>Environment:
System: FreeBSD eggman.experts-exchange.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Fri Feb 18 02:24:46 UTC 2011 root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
Using a different user/group for tomcat6, breaks installation.
This patch removes configurability. (tomcat6/files/pkg-install.in, dead (with patch))
>How-To-Repeat:
Add to /etc/make.conf (or use make arguments)
.if ${.CURDIR:M*/www/tomcat6}
TOMCAT_USER=www1
TOMCAT_GROUP=www1
.endif
Result:
[jhelfman at eggman /usr/ports/www/tomcat6]$ sudo make
===> License ASL accepted by the user
===> Extracting for tomcat-6.0.32
=> SHA256 Checksum OK for apache-tomcat-6.0.32.tar.gz.
===> Patching for tomcat-6.0.32
Installation settings:
Destination directory: /usr/local/apache-tomcat-6.0
Location of JDK: /usr/local/diablo-jdk1.6.0
Location of Java port: java/diablo-jdk16
Running as (user/group): www1/www1
HTTP port: 8180
Shutdown listener port: 8005
AJP 1.3 connector port: 8009
Logfile stdout: /usr/local/apache-tomcat-6.0/logs/stdout.log
Logfile stderr: /usr/local/apache-tomcat-6.0/logs/stderr.log
===> Applying FreeBSD patches for tomcat-6.0.32
===> Configuring for tomcat-6.0.32
[jhelfman at eggman /usr/ports/www/tomcat6]$ sudo make install
===> Installing for tomcat-6.0.32
===> tomcat-6.0.32 depends on file: /usr/local/diablo-jdk1.6.0/bin/java - found
pw: gid `80' has already been allocated
Added group "www1".
pw: uid `80' has already been allocated
Added user "www1".
===> Generating temporary packing list
===> Checking if www/tomcat6 already installed
>Fix:
Index: www/tomcat6/Makefile
===================================================================
RCS file: /home/jhelfman/ncvs/ports/www/tomcat6/Makefile,v
retrieving revision 1.63
diff -u -r1.63 Makefile
--- www/tomcat6/Makefile 12 Jun 2011 13:55:39 -0000 1.63
+++ www/tomcat6/Makefile 11 Aug 2011 17:27:48 -0000
@@ -7,6 +7,7 @@
PORTNAME= tomcat
PORTVERSION= 6.0.32
+PORTREVISION= 1
CATEGORIES= www java
MASTER_SITES= ${MASTER_SITE_APACHE}
MASTER_SITE_SUBDIR= tomcat/tomcat-6/v${PORTVERSION}/bin
@@ -23,14 +24,13 @@
NO_BUILD= YES
USE_RC_SUBR= tomcat6.sh
-SUB_FILES= pkg-install
MAJOR_VER= ${PORTVERSION:R}
APP_HOME?= ${PREFIX}/${DISTNAME:R}
LOG_DIR= ${APP_HOME}/logs
APP_SHORTNAME= ${PORTNAME}${MAJOR_VER:S/.//}
-TOMCAT_USER?= www
-TOMCAT_GROUP?= www
+USERS= www
+GROUPS= www
HTTP_PORT?= 8180
SHUTDOWN_PORT?= 8005
AJP_1_3_PORT?= 8009
@@ -41,7 +41,7 @@
logging.properties server.xml tomcat-users.xml web.xml
CONF_EXT= sample
PLIST_SUB= T=${APP_HOME:S/^${PREFIX}\///} CONF_EXT=${CONF_EXT} \
- WWWOWN=${TOMCAT_USER} WWWGRP=${TOMCAT_GROUP}
+ WWWOWN=${USERS} WWWGRP=${GROUPS}
LATEST_LINK= ${APP_SHORTNAME}
SUB_LIST= AJP_1_3_PORT=${AJP_1_3_PORT} \
@@ -54,8 +54,7 @@
STDERR_LOG=${STDERR_LOG} \
STDOUT_LOG=${STDOUT_LOG} \
TOMCAT_HOME=${APP_HOME} \
- TOMCAT_VERSION=${MAJOR_VER:S/.//} \
- USER=${TOMCAT_USER}
+ TOMCAT_VERSION=${MAJOR_VER:S/.//}
.include <bsd.port.pre.mk>
@@ -64,7 +63,7 @@
@${ECHO_MSG} " Destination directory: ${APP_HOME}"
@${ECHO_MSG} " Location of JDK: ${JAVA_HOME}"
@${ECHO_MSG} " Location of Java port: ${JAVA_PORT}"
- @${ECHO_MSG} " Running as (user/group): ${TOMCAT_USER}/${TOMCAT_GROUP}"
+ @${ECHO_MSG} " Running as (user/group): ${USERS}/${GROUPS}"
@${ECHO_MSG} " HTTP port: ${HTTP_PORT}"
@${ECHO_MSG} " Shutdown listener port: ${SHUTDOWN_PORT}"
@${ECHO_MSG} " AJP 1.3 connector port: ${AJP_1_3_PORT}"
@@ -78,9 +77,6 @@
@${MV} ${WRKSRC}/conf/${f} ${WRKSRC}/conf/${f}.${CONF_EXT}
.endfor
-pre-install:
- @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-
do-install:
@${ECHO_MSG} -n ">> Creating destination directory..."
@${MKDIR} ${APP_HOME}
@@ -105,7 +101,7 @@
@${ECHO_MSG} " [ DONE ]"
@${ECHO_MSG} -n ">> Fixing ownership settings..."
- @${CHOWN} -R ${TOMCAT_USER}:${TOMCAT_GROUP} ${APP_HOME}/conf ${APP_HOME}/logs \
+ @${CHOWN} -R ${USERS}:${GROUPS} ${APP_HOME}/conf ${APP_HOME}/logs \
${APP_HOME}/temp ${APP_HOME}/webapps ${APP_HOME}/work
@${ECHO_MSG} " [ DONE ]"
Index: www/tomcat6/files/pkg-install.in
===================================================================
RCS file: www/tomcat6/files/pkg-install.in
diff -N www/tomcat6/files/pkg-install.in
--- www/tomcat6/files/pkg-install.in 7 Feb 2006 08:50:09 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-#!/bin/sh
-#
-# Checks if the '%%USER%%' user and '%%GROUP%%' group exist. If they don't, then
-# an attempt is made to create both.
-#
-# $FreeBSD: ports/www/tomcat6/files/pkg-install.in,v 1.1 2006/02/07 08:50:09 lawrance Exp $
-#
-
-# Make sure we're called during the 'make install' process
-if [ "$2" != "PRE-INSTALL" ]; then
- exit 0
-fi
-
-# Set some constants
-UID=80
-GID=${UID}
-USER=%%USER%%
-GROUP=%%GROUP%%
-
-# 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}\"."
- elif pw groupadd "${GROUP}"; then
- echo "Added group \"${GROUP}\"."
- else
- 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 not, try to create it
- if pw useradd "${USER}" -u ${UID} -g "${GROUP}" -h - \
- -s "/sbin/nologin" -d "/nonexistent" \
- -c "World Wide Web Owner";
- then
- 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..."
- exit 1
- fi
-fi
-exit 0
>Release-Note:
>Audit-Trail:
>Unformatted:
>> Creating destination directory... [ DONE ]
>> Copying files to destination directory... [ DONE ]
>> Creating symlink to tools.jar... [ DONE ]
>> Fixing ownership settings... [ DONE ]
>> Fixing permissions... [ DONE ]
===> Installing rc.d startup script(s)
===> Registering installation for tomcat-6.0.32
More information about the freebsd-ports-bugs
mailing list