Robin Bowes wrote:
Hi,
I'd like to manipulate yum repo files in the %post section of my
kickstarts, specifically to disable repos that are being provided
through local mirrors.
I've knocked together some python code that does this:
http://robinbowes.com/article.php/20081026162228424
Sample usage:
initool --file /etc/yum.repos.d/epel.repo --section epel --option enabled=0
initool --file /etc/yum.repos.d/epel.repo --section epel --del priority
My question: what's the best way to make this available to a kickstart?
Is there anything cobbler can do, or do I need to do something like:
You could do it that way, seems like a bit much though when doing this works for me:
sed -i 's/enabled=1/enabled=0/' file.repo
or
perl -npe 's/enabled=1/enabled=0/' -i file.repo
or to remove a priority line completely:
perl -npe 's/^priority=.*\n$//' -i file.repo
Of course, that will affect all repos in that file (if more than one is listed), but
generally I'm betting that'd be fine since you'd probably want to disable a
similar group all at once. You could come up with some fancy regex to target only one
repo entry (but that's kind of a PITA to be honest), but this is what I would do.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.