Subject: {USER,GROUP}ADD doesn't exists on FreeBSD!
To: None <tech-pkg@NetBSD.org>
From: Juan RP <juan@xtraeme.unixbsd.org>
List: tech-pkg
Date: 10/06/2003 17:32:22
Hi,

I have a problem when installing packages which requires
addittions of users/groups, defs.FreeBSD.mk contains that:

.if exists(/usr/sbin/user)
USERADD?=       /usr/sbin/useradd
GROUPADD?=      /usr/sbin/groupadd
.else
USERADD?=       ${LOCALBASE}/sbin/useradd
GROUPADD?=      ${LOCALBASE}/sbin/groupadd
.if defined(USE_USERADD) || defined(USE_GROUPADD)
DEPENDS+=       user>=20000313:../../sysutils/user
.endif          
.endif

Naturally, /usr/sbin/user doesn't exists, so it tries to install the user
package located in sysutils, but looking at this Makefile:

sysutils/user/Makefile:

ONLY_FOR_PLATFORM=      NetBSD-*-* # already in Solaris base system

Heh, we can't install the user package.

Instead I suggest to change the {USER,GROUP}ADD variables to use the
pw(8) utility from FreeBSD.

---- CUT HERE ----
Index: defs.FreeBSD.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.FreeBSD.mk,v
retrieving revision 1.25
diff -b -u -r1.25 defs.FreeBSD.mk
--- defs.FreeBSD.mk     2003/09/23 07:26:23     1.25
+++ defs.FreeBSD.mk     2003/10/06 15:19:58
@@ -85,11 +85,8 @@
 USERADD?=      /usr/sbin/useradd
 GROUPADD?=     /usr/sbin/groupadd
 .else
-USERADD?=      ${LOCALBASE}/sbin/useradd
-GROUPADD?=     ${LOCALBASE}/sbin/groupadd
-.if defined(USE_USERADD) || defined(USE_GROUPADD)
-DEPENDS+=      user>=20000313:../../sysutils/user
-.endif
+USERADD?=      /usr/sbin/pw useradd
+GROUPADD?=     /usr/sbin/pw groupadd
 .endif
 
 CPP_PRECOMP_FLAGS?=    # unset
cvs server: Diffing buildlink2
cvs server: Diffing buildlink3
cvs server: Diffing bulk
cvs server: Diffing gnu-config
cvs server: Diffing install
Index: install/install
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/install,v
retrieving revision 1.26
diff -b -u -r1.26 install
--- install/install     2003/09/18 23:02:33     1.26
+++ install/install     2003/10/06 15:20:03
@@ -16,6 +16,10 @@
        MAKE_DIRS="${MAKE_DIRS} \"${RCD_SCRIPTS_DIR}\""
 fi
 
+if [ "${OPSYS}" = "FreeBSD" ]; then
+       USERADD_NAME="-n"
+fi
+
 case ${STAGE} in
 PRE-INSTALL)
        msginit
@@ -101,7 +105,7 @@
                                        -g "${group}"                   \
                                        -d "${home}"                    \
                                        -s "${shell}"                   \
-                                       "${user}"
+                                       ${USERADD_NAME} "${user}"
                        fi
                done
        fi
---- END ----

Is it ok ?

-- 
Juan RP <juan AT xtraeme DOT UnixBSD DOT org>