- remove FC2 repos
[nodeconfig.git] / yum.conf.php
1 <?php
2 //
3 // /etc/yum.conf for production nodes
4 //
5 // Mark Huang <mlhuang@cs.princeton.edu>
6 // Copyright (C) 2004-2006 The Trustees of Princeton University
7 //
8 // $Id: yum.conf.php,v 1.1 2006/11/06 22:02:17 mlhuang Exp $
9 //
10
11 // For PLC_NAME and PLC_BOOT_HOST
12 include('plc_config.php');
13
14 $PLC_NAME = PLC_NAME;
15 $PLC_BOOT_HOST = PLC_BOOT_HOST;
16
17 $repos = array(array('ThirdParty', 'Third Party RPMS', '3rdparty'));
18
19 if (isset($_REQUEST['alpha'])) {
20   $repos[] = array('PlanetLabAlpha', 'PlanetLab Alpha RPMS', 'planetlab-alpha');
21 } elseif (isset($_REQUEST['beta'])) {
22   $repos[] = array('PlanetLabBeta', 'PlanetLab Beta RPMS', 'planetlab-beta');
23 } elseif (isset($_REQUEST['rollout'])) {
24   $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab-rollout');
25 } else {
26   $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab');
27 }
28
29 if (isset($_REQUEST['gpgcheck'])) {
30   $gpgcheck = $_REQUEST['gpgcheck'];
31 } else {
32   $gpgcheck = 0;
33 }
34
35 // Requesting a mirror list. Yum bombs out completely if a repository
36 // is (even temporarily) unavailable, so if CoBlitz is down, provide a
37 // few more options. Make sure that gpgcheck remains enabled.  Last
38 // chance option is ourselves so that yum never fails.
39 if (isset($_REQUEST['mirrorlist']) &&
40     isset($_REQUEST['repo']) &&
41     isset($_REQUEST['releasever'])) {
42   $mirrors = array("http://coblitz.planet-lab.org/pub/fedora/linux",
43                    "http://fedora.gtlib.cc.gatech.edu/pub/fedora.redhat/linux",
44                    "http://download.fedoraproject.org/pub/fedora/linux",
45                    "ftp://rpmfind.net/linux/fedora",
46                    "http://mirrors.kernel.org/fedora");
47   $releasever = $_REQUEST['releasever'];
48   switch ($_REQUEST['repo']) {
49   case "base":
50     foreach ($mirrors as $mirror) {
51       echo "$mirror/core/$releasever/\$ARCH/os/\n";
52     }
53     break;
54   case "updates":
55     foreach ($mirrors as $mirror) {
56       echo "$mirror/core/updates/$releasever/\$ARCH/\n";
57     }
58     break;
59   case "extras":
60     foreach ($mirrors as $mirror) {
61       echo "$mirror/extras/$releasever/\$ARCH/\n";
62     }
63     break;
64   }
65
66   // Always list ourselves last
67   echo "http://$PLC_BOOT_HOST/install-rpms/planetlab/\n";
68   exit;
69 }
70
71 // Requesting yum.conf. See above for the mirrorlist definition.
72 echo <<<EOF
73 [main]
74 # Do not scan /etc/yum.repos.d/
75 reposdir=/dev/null
76 cachedir=/var/cache/yum
77 debuglevel=2
78 logfile=/var/log/yum.log
79 pkgpolicy=newest
80 gpgcheck=$gpgcheck
81
82 [base]
83 name=Fedora Core \$releasever - \$basearch - Base
84 mirrorlist=http://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=base&releasever=\$releasever
85 gpgcheck=$gpgcheck
86
87 [updates]
88 name=Fedora Core \$releasever - \$basearch - Released Updates
89 mirrorlist=http://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=updates&releasever=\$releasever
90 gpgcheck=$gpgcheck
91
92 [extras]
93 name=Fedora Extras \$releasever - \$basearch
94 mirrorlist=http://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=extras&releasever=\$releasever
95 gpgcheck=$gpgcheck
96
97
98 EOF;
99
100 // Figure out which repositories we actually have on this
101 // machine. MyPLC installations, for instance, generally only have
102 // PlanetLab RPMS installed.
103 foreach ($repos as $repo) {
104   $id = $repo[0];
105   $name = $repo[1] . " -- " . "$PLC_NAME Central";
106   $dir = "/install-rpms/" . $repo[2];
107   $baseurl = "http://$PLC_BOOT_HOST" . $dir . "/";
108
109   if (is_dir(realpath($_SERVER['DOCUMENT_ROOT'] . $dir))) {
110     echo <<<EOF
111 [$id]
112 name=$name
113 baseurl=$baseurl
114 gpgcheck=$gpgcheck
115
116
117 EOF;
118   }
119 }
120
121 ?>