--- /dev/null
+<?php
+//
+// part of yum config on nodes
+//
+// Thierry Parmentelat
+// Copyright (C) 2008 INRIA
+//
+// $Id: yum.conf.php 9688 2008-06-25 08:24:27Z thierry $
+//
+
+// For PLC_NAME and PLC_BOOT_HOST
+include('plc_config.php');
+
+$PLC_NAME = PLC_NAME;
+$PLC_BOOT_HOST = PLC_BOOT_HOST;
+
+// Get admin API handle
+require_once 'plc_api.php';
+global $adm;
+
+if (isset($_REQUEST['gpgcheck'])) {
+ $gpgcheck = $_REQUEST['gpgcheck'];
+} else {
+ $gpgcheck = 0;
+}
+
+# get node family
+if ( ! isset($_REQUEST['slicefamily'])) {
+ # legacy : use the old naming scheme
+ $nodefamily="planetlab";
+ $pldistro="planetlab";
+ } else {
+ $slicefamily = $_REQUEST['slicefamily'];
+ echo "# slicefamily $slicefamily \n" ;
+ list( $pldistro, $fcdistro, $arch) = split ("-", $slicefamily);
+ $nodefamily = "$pldistro-$arch";
+ echo "# nodefamily $nodefamily \n" ;
+ }
+
+# the nodegroups the node is part of
+$nodegroup_names=array();
+
+if ( ! isset($_REQUEST['node_id'])) {
+ print "# Warning : node_id not set\n";
+ } else {
+ $node_id=intval($_REQUEST['node_id']);
+ echo "# node_id $node_id \n";
+ # compute nodegroups
+ $nodes = $adm->GetNodes(array('node_id'=>$node_id));
+ $nodegroup_ids = $nodes[0]['nodegroup_ids'];
+ $nodegroups = $adm->GetNodeGroups($nodegroup_ids);
+ foreach ($nodegroups as $nodegroup) {
+ $nodegroup_name = $nodegroup['name'];
+ $nodegroup_names [] = $nodegroup_name;
+ echo "# in nodegroup $nodegroup_name \n" ;
+ }
+ }
+
+$topdir=$_SERVER['DOCUMENT_ROOT'] . "/install-rpms/";
+$topurl="https://$PLC_BOOT_HOST" . "/install-rpms/";
+
+
+# locate the planetlab repo for this node family & nodegroup
+$repo=NULL;
+foreach ($nodegroup_names as $nodegroup_name) {
+ $groupdir = "$nodefamily-$nodegroup_name";
+ # have we got a repo like /install-rpms/planetlab-i386-alpha ?
+ echo "# trying " . $topdir . $groupdir . "\n";
+ if (is_dir (realpath($topdir . $groupdir))) {
+ $repo=array($pldistro, $groupdir, "$PLC_NAME $nodefamily $nodegroup_name");
+ break;
+ }
+}
+
+# if not found yet
+if ( ! $repo) {
+ echo "# trying default " . $topdir . $nodefamily . "\n";
+ if (is_dir (realpath($topdir . $nodefamily))) {
+ $repo = array($pldistro, $nodefamily, "$PLC_NAME $nodefamily regular");
+ }
+ }
+
+# default: if we're here it's probably very wrong
+if ( ! $repo) {
+ echo "# WARNING: could not find a decent planetlab repo for this node\n";
+ $repo = array ($pldistro, "planetlab", "default probably wrong");
+ }
+
+list( $id, $dir, $name) = $repo;
+
+echo <<< __PLC_REPO__
+[$id]
+name=$name
+baseurl=$topurl/$dir
+gpgcheck=$gpgcheck
+
+__PLC_REPO__;
+
+?>
+++ /dev/null
-<?php
-//
-// /etc/yum.conf for production nodes
-//
-// Mark Huang <mlhuang@cs.princeton.edu>
-// Copyright (C) 2004-2006 The Trustees of Princeton University
-//
-// $Id$
-//
-
-// For PLC_NAME and PLC_BOOT_HOST
-include('plc_config.php');
-
-$PLC_NAME = PLC_NAME;
-$PLC_BOOT_HOST = PLC_BOOT_HOST;
-
-////////////////////////////// mirror list
-
-// Requesting a mirror list. Yum bombs out completely if a repository
-// is (even temporarily) unavailable, so if CoBlitz is down, provide a
-// few more options. Make sure that gpgcheck remains enabled. Last
-// chance option is ourselves so that yum never fails.
-if (isset($_REQUEST['mirrorlist']) &&
- isset($_REQUEST['repo']) &&
- isset($_REQUEST['releasever'])) {
- $mirrors = array("http://coblitz.codeen.org/coblitz.planet-lab.org/pub/fedora/linux",
- "http://fedora.gtlib.cc.gatech.edu/pub/fedora.redhat/linux",
- "http://download.fedoraproject.org/pub/fedora/linux",
- "http://mirrors.kernel.org/fedora");
- #"ftp://rpmfind.net/linux/fedora", still uses the old style of directory hierarchy
- $releasever = $_REQUEST['releasever'];
- switch ($_REQUEST['repo']) {
- case "base":
- if ( intval($releasever) >= 7 )
- {
- foreach ($mirrors as $mirror) {
- echo "$mirror/releases/$releasever/Everything/\$ARCH/os/\n";
- }
-
- } else {
- foreach ($mirrors as $mirror) {
- echo "$mirror/core/$releasever/\$ARCH/os/\n";
- }
- }
- break;
- case "updates":
- if ( intval($releasever) >= 7 )
- {
- foreach ($mirrors as $mirror) {
- echo "$mirror/updates/$releasever/\$ARCH/\n";
- }
-
- } else {
- foreach ($mirrors as $mirror) {
- echo "$mirror/core/updates/$releasever/\$ARCH/\n";
- }
- }
- break;
- }
-
- // Always list ourselves last
- echo "https://$PLC_BOOT_HOST/install-rpms/planetlab/\n";
- exit;
-}
-
-////////////////////////////// plain yum.conf
-
-// Get admin API handle
-require_once 'plc_api.php';
-global $adm;
-
-// Requesting yum.conf. See above for the mirrorlist definition.
-
-if (isset($_REQUEST['gpgcheck'])) {
- $gpgcheck = $_REQUEST['gpgcheck'];
-} else {
- $gpgcheck = 0;
-}
-
-// fedora stock : base & updates
-
-echo <<<__STD_REPOS__
-[main]
-# Do not scan /etc/yum.repos.d/
-reposdir=/dev/null
-cachedir=/var/cache/yum
-debuglevel=2
-logfile=/var/log/yum.log
-pkgpolicy=newest
-gpgcheck=$gpgcheck
-
-[base]
-name=Fedora Core \$releasever - \$basearch - Base
-mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=base&releasever=\$releasever
-gpgcheck=$gpgcheck
-# PlanetLab builds its own versions of these tools
-exclude=kernel* iptables iproute
-
-[updates]
-name=Fedora Core \$releasever - \$basearch - Released Updates
-mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=updates&releasever=\$releasever
-gpgcheck=$gpgcheck
-# PlanetLab builds its own versions of these tools
-exclude=kernel* iptables iproute
-
-__STD_REPOS__;
-
-echo "\n";
-
-# get node family
-if ( ! isset($_REQUEST['slicefamily'])) {
- # legacy : use the old naming scheme
- $nodefamily="planetlab";
- $pldistro="planetlab";
- } else {
- $slicefamily = $_REQUEST['slicefamily'];
- echo "# slicefamily $slicefamily \n" ;
- list( $pldistro, $fcdistro, $arch) = split ("-", $slicefamily);
- $nodefamily = "$pldistro-$arch";
- echo "# nodefamily $nodefamily \n" ;
- }
-
-# the nodegroups the node is part of
-$nodegroup_names=array();
-
-if ( ! isset($_REQUEST['node_id'])) {
- print "# Warning : node_id not set\n";
- } else {
- $node_id=intval($_REQUEST['node_id']);
- echo "# node_id $node_id \n";
- # compute nodegroups
- $nodes = $adm->GetNodes(array('node_id'=>$node_id));
- $nodegroup_ids = $nodes[0]['nodegroup_ids'];
- $nodegroups = $adm->GetNodeGroups($nodegroup_ids);
- foreach ($nodegroups as $nodegroup) {
- $nodegroup_name = $nodegroup['name'];
- $nodegroup_names [] = $nodegroup_name;
- echo "# in nodegroup $nodegroup_name \n" ;
- }
- }
-
-$topdir=$_SERVER['DOCUMENT_ROOT'] . "/install-rpms/";
-$topurl="https://$PLC_BOOT_HOST" . "/install-rpms/";
-
-
-# locate the planetlab repo for this node family & nodegroup
-$repo=NULL;
-foreach ($nodegroup_names as $nodegroup_name) {
- $groupdir = "$nodefamily-$nodegroup_name";
- # have we got a repo like /install-rpms/planetlab-i386-alpha ?
- echo "# trying " . $topdir . $groupdir . "\n";
- if (is_dir (realpath($topdir . $groupdir))) {
- $repo=array($pldistro, $groupdir, "$PLC_NAME $nodefamily $nodegroup_name");
- break;
- }
-}
-
-# if not found yet
-if ( ! $repo) {
- echo "# trying default " . $topdir . $nodefamily . "\n";
- if (is_dir (realpath($topdir . $nodefamily))) {
- $repo = array($pldistro, $nodefamily, "$PLC_NAME $nodefamily regular");
- }
- }
-
-# default: if we're here it's probably very wrong
-if ( ! $repo) {
- echo "# WARNING: could not find a decent planetlab repo for this node\n";
- $repo = array ($pldistro, "planetlab", "default probably wrong");
- }
-
-list( $id, $dir, $name) = $repo;
-
-echo <<< __PLC_REPO__
-[$id]
-name=$name
-baseurl=$topurl/$dir
-gpgcheck=$gpgcheck
-__PLC_REPO__;
-
-#################### I guess this might go to trash, but just in case:
-# mention if exist: install-rpms/planetlab-i386-3rdparty
-$optional_repos = array (array ('ThirdParty', '3rdparty','Third Party RPMS'));
-
-foreach ($optional_repos as $repo) {
- list( $id, $dir, $name) = $repo;
- if (is_dir (realpath($topdir . $dir))) {
- echo <<< __OPT_REPO__
-[$id]
-name=$name
-baseurl=$topurl/$dir
-gpgcheck=$gpgcheck
-__OPT_REPO__;
-
- }
-}
-
-?>