6

I have been setting up machines with Kickstart on CentOS and I am unsure about the differences between the %pre and %post sections of the kickstart .cfg file.

The CentOS Documentation for the Pre-Installation Script states:

You can add commands to run on the system immediately after the ks.cfg has been parsed.

While the section for the Post-Installation Script states:

You have the option of adding commands to run on the system once the installation is complete. 

After also reading this question, i notice that the %pre section does not seem to have access to the file system in some way.

My question(s) are:

  • What are the differences between %pre and %post sections of a kickstart script in CentOS?
  • Is the %pre section run concurrently with the kickstart script (after parsing)?
  • Is there persistent storage available during the %pre section of the kickstart script?
  • The links to CentOS docs are broken. – user189395 Apr 29 at 15:28
11
  • What are the differences between %pre and %post sections of a kickstart script in CentOS?

The %pre section runs prior to when anaconda evaluates the rest of the kickstart file, after the second stage of the installer has started. This means that you can create files in %pre that can be included with a %include /tmp/somefile in the kickstart configuration. %post runs after package installation and bootloader setup has completed.

  • Is the %pre section run concurrently with the kickstart script (after parsing)?

The RHEL documentation says the %pre is executed after the kickstart is parsed, but can dynamically create additional content to the kickstart through %include statements. https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-kickstart2-preinstallconfig.html

  • Is there persistent storage available during the %pre section of the kickstart script?

Typically, you use a writable /tmp directory in %pre, which is not persistent to the resulting OS. It's just a ramdisk. %post runs chrooted into the new install root, or it can run in the root of anaconda (with %post --nochroot), where you can access the files you might have created/saved during %pre.

  • how do you know it runs prior to parsing. where are you seeing that information? – Nathan McCoy Mar 27 '14 at 15:31
  • What I wrote was poorly written. As the RHEL documentation says, the %pre is executed after the kickstart is parsed, but can dynamically create additional content to the kickstart through %include statements. access.redhat.com/site/documentation/en-US/… – jsbillings Mar 31 '14 at 19:21
  • if you change the answer to reflect this, I will choose your answer. – Nathan McCoy Apr 3 '14 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.