3 // /etc/yum.conf for production nodes
5 // Mark Huang <mlhuang@cs.princeton.edu>
6 // Copyright (C) 2004-2006 The Trustees of Princeton University
11 // For PLC_NAME and PLC_BOOT_HOST
12 include('plc_config.php');
15 $PLC_BOOT_HOST = PLC_BOOT_HOST;
17 ////////////////////////////// mirror list
19 // Requesting a mirror list. Yum bombs out completely if a repository
20 // is (even temporarily) unavailable, so if CoBlitz is down, provide a
21 // few more options. Make sure that gpgcheck remains enabled. Last
22 // chance option is ourselves so that yum never fails.
23 if (isset($_REQUEST['mirrorlist']) &&
24 isset($_REQUEST['repo']) &&
25 isset($_REQUEST['releasever'])) {
26 $mirrors = array("http://coblitz.codeen.org/coblitz.planet-lab.org/pub/fedora/linux",
27 "http://fedora.gtlib.cc.gatech.edu/pub/fedora.redhat/linux",
28 "http://download.fedoraproject.org/pub/fedora/linux",
29 "http://mirrors.kernel.org/fedora");
30 #"ftp://rpmfind.net/linux/fedora", still uses the old style of directory hierarchy
31 $releasever = $_REQUEST['releasever'];
32 switch ($_REQUEST['repo']) {
34 if ( intval($releasever) >= 7 )
36 foreach ($mirrors as $mirror) {
37 echo "$mirror/releases/$releasever/Everything/\$ARCH/os/\n";
41 foreach ($mirrors as $mirror) {
42 echo "$mirror/core/$releasever/\$ARCH/os/\n";
47 if ( intval($releasever) >= 7 )
49 foreach ($mirrors as $mirror) {
50 echo "$mirror/updates/$releasever/\$ARCH/\n";
54 foreach ($mirrors as $mirror) {
55 echo "$mirror/core/updates/$releasever/\$ARCH/\n";
61 // Always list ourselves last
62 echo "https://$PLC_BOOT_HOST/install-rpms/planetlab/\n";
66 ////////////////////////////// plain yum.conf
68 // Get admin API handle
69 require_once 'plc_api.php';
72 // Requesting yum.conf. See above for the mirrorlist definition.
74 if (isset($_REQUEST['gpgcheck'])) {
75 $gpgcheck = $_REQUEST['gpgcheck'];
80 // fedora stock : base & updates
84 # Do not scan /etc/yum.repos.d/
86 cachedir=/var/cache/yum
88 logfile=/var/log/yum.log
93 name=Fedora Core \$releasever - \$basearch - Base
94 mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=base&releasever=\$releasever
96 # PlanetLab builds its own versions of these tools
97 exclude=kernel* iptables iproute
100 name=Fedora Core \$releasever - \$basearch - Released Updates
101 mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=updates&releasever=\$releasever
103 # PlanetLab builds its own versions of these tools
104 exclude=kernel* iptables iproute
111 if ( ! isset($_REQUEST['slicefamily'])) {
112 # legacy : use the old naming scheme
113 $nodefamily="planetlab";
114 $pldistro="planetlab";
116 $slicefamily = $_REQUEST['slicefamily'];
117 echo "# slicefamily $slicefamily \n" ;
118 list( $pldistro, $fcdistro, $arch) = split ("-", $slicefamily);
119 $nodefamily = "$pldistro-$arch";
120 echo "# nodefamily $nodefamily \n" ;
123 # the nodegroups the node is part of
124 $nodegroup_names=array();
126 if ( ! isset($_REQUEST['node_id'])) {
127 print "# Warning : node_id not set\n";
129 $node_id=intval($_REQUEST['node_id']);
130 echo "# node_id $node_id \n";
132 $nodes = $adm->GetNodes(array('node_id'=>$node_id));
133 $nodegroup_ids = $nodes[0]['nodegroup_ids'];
134 $nodegroups = $adm->GetNodeGroups($nodegroup_ids);
135 foreach ($nodegroups as $nodegroup) {
136 $nodegroup_name = $nodegroup['name'];
137 $nodegroup_names [] = $nodegroup_name;
138 echo "# in nodegroup $nodegroup_name \n" ;
142 $topdir=$_SERVER['DOCUMENT_ROOT'] . "/install-rpms/";
143 $topurl="https://$PLC_BOOT_HOST" . "/install-rpms/";
146 # locate the planetlab repo for this node family & nodegroup
148 foreach ($nodegroup_names as $nodegroup_name) {
149 $groupdir = "$nodefamily-$nodegroup_name";
150 # have we got a repo like /install-rpms/planetlab-i386-alpha ?
151 echo "# trying " . $topdir . $groupdir . "\n";
152 if (is_dir (realpath($topdir . $groupdir))) {
153 $repo=array($pldistro, $groupdir, "$PLC_NAME $nodefamily $nodegroup_name");
160 echo "# trying default " . $topdir . $nodefamily . "\n";
161 if (is_dir (realpath($topdir . $nodefamily))) {
162 $repo = array($pldistro, $nodefamily, "$PLC_NAME $nodefamily regular");
166 # default: if we're here it's probably very wrong
168 echo "# WARNING: could not find a decent planetlab repo for this node\n";
169 $repo = array ($pldistro, "planetlab", "default probably wrong");
172 list( $id, $dir, $name) = $repo;
174 echo <<< __PLC_REPO__
181 #################### I guess this might go to trash, but just in case:
182 # mention if exist: install-rpms/planetlab-i386-3rdparty
183 $optional_repos = array (array ('ThirdParty', '3rdparty','Third Party RPMS'));
185 foreach ($optional_repos as $repo) {
186 list( $id, $dir, $name) = $repo;
187 if (is_dir (realpath($topdir . $dir))) {
188 echo <<< __OPT_REPO__