[Yum] $distribution ???

Robert G. Brown rgb at phy.duke.edu
Tue Sep 28 13:06:54 UTC 2004


On Tue, 28 Sep 2004, Eric V. Smith wrote:

> > Is
> > there any way to consistently set it to a set of standard values that
> > work for at least the primary distros that use yum?  For example,
> > parsing the first line of /etc/issue would work for RH and Fedora, but
> > there may a better way or a different way.
> 
> This I'm not sure of.  My work is restricted to RH and Fedora.

I still haven't had time to sit down and learn python, although I do
have a book and could probably hack with it in hand.  Given:

rgb at ganesh|B:1041>cat /etc/issue
Fedora Core release 2 (Tettnang)
Kernel \r on an \m

rgb at lucifer|B:1002>cat /etc/issue
Red Hat Linux release 9 (Shrike)
Kernel \r on an \m


In perl (which I know pretty well) I'd just open /etc/issue and split
the first line on the word "release" to make $distribution equal "Fedora
Core" and "Red Hat Linux" respectively.  Default would be "unknown" if
/etc/issue didn't exist or the first line didn't contain the word
"release", unless/until somebody contributes a simple way of setting the
variable for other distros.

This would take maybe thirty minutes to implement and test (in perl) for
at least these two /etc/issues and the default case.  Then one could
take it from there.

It probably wouldn't take me MUCH longer to do in python, book in hand.
Local python gods could probably do it in even less -- they are always
telling me how much better python is than perl...;-)

   rgb

-- 
Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb at phy.duke.edu






More information about the Yum mailing list