| Maximum RPM: Taking the Red Hat Package Manager to the Limit | ||
|---|---|---|
| Prev | Appendix E. Concise Spec File Reference | Next |
This section lists the various scriptlets found in a spec file.
Every build scriptlet has the following environment variables defined:
RPM_SOURCE_DIR
RPM_BUILD_DIR
RPM_DOC_DIR
RPM_OPT_FLAGS
RPM_ARCH
RPM_OS
RPM_ROOT_DIR
RPM_BUILD_ROOT
RPM_PACKAGE_NAME
RPM_PACKAGE_VERSION
RPM_PACKAGE_RELEASE
For more information on these environment variables, and build scriptlets in general, please see Section 13.3.1.
The %prep scriptlet is executed first during a build, The scriptlet normally prepares the contents of a source package for building, usually by unpacking archives and applying patches. The scriptlet can contain any valid sh commands.
%prep
See also: Section 13.3.1.1.
The %build scriptlet is the second scriptlet executed during a build, immediately after %prep. The scriptlet normally builds the components to be included in a binary package, usually by configuring and compiling source code from the previously unpacked and patched archives. The scriptlet can contain any valid sh commands.
%build
See also: Section 13.3.1.2.
The %install scriptlet is the third scriptlet executed during a build, immediately after %build. The scriptlet normally installs components to be included in a binary package, usually by copying files from the build directory tree to an install directory tree. The scriptlet can contain any valid sh commands.
%install
See also: Section 13.3.1.3.
The %clean scriptlet is executed at the end of a build. The scriptlet cleans up files produced during a build, usually by removing the install directory tree. The scriptlet can contain any valid sh commands.
%clean
See also: Section 13.3.1.4.
These scriptlets are executed whenever the package is installed or erased. Each scriptlet can contain any valid sh commands.
Note: Each of the following scriptlet can be made specific to a particular subpackage by adding the subpackage name, and optionally, the -n option:
%post bar
%preun -n bar
The subpackage name and usage of the -n option must match those defined with the %package directive.
Each scriptlet has the following environment variable defined:
RPM_INSTALL_PREFIX
For more information on this environment variable please see Section 13.3.2.
The %pre scriptlet executes just before the package is to be installed.
%pre
See also: Section 13.3.2.1.
The %post scriptlet executes just after the package is to be installed.
%post
See also: Section 13.3.2.1.1.
The %preun scriptlet executes just before the package is to be erased.
%preun
See also: Section 13.3.2.2.
The %postun scriptlet executes just after the package is to be erased.
%postun
See also: Section 13.3.2.3.
This section describes the verification script.
The %verifyscript scriptlet executes whenever the package is verified using RPM's -V option. The scriptlet can contain any valid sh commands.
See also: Section 13.3.3.