RE: Using variables in kickstart file

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

 



oops.  word wrap.  Lets try this:


%pre (and %post if needed)

ESXIP=`awk -F "ESXIP=" '{print $2}' /proc/cmdline | cut -d " " -f 1` 

ESXVMOTION=`awk -F "ESXVMOTION=" '{print $2}' /proc/cmdline | cut -d " "
-f 1`


-----Original Message-----
From: kickstart-list-bounces@xxxxxxxxxx
[mailto:kickstart-list-bounces@xxxxxxxxxx] On Behalf Of Shabazian, Chip
Sent: Wednesday, July 18, 2007 1:55 PM
To: Discussion list about Kickstart
Subject: RE: Using variables in kickstart file

boot: yadda yadda yadda ESXIP=10.0.0.20 ESXVMOTION=10.0.2.20

%pre (and %post if needed)
ESXIP=`awk -F "ESXIP=" '{print $2}' /proc/cmdline | cut -d " " -f 1`
ESXVMOTION=`awk -F "ESXVMOTION=" '{print $2}' /proc/cmdline | cut -d " "
-f 1`

Yea, Yea, Yea, there are more elegant ways to do this, but this should
work for you

Chip

-----Original Message-----
From: kickstart-list-bounces@xxxxxxxxxx
[mailto:kickstart-list-bounces@xxxxxxxxxx] On Behalf Of Gabrie
Sent: Wednesday, July 18, 2007 1:38 PM
To: Discussion list about Kickstart
Subject: Re: Using variables in kickstart file

> 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

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list


[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