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