I can get the kickstart command line with /proc/cmdline
it looks something like xxxxx ks=http://192.168.1.8/ks/ks.cfg xxxxxx in the %pre sections of my ks.cfg I was wanting to extract the IP from the ks= part. I was going to utilize the "tr" command but its not available in %pre.
how can I go about extracting the IP address from with in the %pre section
I was going to do something like: cat /proc/cmdline | tr ' ' '\n' | grep ks=http | tr '/' ' ' | awk {' print $2'}
Since tr isnt available how else can I do it?
Thanks,
Jerry
how can I go about extracting the IP address from with in the %pre section
I was going to do something like: cat /proc/cmdline | tr ' ' '\n' | grep ks=http | tr '/' ' ' | awk {' print $2'}
Since tr isnt available how else can I do it?
Jerry, You ever solve this? You can do this all with awk alone.
On Sun, 14 Aug 2011, Joseph L. Casale wrote:
To: 'CentOS mailing list' centos@centos.org From: Joseph L. Casale jcasale@activenetwerx.com Subject: Re: [CentOS] grabbing ip address from kickstart pre
how can I go about extracting the IP address from with in the %pre section
I was going to do something like: cat /proc/cmdline | tr ' ' '\n' | grep ks=http | tr '/' ' ' | awk {' print $2'}
Since tr isnt available how else can I do it?
Jerry, You ever solve this? You can do this all with awk alone.
The thing is if it's in the %pre section, AWK would not have been installed yet?
Kind Regards,
Keith Roberts
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
On Sun, 14 Aug 2011, Joseph L. Casale wrote:
To: 'CentOS mailing list' centos@centos.org From: Joseph L. Casale jcasale@activenetwerx.com Subject: Re: [CentOS] grabbing ip address from kickstart pre
The thing is if it's in the %pre section, AWK would not have been installed yet?
I wouldn't have suggested it if it would not have worked. Awk *is* available in %pre. As the op noted, tr is not available but several tools like awk,gawk,grep,fgrep,egrep,wget etc are.
That's interesting Joe. So where are these tools being gotten from if the RPM packages are not installed yet?
Is there some way to find out exactly what tools are available for use in the %pre section please?
Kind Regards,
Keith Roberts
----------------------------------------------------------------- Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk
All email addresses are challenge-response protected with TMDA [http://tmda.net] -----------------------------------------------------------------
On Mon, 15 Aug 2011, Keith Roberts wrote:
That's interesting Joe. So where are these tools being gotten from if the RPM packages are not installed yet?
It's part of the installer.
Is there some way to find out exactly what tools are available for use in the %pre section please?
It's part of the pre-installation environment. Boot off the install CD, wait until you can get to the F2 shell, and peek around at what you've got.
jh
On Mon, 15 Aug 2011, John Hodrien wrote:
To: CentOS mailing list centos@centos.org From: John Hodrien J.H.Hodrien@leeds.ac.uk Subject: Re: [CentOS] grabbing ip address from kickstart pre
On Mon, 15 Aug 2011, Keith Roberts wrote:
That's interesting Joe. So where are these tools being gotten from if the RPM packages are not installed yet?
It's part of the installer.
Is there some way to find out exactly what tools are available for use in the %pre section please?
It's part of the pre-installation environment. Boot off the install CD, wait until you can get to the F2 shell, and peek around at what you've got.
Hi Joe. Thanks for that helpfull information. I will do just that one day - it's a very handy thing to know about!
Kind Regards,
Keith Roberts
----------------------------------------------------------------- Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk
All email addresses are challenge-response protected with TMDA [http://tmda.net] -----------------------------------------------------------------
On 2011-08-15 09:06, Keith Roberts wrote:
Is there some way to find out exactly what tools are available for use in the %pre section please?
http://linuxtopia.org/online_books/rhel6/rhel_6_installation/rhel_6_installa...
/THomas
On Mon, 15 Aug 2011, Thomas Johansson wrote:
To: CentOS mailing list centos@centos.org From: Thomas Johansson thomasj@isy.liu.se Subject: Re: [CentOS] grabbing ip address from kickstart pre
On 2011-08-15 09:06, Keith Roberts wrote:
Is there some way to find out exactly what tools are available for use in the %pre section please?
http://linuxtopia.org/online_books/rhel6/rhel_6_installation/rhel_6_installa...
OK thanks for that Thomas.
I've saved this email for later reference.
Keith
----------------------------------------------------------------- Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk
All email addresses are challenge-response protected with TMDA [http://tmda.net] -----------------------------------------------------------------
On 2011-08-13 04:26, Jerry Geis wrote:
I can get the kickstart command line with /proc/cmdline
it looks something like xxxxx ks=http://192.168.1.8/ks/ks.cfg xxxxxx in the %pre sections of my ks.cfg I was wanting to extract the IP from the ks= part. I was going to utilize the "tr" command but its not available in %pre.
how can I go about extracting the IP address from with in the %pre section
I was going to do something like: cat /proc/cmdline | tr ' ' '\n' | grep ks=http | tr '/' ' ' | awk {' print $2'}
Since tr isnt available how else can I do it?
This one should work in sh environment
KS_IPADDR=`< /proc/cmdline sed 's/ /\n/g' | grep "ks=http" | cut -d/ -f3`
/Thomas
Since tr isnt available how else can I do it?
Check out page 21 of this pdf: http://www.redhat.com/promo/summit/2010/presentations/summit/decoding-the-co...
Interesting, while the awk solution is more appropriate for your need, this can make it easier and allow for other options:
echo $ks |cut -d'/' -f3 after running the above...
On Sun, 14 Aug 2011, Joseph L. Casale wrote:
To: 'CentOS mailing list' centos@centos.org From: Joseph L. Casale jcasale@activenetwerx.com Subject: Re: [CentOS] grabbing ip address from kickstart pre
Since tr isnt available how else can I do it?
Check out page 21 of this pdf: http://www.redhat.com/promo/summit/2010/presentations/summit/decoding-the-co...
Nice tutorial Joe. I've downloaded that for later.
Kind Regards,
Keith Roberts
----------------------------------------------------------------- Websites: http://www.karsites.net http://www.php-debuggers.net http://www.raised-from-the-dead.org.uk
All email addresses are challenge-response protected with TMDA [http://tmda.net] -----------------------------------------------------------------