Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Aug 2011 21:01:40 -0400
From:      Sahil Tandon <sahil@FreeBSD.org>
To:        olli hauer <ohauer@gmx.de>
Cc:        ports@FreeBSD.org, ohauer@FreeBSD.org, Miroslav Lachman <000.fbsd@quip.cz>
Subject:   USERS/GROUPS in bsd.port.mk [was: FreeBSD Port: postfix-2.8.4,1]
Message-ID:  <20110802010139.GA981@magic.hamla.org>
In-Reply-To: <4E3722DE.6050206@gmx.de>
References:  <4E368625.7010805@quip.cz> <4E370ADA.9060902@FreeBSD.org> <4E371284.5010806@quip.cz> <4E371B3B.7070806@FreeBSD.org> <4E3722DE.6050206@gmx.de>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Tue, 2011-08-02 at 00:04:14 +0200, olli hauer wrote:

> No, you don't hit the limitation. It seems you really found a bug in
> the Framework!
> 
> From the Framework code in bsd.port.mk existing groups should honored.

Along those lines, what about using groupmod instead of usermod?
Perhaps due to my ignorance, it seems more straightforward and does not
require much sed-fu; I've attached a (probably incomplete) patch to
illustrate my thinking.  I understand what I am suggesting could
introduce other problems, so please do not construe it as an as-is
suggestion, but rather something to stoke discussion.

-- 
Sahil Tandon <sahil@FreeBSD.org>

[-- Attachment #2 --]
Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.690
diff -u -r1.690 bsd.port.mk
--- bsd.port.mk  21 Jul 2011 15:10:46 -0000      1.690
+++ bsd.port.mk  2 Aug 2011 00:49:22 -0000
@@ -4237,12 +4237,9 @@
                 IFS=","; for _login in $$members; do \
                         for _user in ${USERS}; do \
                                 if [ "x$${_user}" = "x$${_login}" ]; then \
-                                        list=`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'`; \
-                                        ${ECHO_MSG} "Setting \`$${_login}' groups to \`$$list$${list:+,}${_group}'."; \
-                                        ${PW} usermod $${_login} -G $$list$${list:+,}${_group}; \
-                                        ${ECHO_CMD} "@exec list=\`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'\`; \
-                                        echo \"Setting '$${_login}' groups to '$$list$${list:+,}${_group}'.\";  \
-                                        ${PW} usermod $${_login} -G $${list},${_group}" >> ${TMPPLIST}; \
+                                        ${ECHO_MSG} "Adding \`$${_login}' to \`${_group}'."; \
+                                        ${PW} groupmod ${_group} -m $${_login}; \
+                                        ${ECHO_CMD} "@exec ${PW} groupmod ${_group} -m $${_login}" >> ${TMPPLIST}; \
                                 else \
                                         ${ECHO_MSG} "==> DEBUG skip login $${_login} =>  not defined in USERS \"( ${USERS} )\""; \
                                 fi; \
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110802010139.GA981>