[PATCH] write yum repos used during install under /etc/yum.repo.d/

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Good afternoon list,
I've seen people asking for this feature from time to time. The code below comes
from the RHEL5 branch but was commented out. Last time I've
tested it with RHEL5 it was breaking.

I did some slight modifications to the original code and tested this with F9 and
it works for me. As you can see only http(s) and ftp repos are written to config
files.

- ---
~ yuminstall.py |   19 +++++++++++++++++++
~ 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index ad7615a..dcff552 100644
- --- a/yuminstall.py
+++ b/yuminstall.py
@@ -1952,6 +1952,25 @@
reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
~             f.write("-%s\n" % pkg)

~     def writeConfiguration(self):
+        emptyRepoConf = yum.config.RepoConf()
+        compulsorySettings = [ 'enabled', 'cost' ]
+        for repo in self.ayum.repos.listEnabled():
+            for url in repo.urls:
+                if url.startswith('http://') or url.startswith('https://') or
url.startswith('ftp://'):
+                    fn = "%s/etc/yum.repos.d/%s.repo" % (self.instPath, repo.id)
+                    f = open(fn , 'w')
+                    f.write('[%s]\n' % (repo.id,))
+                    for k, v in emptyRepoConf.iteritems():
+                        repoval = repo.getAttribute(k)
+                        if not (k in compulsorySettings):
+                            if not repoval or (repoval == v):
+                                # continue the k, v loop
+                                continue
+                        val = emptyRepoConf.optionobj(k).tostring(repoval)
+                        f.write("%s=%s\n" % (k,val))
+                    f.close()
+                    # break out of the urls loop
+                    break
~         return

~     def getRequiredMedia(self):



Thanks,
Alexander.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org

iD8DBQFIlvlXhmd3WOiFct4RCl03AKCzpSSu8vPREYlri0miioSKoXTjKwCfVney
bCTG52FWgSsDjnhfL4OCbCY=
=7RjT
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux