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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ed Brown wrote:
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





Hello, Ed -

What I'm wanting to do is to let the user supply boot:-time arguments for a few settings, but if they do not specify these settings, use a default.

I think that Chip had responded earlier with a solution, which I have yet to try. Regardless, I'll report back.

Thanks!

--
- Dan Trainor
- id-Confirm, Inc.
- Direct:  720.241.5580


[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux