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
08-14-2011, 07:36 PM
"Joseph L. Casale"
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
08-14-2011, 08:06 PM
Keith Roberts
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?
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
08-14-2011, 08:48 PM
Thomas Johansson
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?
>
/Thomas
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
08-14-2011, 09:13 PM
"Joseph L. Casale"
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
08-14-2011, 09:24 PM
"Joseph L. Casale"
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
08-15-2011, 07:06 AM
Keith Roberts
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?
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
08-15-2011, 07:19 AM
Keith Roberts
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.
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
08-15-2011, 08:26 AM
John Hodrien
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
08-15-2011, 10:12 AM
Thomas Johansson
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?
>