Switch to https to get around site proxies.
[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.5 2007/03/22 17:57:23 faiyaza 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 $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   case "extras":
65     foreach ($mirrors as $mirror) {
66       echo "$mirror/extras/$releasever/\$ARCH/\n";
67     }
68     break;
69   }
70
71   // Always list ourselves last
72   echo "https://$PLC_BOOT_HOST/install-rpms/planetlab/\n";
73   exit;
74 }
75
76 // Requesting yum.conf. See above for the mirrorlist definition.
77 echo <<<EOF
78 [main]
79 # Do not scan /etc/yum.repos.d/
80 reposdir=/dev/null
81 cachedir=/var/cache/yum
82 debuglevel=2
83 logfile=/var/log/yum.log
84 pkgpolicy=newest
85 gpgcheck=$gpgcheck
86
87 [base]
88 name=Fedora Core \$releasever - \$basearch - Base
89 mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=base&releasever=\$releasever
90 gpgcheck=$gpgcheck
91 # PlanetLab builds its own versions of these tools
92 exclude=iptables kernel kernel kernel-devel kernel-smp kernel-smp-devel kernel-xen0 kernel-xen0-devel kernel-xenU kernel-xenU-devel mysql ulogd
93
94 [updates]
95 name=Fedora Core \$releasever - \$basearch - Released Updates
96 mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=updates&releasever=\$releasever
97 gpgcheck=$gpgcheck
98 # PlanetLab builds its own versions of these tools
99 exclude=iptables kernel kernel kernel-devel kernel-smp kernel-smp-devel kernel-xen0 kernel-xen0-devel kernel-xenU kernel-xenU-devel mysql ulogd
100
101 [extras]
102 name=Fedora Extras \$releasever - \$basearch
103 mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=extras&releasever=\$releasever
104 gpgcheck=$gpgcheck
105 # PlanetLab builds its own versions of these tools
106 exclude=iptables kernel kernel kernel-devel kernel-smp kernel-smp-devel kernel-xen0 kernel-xen0-devel kernel-xenU kernel-xenU-devel mysql ulogd
107
108
109 EOF;
110
111 // Figure out which repositories we actually have on this
112 // machine. MyPLC installations, for instance, generally only have
113 // PlanetLab RPMS installed.
114 foreach ($repos as $repo) {
115   $id = $repo[0];
116   $name = $repo[1] . " -- " . "$PLC_NAME Central";
117   $dir = "/install-rpms/" . $repo[2];
118   $baseurl = "https://$PLC_BOOT_HOST" . $dir . "/";
119
120   if (is_dir(realpath($_SERVER['DOCUMENT_ROOT'] . $dir))) {
121     echo <<<EOF
122 [$id]
123 name=$name
124 baseurl=$baseurl
125 gpgcheck=$gpgcheck
126
127
128 EOF;
129   }
130 }
131
132 ?>