From crees@FreeBSD.org  Sun Jan 15 20:49:19 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 D49751065673
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 15 Jan 2012 20:49:19 +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 BF1A68FC23
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 15 Jan 2012 20:49:19 +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 q0FKnJjH029043
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 15 Jan 2012 20:49:19 GMT
	(envelope-from crees@freefall.freebsd.org)
Received: (from crees@localhost)
	by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q0FKnJpT029042;
	Sun, 15 Jan 2012 20:49:19 GMT
	(envelope-from crees)
Message-Id: <201201152049.q0FKnJpT029042@freefall.freebsd.org>
Date: Sun, 15 Jan 2012 20:49:19 GMT
From: Chris Rees <crees@FreeBSD.org>
Reply-To: Chris Rees <crees@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] net/avahi etc should use USERS
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         164187
>Category:       ports
>Synopsis:       [PATCH] net/avahi etc should use USERS
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnome
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 15 20:50:13 UTC 2012
>Closed-Date:    Sun May 20 16:47:57 UTC 2012
>Last-Modified:  Sun May 20 16:50: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:
	The avahi ports use a pkg-install script to create users and groups, which is old-fashioned :)

	Attached patch removes the pkg-install scripts (including one that is never used), adds the users to UIDs and modernises that part of the Makefile

	Let me know if you'd like patches to the MCom repo too!
>How-To-Repeat:
	
>Fix:

	

--- avahi-users.diff begins here ---
Index: UIDs
===================================================================
RCS file: /home/pcvs/ports/UIDs,v
retrieving revision 1.182
diff -u -r1.182 UIDs
--- UIDs	19 Nov 2011 07:05:21 -0000	1.182
+++ UIDs	15 Jan 2012 20:46:41 -0000
@@ -169,6 +169,7 @@
 polkit:*:562:562::0:0:PolicyKit User:/nonexistent:/usr/sbin/nologin
 pulse:*:563:563::0:0:PulseAudio System User:/nonexistent:/usr/sbin/nologin
 assp:*:587:587::0:0:ASSP Anti-Spam Proxy:/var/db/assp:/usr/sbin/nologin
+avahi-autoipd:*:588:588::0:0:Avahi Autoipd Daemon user:/nonexistent:/usr/sbin/nologin
 _xsi:*:600:600::0:0:XMLSysInfo User:/nonexistent:/usr/sbin/nologin
 _tss:*:601:601:daemon:0:0:TrouSerS user:/var/empty:/usr/sbin/nologin
 _pkcs11:*:602:602:daemon:0:0:opencryptoki user:/var/empty:/usr/sbin/nologin
Index: net/avahi-app/Makefile
===================================================================
RCS file: /home/pcvs/ports/net/avahi-app/Makefile,v
retrieving revision 1.32
diff -u -r1.32 Makefile
--- net/avahi-app/Makefile	23 Sep 2011 22:24:24 -0000	1.32
+++ net/avahi-app/Makefile	15 Jan 2012 20:46:41 -0000
@@ -23,6 +23,9 @@
 		gdbm.4:${PORTSDIR}/databases/gdbm
 RUN_DEPENDS?=	g-ir-scanner:${PORTSDIR}/devel/gobject-introspection
 
+USERS?=		${PORTNAME}
+GROUPS?=	${USERS}
+
 USE_GNOME?=	gnomehack ltverhack glib20 intltool
 USE_GETTEXT=	yes
 USE_GNOME_SUBR=	yes
@@ -168,8 +171,5 @@
 	${INSTALL_DATA} ${FILESDIR}/org.freedesktop.Avahi.service \
 		${LOCALBASE}/share/dbus-1/system-services
 .endif
