-   Linux - Newbie (
-   -   Kickstart Script can i create a file in %pre and %include it in the command section? (

Rogue45 07-20-2012 12:08 PM

Kickstart Script can i create a file in %pre and %include it in the command section?
I am trying to have one config file where i store all variables i will need to define throughout the kickstart such as: ip, timezone, ntp server and others. In the pre section i want to divide that config file into two different files. One for variables needed in cmd section and one for variables needed in post. I need two different because cmd is parsed by python and post is bash.

So in pre i create a file /tmp/cmdVariables.cfg

Can i %include this newly created file in my command section no?
%include /tmp/cmdVariables.cfg

I am getting a error when i try to install: Unable to open input kickstart file: Could not open/read file:///tmp/commandVariables.cfg

Rogue45 07-20-2012 02:55 PM

Apparently no one else knows kickstart:/

It really seems like my scenario should work.

in %pre i wget my config file and -o to /tmp/myconfig.cfg
parse the variables in myconf.cfg into two files respective of where the varaibles belong

Then in my command section i
%include /tmp/cmdVariables.cfg

Rogue45 07-25-2012 12:06 PM

Solved it.

I had two problems.
1) my wget command in pre i was using a lowercase -o. It must be upper case -O.
2) In the beginning of my %post section you have to copy your config file from the tmp partition in your preinstalled environment to your tmp directory of your installed image. In my case i have two post sections. The first is nochroot which is why i had to include /mnt
cp /tmp/myConfigFile.cfg /mnt/sysimage/tmp/myConfigFile.cfg

Here is an example of me splitting myConfigFile.cfg into two files. One for variables need in command and the other for variables needed in post.
You will need these commands in the pre section to actually do them and in post to write log files

sed -n /timezone*/p /tmp/myConfigFile.cfg >> /tmp/commandVariables.cfg
sed -n /ntpServer*/p /tmp/myConfigFile.cfg >> /tmp/postVariables.cfg

All times are GMT -5. The time now is 11:20 AM.