@@ -, +, @@ and Groups". --- ebuild-writing/users-and-groups/text.xml | 44 ++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) --- a/ebuild-writing/users-and-groups/text.xml +++ a/ebuild-writing/users-and-groups/text.xml @@ -8,12 +8,46 @@ If your ebuild requires a user or group to be added for a daemon, for example, this should be performed via the functions available in user.eclass. Regardless of whether you are adding a group or a user, this should be performed -in the pkg_setup function: pkg_setup is sandbox-safe, -is called before the compile process so a build that requires the user to exist will -have it, and is also called for both binary and source packages. You may also -use the pkg_preinst or pkg_postinst functions for user creation, if -the user is not required during or before src_install. +in either the pkg_preinst or pkg_setup function.

+ +

+ pkg_preinst is the preferred location for a few reasons. If + the user/group is created in pkg_setup, +

+ + + +

+ However, there is a situation where the user/group must be + created in pkg_setup: when it is needed during compilation or + installation; that is, in src_compile or src_install. +

+ +

+ If the build process requires the user/group to exist, then it + should be created in pkg_setup instead of + pkg_preinst. Likewise, if chown <user> or other + similar commands are executed during the installation, then the user + must already exist at that point, and so should be created in + pkg_setup. +

+
--