-.if !defined(PACKAGE_BUILDING) && (${AVAHI_SLAVE}=="no" || ${AVAHI_SLAVE}=="autoipd")
-	@${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
-.endif
 
 .include <bsd.port.post.mk>
Index: net/avahi-app/pkg-install
===================================================================
RCS file: net/avahi-app/pkg-install
diff -N net/avahi-app/pkg-install
--- net/avahi-app/pkg-install	24 Oct 2007 23:37:22 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-case $2 in
-POST-INSTALL)
-	USER=avahi
-	GROUP=${USER}
-	UID=558
-	GID=${UID}
-	PW=/usr/sbin/pw
-
-	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."
-	else
-		if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \
-			-d "/nonexistent" -s /sbin/nologin -c "Avahi Daemon User"
-		then
-			echo "Added user \"${USER}\"."
-		else
-			echo "Adding user \"${USER}\" failed..."
-			exit 1
-		fi
-	fi
-	exit 0
-	;;
-esac
Index: net/avahi-autoipd/Makefile
===================================================================
RCS file: /home/pcvs/ports/net/avahi-autoipd/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- net/avahi-autoipd/Makefile	11 Aug 2011 19:19:46 -0000	1.6
+++ net/avahi-autoipd/Makefile	15 Jan 2012 20:46:41 -0000
@@ -15,6 +15,9 @@
 
 LIB_DEPENDS=	avahi-common.3:${PORTSDIR}/net/avahi-app
 
+USERS=		avahi-autoipd
+GROUPS=		${USERS}
+
 MASTERDIR=	${.CURDIR}/../avahi-app
 BUILD_WRKSRC=	${WRKSRC}/avahi-autoipd
 INSTALL_WRKSRC=	${BUILD_WRKSRC}
@@ -25,6 +28,5 @@
 
 MAN8=		avahi-autoipd.8
 USE_GNOME=	gnomehack ltverhack intltool
-PKGINSTALL=	${.CURDIR}/pkg-install
 
 .include "${MASTERDIR}/Makefile"
Index: net/avahi-autoipd/pkg-install
===================================================================
RCS file: net/avahi-autoipd/pkg-install
diff -N net/avahi-autoipd/pkg-install
--- net/avahi-autoipd/pkg-install	28 Dec 2011 21:01:44 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-case $2 in
-POST-INSTALL)
-	USER=avahi-autoipd
-	GROUP=${USER}
-	UID=588
-	GID=${UID}
-	PW=/usr/sbin/pw
-
-	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."
-	else
-		if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \
-			-d "/nonexistent" -s /sbin/nologin -c "Avahi Autoipd Daemon User"
-		then
-			echo "Added user \"${USER}\"."
-		else
-			echo "Adding user \"${USER}\" failed..."
-			exit 1
-		fi
-	fi
-	exit 0
-	;;
-esac
Index: net/avahi-libdns/pkg-install
===================================================================
RCS file: net/avahi-libdns/pkg-install
diff -N net/avahi-libdns/pkg-install
--- net/avahi-libdns/pkg-install	28 Dec 2011 21:01:44 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-case $2 in
-POST-INSTALL)
-	USER=avahi-autoipd
-	GROUP=${USER}
-	UID=588
-	GID=${UID}
-	PW=/usr/sbin/pw
-
-	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."
-	else
-		if ${PW} useradd ${USER} -u ${UID} -g ${GROUP} -h - \
-			-d "/nonexistent" -s /sbin/nologin -c "Avahi Daemon User"
-		then
-			echo "Added user \"${USER}\"."
-		else
-			echo "Adding user \"${USER}\" failed..."
-			exit 1
-		fi
-	fi
-	exit 0
-	;;
-esac
--- avahi-users.diff ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->gnome 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Jan 15 20:50:36 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=164187 
State-Changed-From-To: open->closed 
State-Changed-By: mezz 
State-Changed-When: Sun May 20 16:47:46 UTC 2012 
State-Changed-Why:  
Committed, thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/164187: commit references a PR
Date: Sun, 20 May 2012 16:47:52 +0000 (UTC)

 mezz        2012-05-20 16:47:38 UTC
 
   FreeBSD ports repository
 
   Modified files:
     .                    UIDs 
     net/avahi-app        Makefile 
     net/avahi-autoipd    Makefile 
   Removed files:
     net/avahi-app        pkg-install 
     net/avahi-autoipd    pkg-install 
     net/avahi-libdns     pkg-install 
   Log:
   Switch from old way to new way by using USERS.
   
   PR:             ports/164187
   Submitted by:   crees
   
   Revision  Changes    Path
   1.193     +2 -1      ports/UIDs
   1.36      +3 -3      ports/net/avahi-app/Makefile
   1.2       +0 -36     ports/net/avahi-app/pkg-install (dead)
   1.7       +3 -1      ports/net/avahi-autoipd/Makefile
   1.3       +0 -36     ports/net/avahi-autoipd/pkg-install (dead)
   1.3       +0 -36     ports/net/avahi-libdns/pkg-install (dead)
 _______________________________________________
 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:
