From 8ddf48b989b66488d7bf8ef7ab1ae39ebfe621bb Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 22 Nov 2014 08:44:06 -0500 Subject: [PATCH 2/2] Bug #525828: Update pkg_preinst/pkg_setup text in "Users and Groups". The original text on the "Users and Groups" page strongly suggested pkg_setup() as opposed to pkg_preinst() for user/group creation. As mentioned on bug #217042, this is not really the case: we prefer pkg_preinst() unless the new user/group is needed to build or install the package. The new text reflects this. --- ebuild-writing/users-and-groups/text.xml | 44 ++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/ebuild-writing/users-and-groups/text.xml b/ebuild-writing/users-and-groups/text.xml index 5030318..f8e453d 100644 --- a/ebuild-writing/users-and-groups/text.xml +++ b/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. +

+
-- 2.0.4