Product SiteDocumentation Site

A.13. %pre (optional) - Pre-installation Script

You can add commands to run on the system immediately after the Kickstart file has been parsed, but before the installation begins. This section must be placed towards the end of the Kickstart file, after the actual Kickstart commands, and must start with %pre and end with %end. If your Kickstart file also includes a %post section, the order in which the %pre and %post sections are included does not matter.
You can access the network in the %pre section. However, the name service has not been configured at this point, so only IP addresses work, not URLs.
The pre-installation script section of Kickstart cannot manage multiple install trees or source media. This information must be included for each created Kickstart file, as the pre-installation script occurs during the second stage of the installation process.

Note

Unlike the post-installation script, the pre-installation script is not run in the chroot environment.
The following options can be used to change the behavior of pre-installation scripts. To use an option, append it to the %pre line at the beginning of the script. For example:
%pre --interpreter=/usr/bin/python
--- Python script omitted --
%end
--interpreter=
Allows you to specify a different scripting language, such as Python. Any scripting language available on the system can be used; in most cases, these will be /usr/bin/sh, /usr/bin/bash, and /usr/bin/python.
--erroronfail
Display an error and halt the installation if the script fails. The error message will direct you to where the cause of the failure is logged.
--log=
Logs the script's output into the specified log file. For example:
%pre --log=/mnt/sysimage/root/ks-pre.log
For an example of a pre-installation script, see Section A.15.2, “Example Pre-installation Script”.