Extracting variables from within ks.cfg, interpreted from command-line

Chris Lumens clumens at redhat.com
Wed Mar 15 00:57:54 UTC 2006


> I'm using something similar to this, to define network arguments:
> 
> network --device=eth0 \
> 	--bootproto=static \
> 	--ip=`/usr/bin/echo ${IPADDR}` \
> 	--netmask=`/usr/bin/echo ${NMADDR}` \
> 	--gateway=`/usr/bin/echo ${GWADDR}` \
> 	--nameserver=`/usr/bin/echo ${NSADDR}`
> 
> ...to no avail.  I see the literal contents (IPADDR=`/usr/bin/echo ) 
> inside my system config scripts, instead of the extracted value being 
> written to these files.  I've even gone so far as to get rid of my echo 
> statement in an attempt to get it to work, as well as just placing 
> ${VARNAME}, to get more familiar with how Anaconda extracts these values 
> trying to find my mistake.
> 
> I'm sure what I'm doing is not overly complicated - but for now, I'm 
> stuck.  If anyone has any feedback, I'd be very eager to hear back from you.

Kickstart doesn't have any provisions for reading environment variables
or capturing the output of programs like you're trying to do.  However,
you can do this stuff in a %pre script, as that just gets fed to the
shell (or whatever you set the interpreter to).  So you could write a
pre script that generates the dynamic chunks and writes it to a file,
then %include that file up in the command section.

That should work.

- Chris




More information about the Kickstart-list mailing list