Bug 157606 - Fix port: mail/dovecot2 should use USERS
Summary: Fix port: mail/dovecot2 should use USERS
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Chris Rees
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-04 13:00 UTC by Chris Rees
Modified: 2011-07-05 17:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Rees 2011-06-04 13:00:29 UTC
	

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

Fix: - Use USERS and GROUPS
	- Use @stopdaemon

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

	Please bear in mind that files/pkg-install.in has been removed.




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

Index: Makefile
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/mail/dovecot2/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile	13 May 2011 17:02:12 -0000	1.4
+++ Makefile	4 Jun 2011 08:52:03 -0000
@@ -51,10 +51,8 @@
 PORTEXAMPLES=	*
 .endif
 
-DOVECOT_UID?=	143
-DOVECOT_GID?=	143
-DOVENULL_UID?=	144
-DOVENULL_GID?=	144
+USERS=		${PORTNAME} dovenull
+GROUPS=		${USERS}
 
 PROTOCOLS=	imap pop3
 
@@ -159,8 +157,8 @@
 PLIST_SUB+=	SQL="@comment "
 .endif
 
-SUB_LIST=	REQUIRE="${_REQUIRE}" DOVECOT_UID=${DOVECOT_UID} DOVECOT_GID=${DOVECOT_GID} DOVENULL_UID=${DOVENULL_UID} DOVENULL_GID=${DOVENULL_GID}
-SUB_FILES=	pkg-install pkg-deinstall pkg-message
+SUB_LIST=	REQUIRE="${_REQUIRE}"
+SUB_FILES=	pkg-deinstall pkg-message
 
 MAN1=		deliver.1 \
 		doveadm-altmove.1 \
@@ -205,9 +203,6 @@
 		' ${WRKSRC}/src/auth/mech-gssapi.c ${WRKSRC}/configure
 .endif
 
-pre-su-install:
-	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-
 post-install:
 .if !defined(NOPORTEXAMPLES)
 	@${MKDIR} ${EXAMPLESDIR}
@@ -216,7 +211,6 @@
 .if !defined(NOPORTDOCS)
 	cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${DOCSDIR}
 .endif
-	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>
Index: pkg-plist
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/mail/dovecot2/pkg-plist,v
retrieving revision 1.6
diff -u -r1.6 pkg-plist
--- pkg-plist	13 May 2011 17:02:12 -0000	1.6
+++ pkg-plist	4 Jun 2011 08:52:32 -0000
@@ -1,3 +1,4 @@
+@stopdaemon dovecot
 bin/doveadm
 bin/doveconf
 bin/dsync
Index: files/pkg-deinstall.in
===================================================================
RCS file: /exports/cvsroot-freebsd/ports/mail/dovecot2/files/pkg-deinstall.in,v
retrieving revision 1.1
diff -u -r1.1 pkg-deinstall.in
--- files/pkg-deinstall.in	27 Nov 2010 05:53:35 -0000	1.1
+++ files/pkg-deinstall.in	4 Jun 2011 08:52:03 -0000
@@ -3,63 +3,8 @@
 #	$FreeBSD: ports/mail/dovecot2/files/pkg-deinstall.in,v 1.1 2010/11/27 05:53:35 glewis Exp $
 #
 
