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

Ed Brown ebrown at lanl.gov
Thu Mar 16 01:16:00 UTC 2006


On Tue, 2006-03-14 at 17:38 -0700, Dan Trainor wrote:

> 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}`
> 

Quite possibly I don't understand what you are trying to do, but if you
are providing static ip network info at the anaconda 'boot:' prompt, why
would you need to write this information into the kickstart file on the
network line?

You can provide these parameters like:

boot:  linux ks=... method=... ip=... gateway=... dns=... netmask=...

and have this in your ks.cfg:

network --device=eth0 --bootproto=static

and there is no need to edit ks.cfg.


Or, if you are creating a custom syslinux.cfg, your stanzas could list
all the parameters except perhaps the ip, or ip and gateway:

syslinux.cfg:
------------
...
label mylabel
  kernel vmlinuz
  append initrd=initrd.img dns=our.dns.server netmask=255.255.255.0
ks=URL_of_ks.cfg method=URL_of_distro

at anaconda 'boot:' prompt:
boot: mylabel ip=... gateway=...

Again, no need to edit ks.cfg

hope this helps,
Ed






More information about the Kickstart-list mailing list