Re: Accessing boot: prompt options inside KS script

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

 



Hi Klaus,

Thanks for the /proc/cmd tip.

I extracted the commandline options like this:

ip=`grep ip /proc/cmdline | sed 's/.*ip=//' |sed 's/ .*//'`

The first grep is there to return a blank line incase the option is not
present at all (else the second sed would return the portion of the line
after the first whitespace even though ip= was not present).

The two seds split up the work, the first returns the entire command line
past ip=, and the second then retum the first part up to the first blank
space. Since all the command line options are space delimted, this works
just fine.

Busybox doesn't include awk, otherwise it would have been easier to just
use that. But awk is derived from sed, so sed does fine as well.

-Christian

_________________
Christian Rohrmeier
Schering AG
Corporate IT - Infrastructure and Services
Computer Systems and Operations
System Administration - Research and Development
Tel +49 30 468 15794
Fax +49 30 468 95794


                                                                                                                                      
                      Klaus Steden                                                                                                    
                      <klaus.steden@thomson.                                                                                          
                      net>                           To:      Discussion list about Kickstart <kickstart-list@xxxxxxxxxx>             
                      Sent by:                       cc:                                                                              
                      kickstart-list-bounces         Subject: Re: Accessing boot: prompt options inside KS script                     
                      @redhat.com                                                                                                     
                                                                                                                                      
                                                                                                                                      
                      20.05.2005 12:23                                                                                                
                      Please respond to                                                                                               
                      Discussion list about                                                                                           
                      Kickstart                                                                                                       
                                                                                                                                      
                                                                                                                                      




>
> Hi All,
>
> Is it possible to access the boot: prompt options in the %pre and %post
> scripts? As in, if on my bootprompt I have:
>
> linux ks=http://some.host/some.file -ip=1.2.3.4
>
> that I can then use the value of "-ip=" in the kickstart script itself?
>
Christian,

You can access these parameters by reading /proc/cmdline.

The contents of this file are read-only, and contain all the boot args
except
those that get used (and thus eaten) by the kernel (i.e. initrd=<initrd>
etc.).

It'll take a little bit of perl, awk, python, sed, or shell to turn them
into
something useful, but they're there if you need them.

hth,
Klaus

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





[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