Search code examples
unixcentoscentos5

Where to add %pre script in anaconda-ks.cfg file?


When specifying a %pre script, does is that to be at a specific place in the kickstart file? I'm thinking it should be at the beginning so that later you can use the %include tag to include configuration created by the script file.

Or maybe it's processed before anything else automatically?


Solution

  • It doesn't matter. You can place the %include tag before your %pre script, if you like.

    According to the Red Hat 7 Installation Guide: 23.3.4. 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 Kickstart commands described in Section 23.3.2, “Kickstart Commands and Options” ...

    However, I'm not sure why it says "must be placed towards the end", as I just put a %pre script at the very top of my Kickstart file, without issues.

    Also worth noting is the following:

    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.