Subject: mk/install/usergroup and FreeBSD and DragonFly
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 09/07/2005 05:15:10
mk/install/usergroup does:

                     elif ${TEST} -n "${USERADD}" -a -x "${USERADD}"; then
                             ${ECHO} "Creating user: $user";
                             case $userid in
                             "")     ${USERADD} -c "$descr" -d "$home" \
                                             -s "$shell" -g $group $user
                                     ;;
                             *)      ${USERADD} -c "$descr" -d "$home" \
                                             -s "$shell" -g $group \
                                             -u $userid $user

The syntax for adding a user on FreeBSD and DragonFly is:

pw user add cyrus -c "cyrus-sasl cyrus user" -d /nonexistent -s /bin/sh -g mail

Notice how the username becomes before the options.

Any ideas on how we can make this mk/install/usergroup more portable. This 
is needed as DragonFly uses pkgsrc. (They are considering our nice 
user(8) but that is another discussion.)

Ideas:

- force DragonFly to install sysutils/user

- new sysutils/user_dragonfly package providing wrapper scripts (similar
   to user_interix and user_darwin)

- accept command with arguments (like "pw user add") as USERADD (and
   GROUPADD) -- so don't do test -x ${USERADD}

- add new variables like USERADD_ARGUMENTS and GROUPADD_ARGUMENTS; for
   example:
   USERADD="/usr/sbin/pw"
   USERADD_ARGUMENTS="user add"

- provide code snippets to use like mk/platform/DragonFly.usergroup if
   available, so the ordering of username will be done before other
   options.

- get DragonFly and FreeBSD to fix their pw to accept the username at end
   of arguments too.



  Jeremy C. Reed

  	  	 	 BSD News, BSD tutorials, BSD links
 	  	 	 http://www.bsdnewsletter.com/