LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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-19-2012, 03:22 PM   #1
Rogue45
Member
 
Registered: Jun 2012
Posts: 47

Rep: Reputation: Disabled
Define Variables in command section of RHEL kickstart script?


How would i declare a variable in the command section of my rhel kickstart script? I think this section is interpreted by Python? I tried myVar=variable, myVar="variable" and neither is recognized. Is this even possible?

My goal was to be able to %include a config file that would contain items such as timezone and ip address and then just say
timezone --utc myTimezone

that way an admin would just set the variables in the config file and run the kickstart.
 
Old 07-19-2012, 04:29 PM   #2
Rogue45
Member
 
Registered: Jun 2012
Posts: 47

Original Poster
Rep: Reputation: Disabled
So instead of creating a variable myTimezone, i just included timezone --utc CST in my configuration file. Then when it is included everything is there and works fine. Then they will just modify the config file timezone and it will get implemented when they run the kickstart. Not exactly the solution i wanted but it works fine.
 
Old 07-19-2012, 04:31 PM   #3
Rogue45
Member
 
Registered: Jun 2012
Posts: 47

Original Poster
Rep: Reputation: Disabled
When you wget a file in the %pre section and then %include it in the command section, its as if the text in your included file is inserted in the command section.
 
Old 07-25-2012, 12:07 PM   #4
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


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] Question about kickstart %post section theillien Linux - Newbie 6 07-25-2011 03:28 PM
kickstart - asking for configuration in the %pre section johnnymta Linux - Server 7 08-18-2009 03:22 AM
Is it possible to use variables to define Xdialog parameters in Bash script? Jude Terror Programming 2 01-22-2009 01:10 PM
problem with kickstart post section Hairman Red Hat 2 05-14-2007 01:35 PM
insmod command variables in a script fpb Linux - General 2 01-03-2006 07:29 PM


All times are GMT -5. The time now is 05:39 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration