FC7 doesn't have an extras.
[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$
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 $oldrepos = 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 $repos = array(array('ThirdParty', 'Third Party RPMS', '3rdparty'));
22
23
24 if (isset($_REQUEST['alpha'])) {
25   $repos[] = array('PlanetLabAlpha', 'PlanetLab Alpha RPMS', 'planetlab-alpha');
26 } elseif (isset($_REQUEST['beta'])) {
27   $repos[] = array('PlanetLabBeta', 'PlanetLab Beta RPMS', 'planetlab-beta');
28 } elseif (isset($_REQUEST['rollout'])) {
29   $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab-rollout');
30 } else {
31   $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab');
32 }
33
34 if (isset($_REQUEST['gpgcheck'])) {
35   $gpgcheck = $_REQUEST['gpgcheck'];
36 } else {
37   $gpgcheck = 0;
38 }
39
40 // Requesting a mirror list. Yum bombs out completely if a repository
41 // is (even temporarily) unavailable, so if CoBlitz is down, provide a
42 // few more options. Make sure that gpgcheck remains enabled.  Last
43 // chance option is ourselves so that yum never fails.
44 if (isset($_REQUEST['mirrorlist']) &&
45     isset($_REQUEST['repo']) &&
46     isset($_REQUEST['releasever'])) {
47   $mirrors = array("http://coblitz.planet-lab.org/pub/fedora/linux",
48                    "http://fedora.gtlib.cc.gatech.edu/pub/fedora.redhat/linux",
49                    "http://download.fedoraproject.org/pub/fedora/linux",
50                    "ftp://rpmfind.net/linux/fedora",
51                    "http://mirrors.kernel.org/fedora");
52   $releasever = $_REQUEST['releasever'];
53   switch ($_REQUEST['repo']) {
54   case "base":
55     foreach ($mirrors as $mirror) {
56       echo "$mirror/core/$releasever/\$ARCH/os/\n";
57     }
58     break;
59   case "updates":
60     foreach ($mirrors as $mirror) {
61       echo "$mirror/core/updates/$releasever/\$ARCH/\n";
62     }
63     break;
64   }
65
66   // Always list ourselves last
67   echo "https://$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=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=base&releasever=\$releasever
85 gpgcheck=$gpgcheck
86 # PlanetLab builds its own versions of these tools
87 exclude=iptables kernel kernel kernel-devel kernel-smp kernel-smp-devel kernel-xen0 kernel-xen0-devel kernel-xenU kernel-xenU-devel mysql ulogd
88
89 [updates]
90 name=Fedora Core \$releasever - \$basearch - Released Updates
91 mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=updates&releasever=\$releasever
92 gpgcheck=$gpgcheck
93 # PlanetLab builds its own versions of these tools
94 exclude=iptables kernel kernel kernel-devel kernel-smp kernel-smp-devel kernel-xen0 kernel-xen0-devel kernel-xenU kernel-xenU-devel mysql ulogd
95
96 EOF;
97
98 // Figure out which repositories we actually have on this
99 // machine. MyPLC installations, for instance, generally only have
100 // PlanetLab RPMS installed.
101 foreach ($repos as $repo) {
102   $id = $repo[0];
103   $name = $repo[1] . " -- " . "$PLC_NAME Central";
104   $dir = "/install-rpms/" . $repo[2];
105   $baseurl = "https://$PLC_BOOT_HOST" . $dir . "/";
106
107   if (is_dir(realpath($_SERVER['DOCUMENT_ROOT'] . $dir))) {
108     echo <<<EOF
109 [$id]
110 name=$name
111 baseurl=$baseurl
112 gpgcheck=$gpgcheck
113
114
115 EOF;
116   }
117 }
118
119 ?>