Bug 157667

Summary: Fix port: databases/postgresql91-server should use USERS
Product: Ports & Packages Reporter: Chris Rees <utisoft>
Component: Individual Port(s)Assignee: Palle Girgensohn <girgen>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Chris Rees 2011-06-06 20:10:07 UTC
	

	This port uses pkg-install to create new users instead of using USERS= and GROUPS=

Fix: - Use USERS and GROUPS
	- Remove quotes from BROKEN to make portlint happy

	Submitted by: Chris Rees (utisoft@gmail.com)




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.--sMeZxE6l7FI8ATZSajb8DnmuSnZSTgQmhMBcwys4lFnKbUjt
Content-Type: text/plain; name="databases-postgresql91-server.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="databases-postgresql91-server.patch"

Index: Makefile
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/databases/postgresql91-server/Makefile,v
retrieving revision 1.217
diff -u -r1.217 Makefile
--- Makefile	28 Apr 2011 07:46:15 -0000	1.217
+++ Makefile	2 Jun 2011 13:47:19 -0000
@@ -35,7 +35,6 @@
 
 PG_USER?=	pgsql
 PG_GROUP?=	pgsql
-PG_UID?=	70
 
 LDFLAGS+=	-L${LOCALBASE}/lib
 INCLUDES+=	-I${LOCALBASE}/include
@@ -62,6 +61,8 @@
 USE_PGSQL=	yes
 WANT_PGSQL_VER=	${PORTVERSION:C/([0-9][0-9]*)\.([0-9][0-9]*).*/\1\2/g}
 SUB_FILES+=	502.pgsql
+USERS=		${PG_USER}
+GROUPS=		${PG_GROUP}
 .endif
 
 .if !defined(SLAVE_ONLY)
@@ -173,7 +174,7 @@
 
 .  if defined(WITH_MIT_KRB5)
 .    if exists(/usr/lib/libkrb5.so) || exists(/usr/bin/krb5-config)
-BROKEN=		"You must remove heimdal's /usr/bin/krb5-config and /usr/lib/libkrb5.so*, and set NO_KERBEROS=true in /etc/make.conf to build successfully with MIT-KRB"
+BROKEN=		You must remove heimdal's /usr/bin/krb5-config and /usr/lib/libkrb5.so*, and set NO_KERBEROS=true in /etc/make.conf to build successfully with MIT-KRB
 .    endif
 # Allow defining a home built MIT Kerberos by setting KRB5_HOME
 .    if defined(KRB5_HOME) && exists(${KRB5_HOME}/lib/libgssapi_krb5.a) && exists(${KRB5_HOME}/bin/krb5-config)
@@ -309,20 +310,10 @@
 .  endif
 .  if exists(${FILESDIR}/pkg-install${PKGNAMESUFFIX}.in)
 SUB_FILES+=     pkg-install${PKGNAMESUFFIX}
-SUB_LIST=       PG_GROUP=$(PG_GROUP) \
-                PG_USER=$(PG_USER) \
-                PG_UID=$(PG_UID)
-PLIST_SUB+=     PG_USER=$(PG_USER)
 PKGINSTALL=     ${WRKDIR}/pkg-install${PKGNAMESUFFIX}
 .  endif
 .endif
 
