LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Kickstart Script reading configuration from a file (https://www.linuxquestions.org/questions/linux-enterprise-47/kickstart-script-reading-configuration-from-a-file-4175417646/)

Rogue45 07-19-2012 01:08 PM

Kickstart Script reading configuration from a file
 
I am creating a Kickstart script that will be used to deploy a system. My goal is to get input from a config file on my install server for the static ip settings, timezone, and possibly a couple others. I know how to get variables from users in the %pre section or from my cmd line arguments, but i am having trouble finding any tutorial on how to use variables from a file retrieved in %pre in the command section.

Here is what i have now:

In the command section
%include /tmp/file_to_include
In %PRE
wget http://server/info_to_include -O /tmp/file_to_include

I think i have the file available in my command section now, but i'm not sure how to parse it in order to use its contents?

Only helpful link i've found is pg 19 of: http://www.redhat.com/promo/summit/2010/presentations/summit/decoding-the-code/wed/cshabazi-530-more/MORE-Kickstart-Tips-and-Tricks.pdf[/URL]

Rogue45 07-25-2012 12:07 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 12:07 AM.