Lines 8-19
Link Here
|
8 |
If your ebuild requires a user or group to be added for a daemon, for example, |
8 |
If your ebuild requires a user or group to be added for a daemon, for example, |
9 |
this should be performed via the functions available in <c>user.eclass</c>. |
9 |
this should be performed via the functions available in <c>user.eclass</c>. |
10 |
Regardless of whether you are adding a group or a user, this should be performed |
10 |
Regardless of whether you are adding a group or a user, this should be performed |
11 |
in the <c>pkg_setup</c> function: <c>pkg_setup</c> is sandbox-safe, |
11 |
in either the <c>pkg_preinst</c> or <c>pkg_setup</c> function. |
12 |
is called before the compile process so a build that requires the user to exist will |
|
|
13 |
have it, and is also called for both binary and source packages. You may also |
14 |
use the <c>pkg_preinst</c> or <c>pkg_postinst</c> functions for user creation, if |
15 |
the user is not required during or before <c>src_install</c>. |
16 |
</p> |
12 |
</p> |
|
|
13 |
|
14 |
<p> |
15 |
<c>pkg_preinst</c> is the preferred location for a few reasons. If |
16 |
the user/group is created in <c>pkg_setup</c>, |
17 |
</p> |
18 |
|
19 |
<ul> |
20 |
<li> |
21 |
The user/group is added on the build host even if it is not |
22 |
required to build the package. |
23 |
</li> |
24 |
|
25 |
<li> |
26 |
The user/group is created when simply unpacking the sources of a |
27 |
package with <c>ebuild foo.ebuild unpack</c>. |
28 |
</li> |
29 |
|
30 |
<li> |
31 |
The user/group remain on the system if compilation or installation |
32 |
fails. |
33 |
</li> |
34 |
</ul> |
35 |
|
36 |
<p> |
37 |
However, there is a situation where the user/group <b>must</b> be |
38 |
created in <c>pkg_setup</c>: when it is needed during compilation or |
39 |
installation; that is, in <c>src_compile</c> or <c>src_install</c>. |
40 |
</p> |
41 |
|
42 |
<p> |
43 |
If the build process requires the user/group to exist, then it |
44 |
should be created in <c>pkg_setup</c> instead of |
45 |
<c>pkg_preinst</c>. Likewise, if <c>chown <user></c> or other |
46 |
similar commands are executed during the installation, then the user |
47 |
must already exist at that point, and so should be created in |
48 |
<c>pkg_setup</c>. |
49 |
</p> |
50 |
|
17 |
</body> |
51 |
</body> |
18 |
|
52 |
|
19 |
<section> |
53 |
<section> |
20 |
- |
|
|