LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-20-2012, 01:08 PM   #1
Rogue45
Member
 
Registered: Jun 2012
Posts: 47

Rep: Reputation: Disabled
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

Last edited by Rogue45; 07-20-2012 at 02:09 PM.
 
Old 07-20-2012, 03:55 PM   #2
Rogue45
Member
 
Registered: Jun 2012
Posts: 47

Original Poster
Rep: Reputation: Disabled
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
cmdVariables.cfg
postVariables.cfg

Then in my command section i
%include /tmp/cmdVariables.cfg
 
Old 07-25-2012, 01:06 PM   #3
Rogue45
Member
 
Registered: Jun 2012
Posts: 47

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply

Tags
command, kickstart, post, script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Define Variables in command section of RHEL kickstart script? Rogue45 Linux - Newbie 3 07-25-2012 01:07 PM
a problem with a simple scripts in my %pre section of Centos kickstart vmware the student Linux - Virtualization and Cloud 1 04-27-2010 09:49 PM
kickstart - asking for configuration in the %pre section johnnymta Linux - Server 7 08-18-2009 04:22 AM
Using parted in the pre section of my kickstart install davidr Linux - Software 0 12-09-2004 07:53 PM
%include directive in Kickstart configuration file deepika Linux - Newbie 0 07-24-2003 06:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration