ports/164187: [PATCH] net/avahi etc should use USERS

Chris Rees crees at FreeBSD.org
Sun Jan 15 20:50:14 UTC 2012


>Number:         164187
>Category:       ports
>Synopsis:       [PATCH] net/avahi etc should use USERS
>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:   Sun Jan 15 20:50:13 UTC 2012
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:



More information about the freebsd-ports-bugs mailing list