From crees@FreeBSD.org  Sat Jan 28 11:32:39 2012
Return-Path: <crees@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1576106566B
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 28 Jan 2012 11:32:39 +0000 (UTC)
	(envelope-from crees@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id B622C8FC08
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 28 Jan 2012 11:32:39 +0000 (UTC)
Received: from freefall.freebsd.org (localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q0SBWd7K091657
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 28 Jan 2012 11:32:39 GMT
	(envelope-from crees@freefall.freebsd.org)
Received: (from crees@localhost)
	by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q0SBWdO5091656;
	Sat, 28 Jan 2012 11:32:39 GMT
	(envelope-from crees)
Message-Id: <201201281132.q0SBWdO5091656@freefall.freebsd.org>
Date: Sat, 28 Jan 2012 11:32:39 GMT
From: Chris Rees <crees@freebsd.org>
Reply-To: Chris Rees <crees@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] sysutils/bacula-server shouldn't use pkg-install to create users
X-Send-Pr-Version: 3.113
X-GNATS-Notify: dan@langille.org

>Number:         164568
>Category:       ports
>Synopsis:       [PATCH] sysutils/bacula-server shouldn't use pkg-install to create users
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    crees
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 28 11:40:06 UTC 2012
>Closed-Date:    Fri Feb 03 21:18:27 UTC 2012
>Last-Modified:  Fri Feb  3 21:20:09 UTC 2012
>Originator:     Chris Rees
>Release:        FreeBSD 8.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD freefall.freebsd.org 8.2-STABLE FreeBSD 8.2-STABLE #5 r227907: Wed Nov 23 21:55:50 UTC 2011 simon@freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL i386


	
>Description:
	bacula-server uses pkg-install scripts to create users on installation, and should use the USERS hooks in bsd.port.mk.

	It also should not set DEFAULT_PGSQL_VER.
>How-To-Repeat:
	
>Fix:

	

--- patch.txt begins here ---
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/sysutils/bacula-server/Makefile,v
retrieving revision 1.132
diff -u -r1.132 Makefile
--- Makefile	15 Jan 2012 22:35:00 -0000	1.132
+++ Makefile	28 Jan 2012 11:30:15 -0000
@@ -17,6 +17,9 @@
 
 UNIQUENAME?=	${PORTNAME}${PKGNAMESUFFIX}
 
+USERS=		bacula
+GROUPS=		${USERS}
+
 PLIST_SUB+=	MAJOR=${PORTVERSION:R:R}
 
 USE_GMAKE=	yes
@@ -161,7 +164,6 @@
 LIB_DEPENDS+=		sqlite3:${PORTSDIR}/databases/sqlite3
 DBTYPE=			sqlite3
 .else
-DEFAULT_PGSQL_VER?=	83
 USE_PGSQL=		yes
 CONFIGURE_ARGS+=	--with-postgresql=yes
 DBTYPE=			postgresql
Index: files/pkg-install.client.in
===================================================================
RCS file: /home/pcvs/ports/sysutils/bacula-server/files/pkg-install.client.in,v
retrieving revision 1.3
diff -u -r1.3 pkg-install.client.in
--- files/pkg-install.client.in	7 Sep 2010 16:21:42 -0000	1.3
+++ files/pkg-install.client.in	28 Jan 2012 11:30:15 -0000
@@ -2,14 +2,6 @@
 
 PATH=/bin:/usr/bin:/usr/sbin
 
-# Install UID/GID
-USER=%%BACULA_USER%%
-GROUP=%%BACULA_GROUP%%
-UID=%%BACULA_UID%%
-GID=%%BACULA_UID%%
-BACULA_DIR=%%BACULA_DIR%%
-
-
 # Always add lines in /etc/services
 grep -q "bacula-dir" /etc/services
 if [ "$?" != "0" ]; then
@@ -19,24 +11,3 @@
 bacula-sd       9103/tcp   #Bacula storage daemon
 # Bacule port end" >> /etc/services
 fi
-
-case $2 in
-PRE-INSTALL)
-	if [ ! -d ${BACULA_DIR} ]; then
-		mkdir -p ${BACULA_DIR}
-	fi
-
-	if pw group show "${GROUP}" 2>/dev/null; then
-		echo "You already have a group \"${GROUP}\", so I will use it."
-	else
-		if pw groupadd ${GROUP} -g ${GID}; then
-			echo "Added group \"${GROUP}\"."
-		else
-			echo "Adding group \"${GROUP}\" failed..."
-			exit 1
-		fi
-	fi
-
-	chgrp -R ${GROUP} ${BACULA_DIR}
-	;;
-esac
Index: files/pkg-install.server.in
===================================================================
RCS file: /home/pcvs/ports/sysutils/bacula-server/files/pkg-install.server.in,v
retrieving revision 1.2
diff -u -r1.2 pkg-install.server.in
--- files/pkg-install.server.in	7 Sep 2010 16:21:42 -0000	1.2
+++ files/pkg-install.server.in	28 Jan 2012 11:30:15 -0000
@@ -2,13 +2,6 @@
 
 PATH=/bin:/usr/bin:/usr/sbin
 
