probing for network devices during the pre phase

James_Martin at ao.uscourts.gov James_Martin at ao.uscourts.gov
Fri Jul 22 15:09:50 UTC 2005


I do something similar to your loader hack, but I've found it safer (and 
easier) to hack the anaconda python script..  You can insert routines 
right before the kickstart process.  On RHEL3, this is in the initrd.img, 
at /usr/bin/anaconda.  I modify the code at this block:

    for f in os.listdir("/usr/%s/python2.2/site-packages/rhpl" 
%(libdir,)):
        if os.access("/tmp/updates/rhpl/%s" %(f,), os.R_OK):
            continue
        elif f.endswith(".pyc") and os.access("/tmp/updates/rhpl/%s" 
%(f[:-1],), os.R_OK):
            # dont copy .pyc files we are replacing with updates
            continue

        os.symlink("/usr/%s/python2.2/site-packages/rhpl/%s" %(libdir, f),
                   "/tmp/updates/rhpl/%s" %(f,))

##do array config stuff  <---------------------------------Modification 
begin

print "Running Array Config...\n"
os.system("/usr/local/ao/ao-stuff.sh")

## 
<---------------------------------------------------------------Modification 
End

# For anaconda in test mode
if (os.path.exists('isys')):
    sys.path.append('isys')


Inside that shell script (ao-stuff.sh), I run HP's array configuration 
utility.  It configures the hardware RAID array.  It creates the logical 
drives.  Anaconda will fail if you attempt a kickstart with no logical 
drives.  I'm sure you can apply this to what you are trying to do.

James


James S. Martin, RHCE
Contractor
Administrative Office of the United States Courts
Washington, DC
(202) 502-2394

kickstart-list-bounces at redhat.com wrote on 07/22/2005 10:41:38 AM:

> Thanks for the /proc/net/dev hint Klaus. Here is the
> relavant anaconda step for the same:
> 
> #!/usr/bin/python
> 
> import sys
> sys.path.append('/usr/lib/anaconda')
> 
> import network
> 
> interfaces = network.Network().available()
> for interface in interfaces.keys() :
>         print interface
> 
> 
> #end
> 
> I am anxiously awaiting the details of your
> /sbin/loader hack :) Hope you can get in touch with
> the wiki owner.
> 
> 
> --- Klaus Steden <klaus.steden at thomson.net> wrote:
> 
> > > Basically I have the same question as posed in the
> > > thread below:
> > > 
> > >
> >
> 
http://www.redhat.com/archives/kickstart-list/2003-December/msg00043.html
> > > 
> > > In the %pre phase, I'm working on a small
> > interactive
> > > menu to grab some basic info from which I will
> > write
> > > out a complete ks.cfg using %include statements.
> > For
> > > the network section, I would like to probe the
> > system
> > > for network devices and prompt the user to choose
> > one
> > > (and only one). I can't find anything obvious in
> > the
> > > isys.py module like I can for probing disk drives.
> > > There is /usr/lib/anaconda/kudzu-probe-stub which
> > > might be a possibility. I guess I could parse
> > ifconfig
> > > -a output but that seems kind of messy. Anyone
> > know a
> > > better way to get at this info?
> > > 
> > I don't know about inside anaconda but you could try
> > to parse /proc/net/dev,
> > like this:
> > 
> > list=`cat /proc/net/dev | grep : |awk -F: '{print
> > $1}'`
> > 
> > and then:
> > 
> > select nic in $list
> > do
> >     <stuff>
> > done
> > 
> > ... on a related note, I did some hacking of the
> > anaconda process itself and
> > have developed a method for inserting code in
> > between /sbin/loader (a.k.a
> > init) and anaconda itself during kickstart ... some
> > people have asked me to
> > explain in detail, but I though it would be more
> > useful to put it on the
> > Anaconda Wiki ... but I'm having some difficulty
> > getting in touch with people
> > so far.
> > 
> > So if anyone out there reads this and knows the
> > email address of Greg Morgan
> > (who maintains the Anaconda Wiki), please email me
> > off list - it is much
> > appreciated!
> > 
> > cheers,
> > Klaus
> > 
> > _______________________________________________
> > Kickstart-list mailing list
> > Kickstart-list at redhat.com
> >
> https://www.redhat.com/mailman/listinfo/kickstart-list
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> _______________________________________________
> Kickstart-list mailing list
> Kickstart-list at redhat.com
> https://www.redhat.com/mailman/listinfo/kickstart-list




More information about the Kickstart-list mailing list