Re: Using variables in kickstart file

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

 



Gabrie wrote:
On 7/18/07, Shabazian, Chip <Chip.Shabazian@xxxxxxxxxxxxxxxxx> wrote:
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


Ok, thanks.
But only in %pre and %post ????

So this will NOT work?

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

# Network Configurations
network --device eth0 --bootproto static --ip $ESXIP --netmask 255.255.255.0


Or in other words.... is the network-line part of the %pre section????

Gabrie

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

%pre and %post are essentially bash shell scripts, independent of the other lines

Here's a clever snippet (also originated from Chip) that illustrates how to build part of your kickstart, on the fly, using %pre and %include...

# lots of stuff here...
# ...
# ....
%include /tmp/partinfo

%pre
# Determine how many drives we have
set \$(list-harddrives)
let numd=\$#/2
d1=\$1
d2=\$3

cat << EOF >> /tmp/partinfo
part / --fstype ext3 --size=1024 --grow --ondisk=\$d1 --asprimary
part swap --size=1024 --ondisk=\$d1 --asprimary
#EOF

In the above example, the pre script runs first, and generates a file in /tmp. That file is then inserted into the kickstart, containing instructions for drive setup. The same thing can be done in your case.


[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