blob: cb3a9abe6db5e0102b042fd199eb9bb7413d7a61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<?xml version="1.0" encoding="UTF-8"?>
<guide self="ebuild-writing/functions/pkg_preinst/">
<chapter>
<title>pkg_preinst</title>
<body>
<table>
<tr>
<th>Function</th>
<ti><c>pkg_preinst</c></ti>
</tr>
<tr>
<th>Purpose</th>
<ti>Called before image is installed to <c>${ROOT}</c></ti>
</tr>
<tr>
<th>Sandbox</th>
<ti>Disabled</ti>
</tr>
<tr>
<th>Privilege</th>
<ti>root</ti>
</tr>
<tr>
<th>Called for</th>
<ti>ebuild, binary</ti>
</tr>
</table>
</body>
<section>
<title>Default <c>pkg_preinst</c></title>
<body>
<codesample lang="ebuild">
pkg_preinst() {
return
}
</codesample>
</body>
</section>
<section>
<title>Sample <c>pkg_preinst</c></title>
<body>
<codesample lang="ebuild">
pkg_preinst() {
enewgroup foo
enewuser foo -1 /bin/false /dev/null foo
}
</codesample>
</body>
</section>
<section>
<title>Common <c>pkg_preinst</c> tasks</title>
<body>
<p>
There are a few things that are often done in <c>pkg_preinst</c>:
</p>
<ul>
<li>
Adding users and groups. However, since <c>pkg_preinst</c> may be called
after <c>src_compile</c>, <c>pkg_setup</c> is the more suitable location for
user creation <d/> see <uri link="::ebuild-writing/users-and-groups/"/>.
</li>
<li>
Modifying the install image for a particular system. This function
allows system-specific customisation to be done even when installing
from a binary. The most useful example is probably smart
configuration file updating <d/> a <c>pkg_preinst</c> could check a
configuration file in <c>${ROOT}/etc/</c> and create a smart updated
version in <c>${D}/etc/</c> (see
<uri link="::general-concepts/install-destinations/"/>) rather than
always trying to install the default configuration file (remember
<uri link="::general-concepts/config-protect/"/>).
</li>
</ul>
</body>
</section>
</chapter>
</guide>
|