USERS/GROUPS in bsd.port.mk [was: FreeBSD Port: postfix-2.8.4,1]

Sahil Tandon sahil at FreeBSD.org
Tue Aug 2 01:01:45 UTC 2011


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 at FreeBSD.org>
-------------- next part --------------
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; \


More information about the freebsd-ports mailing list