Encap 2.0: Package Scripts
An Encap 2.0 package may include any of the following four package
scripts in the Package Directory:
| Script | Description
|
|---|
| preinstall | Executed before installation.
|
| postinstall | Executed after installation.
|
| preremove | Executed before removal.
|
| postremove | Executed after removal.
|
If a preprocessing script returns a non-zero exit code, the package
manager must immediately abort processing the package. A
postprocessing script will only be executed if at least one link has
been successfully created or removed, as appropriate, during the
processing of the package.
Package scripts must adhere to the following guidelines:
- A package's scripts may not modify system configuration files that
cause it to be run when the system reboots (such as
/etc/inetd.conf or any rc script) unless it has installed
all data files that it needs to start properly. This is necessary to
prevent the system from being unusable after a reboot.
- A package script which modifies or replaces pre-existing files must
always save a copy with the suffix .pre.pkgspec,
where pkgspec is the pkgspec of the package being
installed.
- A package script which installs configuration files outside of the
Encap tree must copy the files to that location, rather than create
symlinks into the Encap tree. This prevents problems which can be
arise when the Encap tree is unavailable at boot.
- A package script which installs configuration files outside of the
Encap tree must not replace pre-existing customized versions, except
where necessary to adhere to the previous guidelines. An example of a
valid exception is when a package is upgraded to a version which
changes the configuration syntax.
- A package script must react properly when it is invoked multiple
times. For example, if a postinstall script intends to add an entry to
/etc/services, it must not do so if the entry already exists.
- Package scripts may not prompt the user for input. A package
script's stdout and stdin may be redirected somewhere other than the
terminal. However, a script's stderr must always be sent to the
terminal so that the user is informed of error conditions.
Mark D. Roth <roth@uiuc.edu>