[Yum] Supporting multiple OS versions with local repo

Greg Ward gerg.ward+yum at gmail.com
Thu Jun 19 21:00:48 UTC 2008


Hi all --

I am setting up a repository of locally-built packages.  I need to
support multiple versions of multiple OS flavours: at a minimum, RHEL
3, RHEL 4, RHEL 5, FC 4, FC5, FC 6, Fedora 7, Fedora 8, and CentOS 5.
(Phew!)  Most packages (e.g. Java and its libraries) work on all OS
versions, so I also need a "common" repository.  I'm hoping to get
away with just building on RHEL 3, 4, and 5.  I'll use symlinks to
paper over the differences, e.g. the repository for CentOS 5 would
just symlink to the RHEL 5 repo.  (If there's some version of Fedora
that falls in between the cracks, I'll just tell my local users, "Too
bad: that version is not supported".)

I've gotten as far as figuring out that I cannot simply use yum's
$releasever to discriminate, because that might confuse RHEL 4 with FC
4, RHEL 5 with FC 5, etc.  Not good.

However, I don't see any clean way to get the name of the distro into
the .repo file.  E.g. say I layout my repositories like this:

  repositories/
    fedora/
      4 -> ../redhat/4
      5 -> ../redhat/4
      6 -> ../redhat/5
      7 -> ../redhat/5
      8 -> ../redhat/5
    redhat/
      3
      3ES -> 3
      4
      4ES -> 4
      4WS -> 4
      5
    centos/
      5 -> ../redhat/5

Then I would need a local.repo file with this line:

  baseurl = http://reposerver/repositories/<distro-name>/$releasever

I cannot think of a good way to do this.  I can think of a nasty way,
which is to use "rpm -qf /etc/redhat-release" to figure out if this is
fedora, redhat, or centos and proceed from there. Is there a better
approach?

Thanks --

Greg



More information about the Yum mailing list