Subject: CVS commit: pkgsrc
To: None <pkgsrc-changes@NetBSD.org>
From: Johnny C. Lam <jlam@netbsd.org>
List: pkgsrc-changes
Date: 04/23/2006 00:00:44
Module Name:	pkgsrc
Committed By:	jlam
Date:		Sun Apr 23 00:00:44 UTC 2006

Modified Files:
	pkgsrc/doc/guide/files: pkginstall.xml
	pkgsrc/mk/install: bsd.pkginstall.mk usergroup usergroupfuncs
	    usergroupfuncs.DragonFly usergroupfuncs.FreeBSD
Added Files:
	pkgsrc/mk/install: usergroup-check

Log Message:
Add two new capabilities to the pkginstall framework:

(1) Allow specifying the numeric UID and GID for users and groups in
    /etc/mk.conf by setting PKG_UID.<user> and PKG_GID.<group> to
    those values.  If these values are specified, then the +USERGROUP
    script will verify that existing users and groups match the
    requested UIDs and GIDs for the package, and otherwise create them
    with these UIDs and GIDs.  For example:

	PKG_UID.courier=	10001
	PKG_GID.mail=		6

    In this example, the courier-authlib binary package will be created
    to use uid 10001 for the "courier" user and gid 6 for the "mail"
    group.

(2) Allow a package to request that users and groups be created prior
    to configuring or building a package by setting USERGROUP_PHASE
    to "configure" or "build".  Because the reason for this is typically
    to hardcode the UIDs and GIDs of requested users and groups directly
    into the package's executables, these hardcoded values will be
    automatically determined and put into the +USERGROUP script.  For
    example:

	USERGROUP_PHASE=	configure

	PKG_GROUPS=	qmail nofiles
	PKG_USERS+=	qmaill:nofiles
	PKG_USERS+=	qmailq:qmail

    In this example, the users and groups are created before the
    configure phase when building qmail, and the qmail binary package's
    +INSTALL script will try to create (or verify) users and groups
    with the same UIDs and GIDs that were used during the build.

As part of these changes, the format for PKG_USERS and PKG_GROUPS has
changed -- the optional parts of the corresponding entries are no
longer used and cannot be specified.  Instead, the following variables
should be set:

        PKG_GID.<group> is the group's numeric GID.
        PKG_UID.<user> is the user's numeric UID.
        PKG_GECOS.<user> is the user's description.
        PKG_HOME.<user> is the user's home directory.
        PKG_SHELL.<user> is the user's login shell.

A separate commit will follow which will fix all packages that set
PKG_USERS and PKG_GROUPS to use the new syntax and variables.


To generate a diff of this commit:
cvs rdiff -r1.10 -r1.11 pkgsrc/doc/guide/files/pkginstall.xml
cvs rdiff -r1.46 -r1.47 pkgsrc/mk/install/bsd.pkginstall.mk
cvs rdiff -r1.14 -r1.15 pkgsrc/mk/install/usergroup
cvs rdiff -r0 -r1.1 pkgsrc/mk/install/usergroup-check
cvs rdiff -r1.3 -r1.4 pkgsrc/mk/install/usergroupfuncs
cvs rdiff -r1.1 -r1.2 pkgsrc/mk/install/usergroupfuncs.DragonFly \
    pkgsrc/mk/install/usergroupfuncs.FreeBSD

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.