-# Install UID/GID
-USER=%%BACULA_USER%%
-GROUP=%%BACULA_GROUP%%
-UID=%%BACULA_UID%%
-GID=%%BACULA_UID%%
-BACULA_DIR=%%BACULA_DIR%%
-
 # Always add lines in /etc/services
 grep -q "bacula-dir" /etc/services
 if [ "$?" != "0" ]; then
@@ -18,43 +11,3 @@
 bacula-sd       9103/tcp   #Bacula storage daemon
 # Bacule port end" >> /etc/services
 fi
-
-case $2 in
-PRE-INSTALL)
-	if [ ! -d ${BACULA_DIR} ]; then
-		mkdir -p ${BACULA_DIR}
-	fi
-
-	if pw group show "${GROUP}" 2>/dev/null; then
-		echo "You already have a group \"${GROUP}\", so I will use it."
-	else
-		if pw groupadd ${GROUP} -g ${GID}; then
-			echo "Added group \"${GROUP}\"."
-		else
-			echo "Adding group \"${GROUP}\" failed..."
-			exit 1
-		fi
-	fi
-
-	if pw user show "${USER}" 2>/dev/null; then
-		echo "You already have a user \"${USER}\", so I will use it."
-		if pw usermod ${USER} -d ${BACULA_DIR} -G operator
-		then
-			echo "Changed home directory of \"${USER}\" to \"${BACULA_DIR}\""
-		else
-			echo "Changing home directory of \"${USER}\" to \"${BACULA_DIR}\" failed..."
-			exit 1
-		fi
-	else
-		if pw useradd ${USER} -u ${UID} -g ${GROUP} -G operator -h - \
-			-d ${BACULA_DIR} -s /sbin/nologin -c "Bacula Daemon"
-		then
-			echo "Added user \"${USER}\"."
-		else
-			echo "Adding user \"${USER}\" failed..."
-			exit 1
-		fi
-	fi
-	chown -R ${USER}:${GROUP} ${BACULA_DIR}
-	;;
-esac
--- patch.txt ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->crees 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sat Jan 28 11:40:17 UTC 2012 
Responsible-Changed-Why:  
crees@ wants his PRs (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=164568 
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Sat Jan 28 11:40:21 UTC 2012 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=164568 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: dan@langille.org
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/164568: [PATCH] sysutils/bacula-server shouldn't use pkg-install to create users
Date: Sat, 28 Jan 2012 11:40:19 UT

 Maintainer of sysutils/bacula-server,
 
 Please note that PR ports/164568 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/164568
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: "Dan Langille" <dan@langille.org>
To: bug-followup@FreeBSD.org
Cc: "Chris Rees" <crees@freebsd.org>
Subject: Re: ports/164568: [PATCH] sysutils/bacula-server shouldn't use pkg-install to create users
Date: Wed, 1 Feb 2012 16:19:37 -0500

 Approved by maintainer.  Sorry for the delay.
 
 -- 
 Dan Langille -- http://langille.org/
 

From: "Dan Langille" <dan@langille.org>
To: bug-followup@FreeBSD.org
Cc: "Chris Rees" <crees@freebsd.org>
Subject: Re: ports/164568: [PATCH] sysutils/bacula-server shouldn't use pkg-install to create users
Date: Wed, 1 Feb 2012 16:19:50 -0500

 Approved by maintainer.  Sorry for the delay.
 
 -- 
 Dan Langille -- http://langille.org/
 
State-Changed-From-To: feedback->closed 
State-Changed-By: crees 
State-Changed-When: Fri Feb 3 21:18:26 UTC 2012 
State-Changed-Why:  
Committed.  Thanks for the prompt approval :) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=164568 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/164568: commit references a PR
Date: Fri,  3 Feb 2012 21:18:31 +0000 (UTC)

 crees       2012-02-03 21:18:14 UTC
 
   FreeBSD ports repository
 
   Modified files:
     sysutils/bacula-server Makefile 
     sysutils/bacula-server/files pkg-install.client.in 
                                  pkg-install.server.in 
   Log:
   - Use USERS and GROUPS
   
   - Stop setting DEFAULT_PGSQL_VER
   
   PR:             ports/164568
   Submitted by:   crees (me)
   Approved by:    maintainer
   
   Revision  Changes    Path
   1.133     +3 -1      ports/sysutils/bacula-server/Makefile
   1.4       +0 -29     ports/sysutils/bacula-server/files/pkg-install.client.in
   1.3       +0 -47     ports/sysutils/bacula-server/files/pkg-install.server.in
 _______________________________________________
 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"
 
>Unformatted:
