FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 08-13-2011, 02:26 AM
Jerry Geis
 
Default grabbing ip address from kickstart pre

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 ' ' '
' | grep ks=http | tr '/' ' ' | awk {'
print $2'}

Since tr isnt available how else can I do it?

Thanks,

Jerry

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-14-2011, 07:36 PM
"Joseph L. Casale"
 
Default 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 ' ' '
' | 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.

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-14-2011, 08:06 PM
Keith Roberts
 
Default grabbing ip address from kickstart pre

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 ' ' '
' | 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
>

--
-----------------------------------------------------------------
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]
-----------------------------------------------------------------
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-14-2011, 08:48 PM
Thomas Johansson
 
Default grabbing ip address from kickstart pre

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 ' ' '
' | 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/ /
/g' | grep "ks=http" | cut -d/ -f3`


/Thomas
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-14-2011, 09:13 PM
"Joseph L. Casale"
 
Default 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.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-14-2011, 09:24 PM
"Joseph L. Casale"
 
Default 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-code/wed/cshabazi-530-more/MORE-Kickstart-Tips-and-Tricks.pdf

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...
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-15-2011, 07:06 AM
Keith Roberts
 
Default grabbing ip address from kickstart pre

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]
-----------------------------------------------------------------
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-15-2011, 07:19 AM
Keith Roberts
 
Default grabbing ip address from kickstart pre

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-code/wed/cshabazi-530-more/MORE-Kickstart-Tips-and-Tricks.pdf

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]
-----------------------------------------------------------------
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-15-2011, 08:26 AM
John Hodrien
 
Default 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.

jh
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-15-2011, 10:12 AM
Thomas Johansson
 
Default 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_installation_s1-redhat-config-kickstart-prescript.html


/THomas
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 06:16 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org