Re: Please Use the Mirrors!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



seth vidal wrote:
>> Better yet, have yum support redirects (I don't know if it doesn't
>> already) and have the yum.conf point to a dynamic webpage that
>> redirects to a local mirror for the client (using the cpan module for
>> country location, or something of the like).
>
> yum supports http redirects but it doesn't support javascript redirects
> or META refresh redirects (nor will it, so don't ask! :)

Here's a PHP script that will do it pretty easily with a bit of tweaking
for your use:

<?
  $releasever = $_REQUEST['releasever'];
  $basearch   = $_REQUEST['basearch'];
  $repo       = $_REQUEST['repo'];

  if ($repo == "os") {
    $mirrors = array(
      "<pathtomirror1>/$releasever/$basearch/os",
      "<pathtomirror2>/$releasever/$basearch/os", );
  }
  else if ($repo == "updates") {
    $mirrors = array(
      "<pathtomirror1>/$releasever/$basearch/updates",
      "<pathtomirror2>/$releasever/$basearch/updates",
  );
  // Add more repos here if you need them

  $mirror = $mirrors[rand(0,sizeof($mirrors)-1)];

  $path = $_SERVER['PATH_INFO'];
  header("Location: $mirror$path");
?>

Put the script on your webserver, then point your yum.conf like this to
your server:

[os]
name=Repo Name $releasever - $basearch - Base
baseurl=<pathtophpscript>?releasever=$releasever&basearch=$basearch&repo=os
[updates]
name=Repo Name $releasever - $basearch - Released Updates
baseurl=<pathtophpscript>?releasever=$releasever&basearch=$basearch&repo=updates

Tweak as necessary to handle legacy as well as any other updates.  One php
script can be configured to handle, just make up an appropriate repo name.

Have retries set to 20 in [main] of yum.conf and away you go!

-Dave


--

fedora-legacy-list@xxxxxxxxxx
http://www.redhat.com/mailman/listinfo/fedora-legacy-list

[Index of Archives]     [Fedora Development]     [Fedora Announce]     [Fedora Legacy Announce]     [Fedora Config]     [PAM]     [Fedora General Discussion]     [Big List of Linux Books]     [Gimp]     [Yosemite Questions]

  Powered by Linux