[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Using variables in kickstart file
- From: Jason Kohles <email jasonkohles com>
- To: Discussion list about Kickstart <kickstart-list redhat com>
- Subject: Re: Using variables in kickstart file
- Date: Thu, 19 Jul 2007 11:49:13 -0400
On Jul 19, 2007, at 10:07 AM, Ed Brown wrote:
Use python instead.
Or perl. You can substitute any parameter name you want from /proc/
cmdline, in place of the string 'ip' in the example given earlier:
ip=`cat /proc/cmdline |perl -e 'if (<> =~ /\sip=(.*?)\s/) {print
$1}'`
ESXIP=`cat /proc/cmdline |perl -e 'if (<> =~ /\sESXIP=(.*?)\s/)
{print $1}'`
Or you can use the -n option to perl, which makes it work quite a bit
like awk anyway (see the perlrun man page)...
ESXIP=`perl -ne '/ESXIP=(\S+)/ && print $1' /proc/cmdline`
What I usually do though, is just exploit bash to do the whole
thing. Stick this at the top of a %pre/%post script, and it will
take anything of the form var=value from /proc/cmdline and turn it
into a variable you can use directly...
set -- `cat /proc/cmdline`
for I in $*; do case "$I" in *=*) eval $I;; esac; done
You can try it from the command line to see how it works...
[root dev1-mgmt-01 ~]# cat /proc/cmdline
ro root=/dev/SystemVG/RootLV
[root dev1-mgmt-01 ~]# set -- `cat /proc/cmdline`
[root dev1-mgmt-01 ~]# for I in $*; do case "$I" in *=*) eval "$I";;
esac; done
[root dev1-mgmt-01 ~]# echo $root
/dev/SystemVG/RootLV
--
Jason Kohles
email jasonkohles com
http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]