From eff0335ba4cefc16971bee9a22fe94f039af9258 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 25 Jun 2008 08:24:27 +0000 Subject: [PATCH] rewritten for - taking multi-arch into account - removing the need for specific conf-files for alpha-beta See the impact on running deployments at http://svn.planet-lab.org/wiki/NodeFamily#Notesonyumreposandyum.conf.php --- PlanetLabConf/yum.conf.php | 131 ++++++++++++++++++++++++------------- 1 file changed, 86 insertions(+), 45 deletions(-) diff --git a/PlanetLabConf/yum.conf.php b/PlanetLabConf/yum.conf.php index c15ea78..40671b2 100755 --- a/PlanetLabConf/yum.conf.php +++ b/PlanetLabConf/yum.conf.php @@ -71,31 +71,15 @@ global $adm; // Requesting yum.conf. See above for the mirrorlist definition. -#$oldrepos = array(array('FedoraCore2Base', 'Fedora Core 2 Base', 'stock-fc2'), -# array('FedoraCore2Updates', 'Fedora Core 2 Updates', 'updates-fc2'), -# array('ThirdParty', 'Third Party RPMS', '3rdparty')); - -$repos = array(array('ThirdParty', 'Third Party RPMS', '3rdparty')); - - -if (isset($_REQUEST['alpha'])) { - $repos[] = array('PlanetLabAlpha', 'PlanetLab Alpha RPMS', 'planetlab-alpha'); -} elseif (isset($_REQUEST['beta'])) { - $repos[] = array('PlanetLabBeta', 'PlanetLab Beta RPMS', 'planetlab-beta'); -} elseif (isset($_REQUEST['rollout'])) { - $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab-rollout'); -} else { - $repos[] = array('PlanetLab', 'PlanetLab RPMS', 'planetlab'); -} - if (isset($_REQUEST['gpgcheck'])) { $gpgcheck = $_REQUEST['gpgcheck']; } else { $gpgcheck = 0; } +// fedora stock : base & updates -echo <<GetNodes(array('node_id'=>$node_id)); $nodegroup_ids = $nodes[0]['nodegroup_ids']; $nodegroups = $adm->GetNodeGroups($nodegroup_ids); foreach ($nodegroups as $nodegroup) { - echo "# in nodegroup " . $nodegroup['name'] . "\n" ; + $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__; + + } +} + ?> -- 2.43.0