3 // part of yum config on nodes
6 // Copyright (C) 2008 INRIA
8 // $Id: myplc.repo.php 9818 2008-07-04 07:54:06Z thierry $
11 // For PLC_NAME and PLC_BOOT_HOST
12 include('plc_config.php');
15 $PLC_BOOT_HOST = PLC_BOOT_HOST;
17 // Get admin API handle
18 require_once 'plc_api.php';
21 if (isset($_REQUEST['gpgcheck'])) {
22 $gpgcheck = $_REQUEST['gpgcheck'];
28 if ( ! isset($_REQUEST['slicefamily'])) {
29 # legacy : use the old naming scheme
30 $nodefamily="planetlab";
31 $pldistro="planetlab";
33 $slicefamily = $_REQUEST['slicefamily'];
34 echo "# slicefamily $slicefamily \n" ;
35 list( $pldistro, $fcdistro, $arch) = split ("-", $slicefamily);
36 $nodefamily = "$pldistro-$arch";
37 echo "# nodefamily $nodefamily \n" ;
40 # the nodegroups the node is part of
41 $nodegroup_names=array();
43 if ( ! isset($_REQUEST['node_id'])) {
44 print "# Warning : node_id not set\n";
46 $node_id=intval($_REQUEST['node_id']);
47 echo "# node_id $node_id \n";
49 $nodes = $adm->GetNodes(array('node_id'=>$node_id));
50 $nodegroup_ids = $nodes[0]['nodegroup_ids'];
51 $nodegroups = $adm->GetNodeGroups($nodegroup_ids);
52 foreach ($nodegroups as $nodegroup) {
53 $nodegroup_name = $nodegroup['groupname'];
54 $nodegroup_names [] = $nodegroup_name;
55 echo "# in nodegroup $nodegroup_name \n" ;
59 $topdir=$_SERVER['DOCUMENT_ROOT'] . "/install-rpms/";
60 $topurl="https://$PLC_BOOT_HOST" . "/install-rpms/";
63 # locate the planetlab repo for this node family & nodegroup
65 foreach ($nodegroup_names as $nodegroup_name) {
66 $groupdir = "$nodefamily-$nodegroup_name";
67 # have we got a repo like /install-rpms/planetlab-i386-alpha ?
68 echo "# trying " . $topdir . $groupdir . "\n";
69 if (is_dir (realpath($topdir . $groupdir))) {
70 $repo=array($pldistro, $groupdir, "$PLC_NAME $nodefamily $nodegroup_name");
77 echo "# trying default " . $topdir . $nodefamily . "\n";
78 if (is_dir (realpath($topdir . $nodefamily))) {
79 $repo = array($pldistro, $nodefamily, "$PLC_NAME $nodefamily regular");
83 # default: if we're here it's probably very wrong
85 echo "# WARNING: could not find a decent planetlab repo for this node\n";
86 $repo = array ($pldistro, "planetlab", "default probably wrong");
87 # don't define the repo in this case
91 list( $id, $dir, $name) = $repo;