[Yum] How to use /etc/yum/vars/* ?

James Antill james-yum at and.org
Mon Sep 13 21:30:35 UTC 2010

Chris Albertson <albertson.chris at gmail.com> writes:

> In the man page for yum.conf there is a note that reads..
>   "As of 3.2.28, any file in /etc/yum/vars is turned into a variable named
>    after the filename (or overrides any of the above variables)."
> How do I use this?  I'm guessing that maybe I make a file called
> /etc/yum/vars/FOOBAR and have it output a string to stdout
>  and then inside yum.conf  I can use a macro called $FOOBAR
> Is this documented any place other then what I quoted above?
> If I figure this out I'll be happy to submit a man page patch.

 There's the following two paragraphs, but as an example let's say you
want something like $release but for "myapp". The way you could do
this is ship a config. file called "/etc/yum/vars/myapp_release" with
"3" in it and then you can have your myapp.repo file look like:

name = Myapp. repo. for version $myapp_release
baseurl = http://example.com/myapp/$myapp_release/$basearch

...the filename (key) can be "anything", but the config. file
processor only looks for the Regexp "[$]\w+". The contents of the file
(value) can also be anything, but yum will only read the first line
(and then removes the \n) ... also yum doesn't do any escaping, so if
you make the contents of "myapp_release" "foo&bar" then the url part
is going to be wrong.

James Antill -- james at and.org
http://www.and.org/and-httpd/ -- $2,000 security guarantee

More information about the Yum mailing list