[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] write yum repos used during install under /etc/yum.repo.d/
- From: Alexander Todorov <atodorov redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: [PATCH] write yum repos used during install under /etc/yum.repo.d/
- Date: Mon, 04 Aug 2008 15:43:04 +0300
-----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-----
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]