Using variables in kickstart file

Gabrie thegabeman at gmail.com
Wed Jul 18 20:38:00 UTC 2007


> Within %post, hostname is available like this:
> hostname=`grep HOSTNAME /etc/sysconfig/network |cut -d'=' -f2`
> Note that the hostname was not provided at kickstart time, it came
> from DNS.
>
> And I haven't tried it, but as Chip suggested, the ip, if you need it,
> should be available by processing /proc/cmdline, something like:
> ip=`cat /proc/cmdline |perl -e 'if (<> =~ /\sip=(.*?)\s/) {print $1}'`
>
> -Ed

Hi

thanks everyone for your replies. The cobbler tips I'm gonna try as a
last resort. I'm now using a VMware appliance from
http://www.rtfm-ed.co.uk/?cat=11 called the UDA. Its a simple pxe /
dhcp server build on a minimal Fedora Core 5. I'm using it to roll-out
VMware ESX servers. Because the webinterface on the UDA, it will be
very easy for the admins to accept my concept and realy use it. If I
had to let them edit all scripts on the command line, they won't
accept it (it is a windows company).

Therefore, I'm first gonna try to do things using the /proc/cmdline
options. Which, as I'm lookin' at ip=`cat /proc/cmdline |perl -e 'if
(<> =~ /\sip=(.*?)\s/) {print $1}'` is gonna give me quite a headache
figuring out how this works :-)

But then again, the result will great :-)


So, if I get this right.... I can use /proc/cmdline to read the
command line that kickstart has been called from and use the output in
the kickstart file (network section)?

Without using /proc/cmdline, I got this far:

network ip=10.0.0.20  (by hand)

%post
ESXIP=10.0.0.20
ESXVMOTION=10.0.2.20

lwp-download http://webserver/centralscript.sh /tmp/centralscript.sh
chmod a+x /tmp/centralscript.sh
/tmp/centralscript.sh $ESXIP $ESXVMOTION


And in centralscript.sh I can use them like $1 and $2. Which is an
improvement, but if I'm able to use /proc/cmdline I would be the hero
of my department :p


Thanks everybode for the replies !!!

Gabrie




More information about the Kickstart-list mailing list