RE: Alternate comps.xml file?

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

 



As promised, here is my solution to loading an alternate comps.xml file.
My solution was to add a comps= parameter to the kernel, which will
specify the url of an alternate comps.xml file.  If comps= is present, I
load the url to /tmp/updates/comps.xml, otherwise I don't do anything
and use the default comps.xml.

I added this to ks.cfg as the %pre section:

-------------------------------------------
%pre --interpreter /usr/bin/python
import urllib, os

# find comps_url, the name of the comps file to use, by reading the
kernel command line
args_fl = open("/proc/cmdline", "r")
args = args_fl.read().split()
args_fl.close()

comps_url = None
for arg in args:
    v = arg.split("=")
    if v[0] == "comps" and len(v) >= 2:
        comps_url = v[1]

if comps_url:
    os.mkdir("/tmp/updates")
    print "** retrieving " + comps_url
    urllib.urlretrieve(comps_url, "/tmp/updates/comps.xml")
    print "** done"
else:
    print "** using default comps.xml"
-------------------------------------------

I'm new to Python, so this might not be the best way of doing this, but
it works perfectly for me.

A special thanks to Brett Schwarz for his help in this.  I could not
have done this without his assistance.

Eric.





[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