Subject: Re: Group/user ids in packages
To: Krzysztof Raczkowski <raczkow@prz.edu.pl>
From: Johnny Lam <jlam@pkgsrc.org>
List: tech-pkg
Date: 04/05/2006 10:09:58
Krzysztof Raczkowski wrote:
> 
> I'm using pksrc on Solaris. I've got one question about how pkgsrc create
> new users and groups. It just takes first available UID and GID instead of
> using fixed numbers. So I have:
> 1-st server: uid=55001(postfix) gid=101(postfix)
> 2-nd server: uid=55002(postfix) gid=101(postfix)
> 
> I think, I could have serious problems when i would try to moce some postfix
> stuff from one server to another (e.g. during server migration).
> 
> I know, that I can configure user/group name i mk.conf for some packages,
> but I can't find a way to set UID/GID for these names.
> 
> Is there any way to build packages with fixed UID/GID ?

We don't support this generally in pkgsrc; however, you can force 
particular uids and gids to be used when creating the users and groups 
by setting PKG_USERS and PKG_GROUPS appropriately.  In your case above, 
you could modify postfix/Makefile and use the following settings:

# Force gid 101 for the "postfix" group.  We don't care about a
# specific gid for the "maildrop" group.
#
PKG_GROUPS=  postfix:101 maildrop

# Force uid 55001 for the "postfix" user.
PKG_USERS?=  postfix:postfix:55001:Postfix\ User:${POSTFIX_QUEUE_DIR}

If the users and groups already exist on the machine, then these have no 
effect, and the package will use the pre-existing uids and gids 
allocated for these users and groups on the system.

If there was a true desire by admins for this to be generally tunable, I 
suppose I would extend the pkginstall framework to allow PKG_UID.<user> 
and PKG_GID.<group> variables to easily set these values.  Do people 
really want this?

	Cheers,

	-- Johnny Lam <jlam@pkgsrc.org>