-PKG_PREFIX=${PKG_PREFIX:=/usr/local}
-
-ask() {
-	local question default answer
-
-	question=$1
-	default=$2
-	if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
-		read -p "${question} [${default}]? " answer
-	fi
-	echo ${answer:-${default}}
-}
-
-yesno() {
-	local question default answer
-
-	question=$1
-	default=$2
-	while :; do
-		answer=$(ask "${question}" "${default}")
-		case "${answer}" in
-		[Yy]*)	return 0;;
-		[Nn]*)	return 1;;
-		esac
-		echo "Please answer yes or no."
-	done
-}
-
-delete_account() {
-	local port user uid group gid
-
-	port=$1
-	user=${2%:*}
-	uid=${2#*:}
-	group=${3%:*}
-	gid=${3#*:}
-
-	echo "If you do not intend to reinstall ${port}, you should manually"
-	echo "remove user '${user}' (uid='${uid}') and group '${group}' (gid='${gid}')."
-}
-
 case $2 in
-
 DEINSTALL)
-	if ps -axc | grep -qw dovecot; then
-		if yesno "Dovecot is still running. Shall I stop it?" y; then
-			${PKG_PREFIX}/etc/rc.d/dovecot stop
-			sleep 2
-		else
-			echo "OK ... I hope you know what you are doing."
-		fi
-	fi
-
-	delete_account Dovecot dovecot:${DOVECOT_UID:-%%DOVECOT_UID%%} dovecot:${DOVECOT_GID:-%%DOVECOT_GID%%}
-	delete_account Dovecot dovenull:${DOVENULL_UID:-%%DOVENULL_UID%%} dovenull:${DOVENULL_GID:-%%DOVENULL_GID%%}
-
-	echo "Also manually 'rm -rf /var/db/dovecot' if anything was stored there."
+	echo "If you don't intend on reinstalling this port you should manually 'rm -rf /var/db/dovecot' if anything was stored there."
 	;;
-
 esac
Index: files/pkg-install.in
===================================================================
RCS file: files/pkg-install.in
diff -N files/pkg-install.in
--- files/pkg-install.in	27 Nov 2010 05:53:35 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,93 +0,0 @@
-#!/bin/sh
-#
-#	$FreeBSD: ports/mail/dovecot2/files/pkg-install.in,v 1.1 2010/11/27 05:53:35 glewis Exp $
-#
-
-PKG_PREFIX=${PKG_PREFIX:=/usr/local}
-
-ask() {
-	local question default answer
-
-	question=$1
-	default=$2
-	if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
-		read -p "${question} [${default}]? " answer
-	fi
-	echo ${answer:-${default}}
-}
-
-yesno() {
-	local question default answer
-
-	question=$1
-	default=$2
-	while :; do
-		answer=$(ask "${question}" "${default}")
-		case "${answer}" in
-		[Yy]*)	return 0;;
-		[Nn]*)	return 1;;
-		esac
-		echo "Please answer yes or no."
-	done
-}
-
-create_account() {
-	local port user uid group gid gcos home shell
-
-	port=$1
-	user=${2%:*}
-	uid=${2#*:}
-	group=${3%:*}
-	gid=${3#*:}
-	gcos=$4
-	home=$5
-	shell=$6
-
-	pw_user_uid=$(pw usershow -n "${user}" 2>/dev/null | cut -d: -f3)
-	pw_uid_user=$(pw usershow -u "${uid}" 2>/dev/null | cut -d: -f1)
-	pw_group_gid=$(pw groupshow -n "${group}" 2>/dev/null | cut -d: -f3)
-	pw_gid_group=$(pw groupshow -g "${gid}" 2>/dev/null | cut -d: -f1)
-
-	if [ -z "${pw_group_gid}" -a -z "${pw_gid_group}" ]; then
-		echo "You need a ${group} group; creating it..."
-		pw groupadd "${group}" -g "${gid}" || exit
-		echo "Done."
-	elif [ "${gid}" = "${pw_group_gid}" -a "${group}" = "${pw_gid_group}" ]; then
-		echo "Using existing ${group} group."
-	else
-		echo "${port} has reserved the groupname '${group}' and gid '${gid}':"
-		[ -n "${pw_group_gid}" -a "${gid}"   != "${pw_group_gid}" ] \
-			&& echo "ERROR: groupname '${group}' already in use by gid '${pw_group_gid}'"
-		[ -n "${pw_gid_group}" -a "${group}" != "${pw_gid_group}" ] \
-			&& echo "ERROR: gid '${gid}' already in use by group '${pw_gid_group}'"
-		echo "Please resolve these issues and try again:"
-		echo "Either remove the conflicting group or if you wish to continue using a legacy group override DOVECOT_GID."
-		exit 1
-	fi
-
-	if [ -z "${pw_user_uid}" -a -z "${pw_uid_user}" ]; then
-		echo "You need a ${user} user; creating it..."
-		pw useradd "${user}" -u "${uid}" -g "${group}" -c "${gcos}" -d "${home}" -s "${shell}"
-		echo "Done."
-	elif [ "${uid}" = "${pw_user_uid}" -a "${user}" = "${pw_uid_user}" ]; then
-		echo "Using existing ${user} user."
-	else
-		echo "${port} has reserved the username '${user}' and uid '${uid}':"
-		[ -n "${pw_user_uid}" -a "${uid}"  != "${pw_user_uid}" ] \
-			&& echo "ERROR: username '${user}' already in use by uid '${pw_user_uid}'"
-		[ -n "${pw_uid_user}" -a "${user}" != "${pw_uid_user}" ] \
-			&& echo "ERROR: uid '${uid}' already in use by user '${pw_uid_user}'"
-		echo "Please resolve these issues and try again:"
-		echo "Either remove the conflicting user or if you wish to continue using a legacy user override DOVECOT_UID."
-		exit 1
-	fi
-}
-
-case $2 in
-
-PRE-INSTALL)
-	create_account Dovecot dovecot:${DOVECOT_UID:-%%DOVECOT_UID%%} dovecot:${DOVECOT_GID:-%%DOVECOT_GID%%} "Dovecot User" /var/empty /usr/sbin/nologin
-	create_account Dovecot dovenull:${DOVENULL_UID:-%%DOVENULL_UID%%} dovenull:${DOVENULL_GID:-%%DOVENULL_GID%%} "Dovecot login User" /var/empty /usr/sbin/nologin
-	;;
-
-esac
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-06-04 13:00:50 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pgollucci

pgollucci@ wants his PRs (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2011-06-04 13:00:55 UTC
Maintainer of mail/dovecot2,

Please note that PR ports/157606 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/157606

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2011-06-04 13:00:59 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 4 nagy.attila 2011-06-07 07:43:02 UTC
Fine with me.

On 06/04/11 14:00, Edwin Groothuis wrote:
> Maintainer of mail/dovecot2,
>
> Please note that PR ports/157606 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/157606
>
Comment 5 Chris Rees freebsd_committer freebsd_triage 2011-06-22 17:54:22 UTC
Responsible Changed
From-To: pgollucci->crees

Invalid autoassignment
Comment 6 Chris Rees freebsd_committer freebsd_triage 2011-06-22 18:02:30 UTC
Responsible Changed
From-To: crees->freebsd-ports-bugs

To pool to correct assign message
Comment 7 Chris Rees freebsd_committer freebsd_triage 2011-06-22 18:24:54 UTC
Responsible Changed
From-To: freebsd-ports-bugs->crees

Invalid autoassignment to pgollucci
Comment 8 Chris Rees freebsd_committer freebsd_triage 2011-06-25 21:35:33 UTC
State Changed
From-To: feedback->open

Maintainer has approved.
Comment 9 dfilter service freebsd_committer freebsd_triage 2011-07-05 17:35:11 UTC
crees       2011-07-05 16:35:02 UTC

  FreeBSD ports repository

  Modified files:
    mail/dovecot2        Makefile pkg-plist 
    mail/dovecot2/files  pkg-deinstall.in 
  Removed files:
    mail/dovecot2/files  pkg-install.in 
  Log:
  - Use USERS and GROUPS
  - Use @stopdaemon
  
  PR:             ports/157606
  Approved by:    rene (mentor, implicit), Attila Nagy <bra@fsn.hu> (maintainer)
  
  Revision  Changes    Path
  1.5       +4 -10     ports/mail/dovecot2/Makefile
  1.2       +2 -57     ports/mail/dovecot2/files/pkg-deinstall.in
  1.2       +0 -93     ports/mail/dovecot2/files/pkg-install.in (dead)
  1.7       +1 -0      ports/mail/dovecot2/pkg-plist
_______________________________________________
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 10 Chris Rees freebsd_committer freebsd_triage 2011-07-05 17:35:28 UTC
State Changed
From-To: open->closed

Committed. Thanks!