write yum repos used during install under /etc/yum.repo.d/
-----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.
~ 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]
' % (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
" % (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
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
08-26-2008, 07:00 PM
Jeremy Katz
write yum repos used during install under /etc/yum.repo.d/
On Mon, 2008-08-25 at 16:26 +0200, Radek Vykydal wrote:
> > Good morning,
> > anyone to review and comment on this patch please?
>
> The patch seems OK to me, but the policy of preference of repos
> after installation should be thought about. I think
> that the added install repos shouldn't be the preferred one -
> I'd rather even disable it by default because disabled repo wouldn't
> do any harm, and yet it could be useful.
Actually, I thought that this all became moot with Chris's changes to
use the repo files, etc in git master? The "default" case is you end up
using one of the repos from a repo file. If you disable/add a repo/etc,
then we were going to carry that over into the installed system iirc.
Jeremy
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list