-.if defined(SERVER_ONLY)
-pre-su-install:
-	@ ${SETENV} PKG_PREFIX=${PREFIX} PG_USER=$(PG_USER) PG_GROUP=$(PG_GROUP) \
-		${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
-.endif
-
 .if !defined(NO_BUILD)
 post-patch:
 	@${REINPLACE_CMD} s/@PTHREAD_LIBS@// ${WRKSRC}/src/Makefile.global.in
Index: pkg-plist-server
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/databases/postgresql91-server/pkg-plist-server,v
retrieving revision 1.32
diff -u -r1.32 pkg-plist-server
--- pkg-plist-server	28 Apr 2011 07:46:15 -0000	1.32
+++ pkg-plist-server	4 Jun 2011 13:49:46 -0000
@@ -756,9 +756,8 @@
 share/postgresql/tsearch_data/synonym_sample.syn
 share/postgresql/tsearch_data/thesaurus_sample.ths
 @dirrmtry share/postgresql/tsearch_data
-@unexec echo "Warning: If you will *NOT* use this package anymore, please remove the pgsql user manually."
 @dirrmtry share/postgresql
 @dirrmtry etc/periodic/daily
 @dirrmtry etc/periodic
 @dirrmtry lib/postgresql
-@dirrmtry %%PG_USER%%
+@dirrmtry pgsql
Index: files/pkg-install-server.in
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/databases/postgresql91-server/files/pkg-install-server.in,v
retrieving revision 1.1
diff -u -r1.1 pkg-install-server.in
--- files/pkg-install-server.in	18 Apr 2011 23:34:27 -0000	1.1
+++ files/pkg-install-server.in	2 Jun 2011 13:46:03 -0000
@@ -3,9 +3,6 @@
 # $FreeBSD: ports/databases/postgresql91-server/files/pkg-install-server.in,v 1.1 2011/04/18 23:34:27 girgen Exp $
 
 PATH=/bin:/usr/bin:/usr/sbin
-PG_USER=%%PG_USER%%
-PG_GROUP=%%PG_GROUP%%
-PG_UID=%%PG_UID%%
 
 backupwarning() { echo "
 
@@ -23,43 +20,6 @@
 }
 
 case $2 in
-PRE-INSTALL)
-	backupwarning
-	PGUSER=${PGUSER:-${PG_USER}}
-	PGGROUP=${PGGROUP:-${PG_GROUP}}
-	DB_DIR=${PKG_PREFIX}/${PGUSER}
-	UID=${PG_UID}
-	GID=${PG_UID}
-
-	if pw group show "${PGGROUP}" 2>/dev/null; then
-		echo "You already have a group \"${PGGROUP}\", so I will use it."
-	else
-		if pw groupadd ${PGGROUP} -g ${GID}; then
-			echo "Added group \"${PGGROUP}\"."
-		else
-			echo "Adding group \"${PGGROUP}\" failed..."
-			exit 1
-		fi
-	fi
-
-	if pw user show "${PGUSER}" 2>/dev/null; then
-		echo "You already have a user \"${PGUSER}\", so I will use it."
-	else
-		if pw useradd ${PGUSER} -u ${UID} -g ${PGGROUP} -h - \
-			-d ${DB_DIR} -c "PostgreSQL Daemon"
-		then
-			echo "Added user \"${PGUSER}\"."
-		else
-			echo "Adding user \"${PGUSER}\" failed..."
-			exit 1
-		fi
-	fi
-
-	if ! [ -x ~${PGUSER} ] ; then 
-		install -m 755 -o ${PGUSER} -g ${PGGROUP} -d ${DB_DIR}
-	fi
-	;;
-
 BACKUPWARNING)
 	backupwarning
 	;;
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-06-06 20:10:22 UTC
Responsible Changed
From-To: freebsd-ports-bugs->girgen

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2011-06-12 00:14:45 UTC
girgen      2011-06-11 23:14:30 UTC

  FreeBSD ports repository

  Modified files:
    databases            Makefile 
    databases/postgresql91-server Makefile distinfo 
                                  pkg-plist-client 
                                  pkg-plist-contrib 
                                  pkg-plist-server 
    databases/postgresql91-server/files 502.pgsql.in 
                                        pkg-install-server.in 
                                        postgresql.in 
  Added files:
    databases/postgresql91-client Makefile 
    databases/postgresql91-contrib Makefile pkg-descr 
  Log:
  Add postgresql 9.1 beta1.
  
  See http://www.postgresql.org/about/news.1313 for more info.
  
  Also, use USERS knob instead of explicitally creating the pgsql user
  while still accepting alternative names, using [1] with some added
  magic.
  
  PR:     157667 [1]
  
  Revision  Changes    Path
  1.983     +3 -0      ports/databases/Makefile
  1.1       +23 -0     ports/databases/postgresql91-client/Makefile (new)
  1.1       +32 -0     ports/databases/postgresql91-contrib/Makefile (new)
  1.1       +23 -0     ports/databases/postgresql91-contrib/pkg-descr (new)
  1.218     +44 -34    ports/databases/postgresql91-server/Makefile
  1.83      +2 -2      ports/databases/postgresql91-server/distinfo
  1.3       +11 -8     ports/databases/postgresql91-server/files/502.pgsql.in
  1.2       +1 -41     ports/databases/postgresql91-server/files/pkg-install-server.in
  1.6       +2 -2      ports/databases/postgresql91-server/files/postgresql.in
  1.22      +23 -1     ports/databases/postgresql91-server/pkg-plist-client
  1.15      +124 -77   ports/databases/postgresql91-server/pkg-plist-contrib
  1.33      +4 -2      ports/databases/postgresql91-server/pkg-plist-server
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Palle Girgensohn freebsd_committer freebsd_triage 2011-07-20 13:10:38 UTC
State Changed
From-To: open->closed

It is using USERS since beta2. Thanks for pointing it out.