Gentoo Development Guide
pkg_preinst
| Function | pkg_preinst |
| Purpose | Called before image is installed to ${ROOT} |
| Sandbox | Disabled |
| Privilege | root |
| Called for | ebuild, binary |
Default pkg_preinst
pkg_preinst()
{
return
}
Sample pkg_preinst
pkg_preinst() {
enewgroup foo
enewuser foo -1 /bin/false /dev/null foo
}
Common pkg_preinst Tasks
There are a few things that are often done in pkg_preinst:
- Adding users and groups — see Users and Groups.
-
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
—
a
pkg_preinstcould check a configuration file in${ROOT}/etc/and create a smart updated version in${D}/etc/(see Install Destinations) rather than always trying to install the default configuration file (remember Configuration File Protection).