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

Dan Trainor dan at id-confirm.com
Wed Mar 15 00:38:00 UTC 2006


Hello, all -

I'm trying to take a few command-line arguments during Anaconda's boot 
sequence for a new ISO which I am remastering, and I can't quite seem to 
extract them into ks.cfg itself.

I'm using something similar to this to extract the values, in %pre:

if grep -i -q "ipaddr=[a-zA-Z0-9]" /proc/cmdline
then
     IPADDR=`cat /proc/cmdline | sed 's/.*ipaddr=\([^ ]*\).*/\1/'`
else
     IPADDR=1.2.3.4
fi

I then can extract ${IPADDR} from most anywhere - except my ks.cfg.

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.

Thanks!
-dant




More information about the Kickstart-list mailing list