[SLL] yum repos and the mysterious life of releasever

Bill Campbell bill at celestial.com
Wed Oct 17 16:40:03 PDT 2007


On Wed, Oct 17, 2007, jkeating wrote:
>On Wed, 17 Oct 2007 12:49:58 -0700 (PDT)
>xeno at eskimo.com wrote:
>
>> I'm trying to get a handle on yum repos and after over an hour
>> looking through Google for good instructional documents have found
>> myself very unsatisfied. Has anyone a recommendation for a good doc
>> with examples on making detailed customized yum repos, and perhaps
>> that explain reasonably and clearly where in the name of the
>> redhatter gremlin gods the releasever variable is actually set, and
>> perhaps some nice clear and easy to use command to get the value from
>> simply and reliably?
>
>That's not set in the repo, it's set by the client on the client
>system.  You'll have to dig a bit into yum client code but basically
>the "release" value of the package that provides
>the /etc/redhat-release file.
>
>$ rpm -qf /etc/redhat-release 
>fedora-release-7.92-2
>
>In my case, the $releasever would be "7.92".  On a Fedora 7 machine
>where the package is say fedora-release-7-4, $releasever is 7.
>
>$ rpm -qf --qf "%{VERSION}\n" /etc/redhat-release
>
>That should suffice to figure out what the $releasever would be.  Of
>course you're going to tell me that not every system that uses yum has
>an /etc/redhat-release file.  This is true, some don't.  The way yum
>really does it is there is a config entry that sets what the
>'distroverpkg'.  Then yum figures out based on the rpmdb what real
>package "provides" the 'distroverpkg', and then the VERSION of /that/
>package is discovered and used.  There just isn't necessarily an easy
>way from the command line to do this, so for Red Hat based products
>querying the package that provides some /etc/*-release file would
>suffice. 
>
>The reason there isn't much documentation to creating yum repos is
>because there is not much to it.  You put rpms in a directory and you
>call createrepo on that directory.  Bam you have a yum repo.  You can
>then share this repo via file:///, http://, or ftp://.  The "custom"
>part of it all comes down to what content you out /in/ the repo, not
>necessarily how you /create/ the repo.

OK for a concrete example, but relating to kickstart, let's say I
have a local mirror of the CentOS updates on in internal ftp
server, accessible via anon-ftp as follows:

	/mirrors/centos/4.5/updates/i386
	/mirrors/centos/4.5/updates/x86_64
	/mirrors/centos/5.0/updates/i386
	/mirrors/centos/5.0/updates/x86_64

What do I put in my ks.cfg file, something like this for a 32-bit
CentSO 5 system?

repo Updates ftp://ftp.example.com/mirrors/centos/5.0/updates/i386

I would also like to be able to specify this same site for
updating our local systems using ``yum update''.  Would I then
hack the /etc/yum.repos.d/CentOS-Base.repo file modifying the
[updates] section with a line like:

baseurl=ftp://ftp.example.com/mirrors/centos/$releasever/updates/$basearch/

Bill
--
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

I don't care how little your country is, you got a right to run it like
you want to.  When the big nations quit meddling, then the world will have
peace.  Will Rogers


More information about the linux-list mailing list