merged yum config logic from 4.2, and added support for f9 and centos5
Thierry Parmentelat [Fri, 26 Sep 2008 08:50:29 +0000 (08:50 +0000)]
PlanetLabConf/centos5/yum.conf [new file with mode: 0644]
PlanetLabConf/centos5/yum.myplc.d/CentOS-Base.repo.in [new file with mode: 0644]
PlanetLabConf/centos5/yum.myplc.d/epel.repo.in [new file with mode: 0644]
PlanetLabConf/f8/yum.conf [new file with mode: 0644]
PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo.in [new file with mode: 0644]
PlanetLabConf/f8/yum.myplc.d/fedora.repo.in [new file with mode: 0644]
PlanetLabConf/f9 [new symlink]
PlanetLabConf/myplc.repo.php [new file with mode: 0644]
PlanetLabConf/yum.conf.php [deleted file]

diff --git a/PlanetLabConf/centos5/yum.conf b/PlanetLabConf/centos5/yum.conf
new file mode 100644 (file)
index 0000000..bfff95d
--- /dev/null
@@ -0,0 +1,22 @@
+[main]
+reposdir=/etc/yum.myplc.d
+pkgpolicy=newest
+exactarch=0
+keepcache=0
+cachedir=/var/cache/yum
+debuglevel=1
+logfile=/var/log/yum.log
+distroverpkg=redhat-release
+tolerant=1
+obsoletes=1
+gpgcheck=1
+plugins=0
+
+# Note: yum-RHN-plugin doesn't honor this.
+metadata_expire=1h
+
+# Default.
+# installonly_limit = 3
+
+# PUT YOUR REPOS HERE OR IN separate files named file.repo
+# in /etc/yum.repos.d
diff --git a/PlanetLabConf/centos5/yum.myplc.d/CentOS-Base.repo.in b/PlanetLabConf/centos5/yum.myplc.d/CentOS-Base.repo.in
new file mode 100644 (file)
index 0000000..b7b4f5c
--- /dev/null
@@ -0,0 +1,62 @@
+# CentOS-Base.repo
+#
+# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
+# The mirror system uses the connecting IP address of the client and the
+# update status of each mirror to pick mirrors that are updated to and
+# geographically close to the client.  You should use this for CentOS updates
+# unless you are manually picking other mirrors.
+#
+# If the mirrorlist= does not work for you, as a fall back you can try the 
+# remarked out baseurl= line instead.
+#
+#
+
+[base]
+name=CentOS-$releasever - Base
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
+#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
+@EXCLUDE@
+gpgcheck=1
+enabled=1
+gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
+
+#released updates 
+[updates]
+name=CentOS-$releasever - Updates
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
+#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
+@EXCLUDE@
+gpgcheck=1
+enabled=1
+gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
+
+#packages used/produced in the build but not released
+[addons]
+name=CentOS-$releasever - Addons
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
+#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
+@EXCLUDE@
+gpgcheck=1
+enabled=0
+gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
+
+#additional packages that may be useful
+[extras]
+name=CentOS-$releasever - Extras
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
+#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
+@EXCLUDE@
+gpgcheck=1
+enabled=0
+gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
+
+#additional packages that extend functionality of existing packages
+[centosplus]
+name=CentOS-$releasever - Plus
+mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
+#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
+@EXCLUDE@
+gpgcheck=1
+enabled=0
+gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
+
diff --git a/PlanetLabConf/centos5/yum.myplc.d/epel.repo.in b/PlanetLabConf/centos5/yum.myplc.d/epel.repo.in
new file mode 100644 (file)
index 0000000..98bc984
--- /dev/null
@@ -0,0 +1,29 @@
+[epel]
+name=Extra Packages for Enterprise Linux 5 - $basearch
+#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
+failovermethod=priority
+@EXCLUDE@
+enabled=1
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
+
+[epel-debuginfo]
+name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
+#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
+failovermethod=priority
+@EXCLUDE@
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
+gpgcheck=1
+
+[epel-source]
+name=Extra Packages for Enterprise Linux 5 - $basearch - Source
+#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
+failovermethod=priority
+@EXCLUDE@
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
+gpgcheck=1
diff --git a/PlanetLabConf/f8/yum.conf b/PlanetLabConf/f8/yum.conf
new file mode 100644 (file)
index 0000000..13046c8
--- /dev/null
@@ -0,0 +1,10 @@
+[main]
+reposdir=/etc/yum.myplc.d
+cachedir=/var/cache/yum
+debuglevel=1
+logfile=/var/log/yum.log
+lockfile=/var/lock/yum.pid
+pkgpolicy=newest
+distroverpkg=fedora-release
+installonlypkgs=
+exactarch=0
diff --git a/PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo.in b/PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo.in
new file mode 100644 (file)
index 0000000..a04d45b
--- /dev/null
@@ -0,0 +1,59 @@
+[updates]
+name=Fedora $releasever - $basearch - Updates
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch
+@EXCLUDE@
+enabled=1
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
+
+[updates-debuginfo]
+name=Fedora $releasever - $basearch - Updates - Debug
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/debug/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-f$releasever&arch=$basearch
+@EXCLUDE@
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
+
+[updates-source]
+name=Fedora $releasever - Updates Source
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/SRPMS/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$releasever&arch=$basearch
+@EXCLUDE@
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
+
+[updates-newkey]
+name=Fedora $releasever - $basearch - Updates Newkey
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch.newkey/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever.newkey&arch=$basearch
+@EXCLUDE@
+enabled=1
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-8-and-9
+
+[updates-newkey-debuginfo]
+name=Fedora $releasever - $basearch - Updates - Debug Newkey
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch.newkey/debug/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-f$releasever.newkey&arch=$basearch
+@EXCLUDE@
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-8-and-9
+
+[updates-newkey-source]
+name=Fedora $releasever - Updates Source Newkey
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/SRPMS.newkey/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$releasever.newkey&arch=$basearch
+@EXCLUDE@
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-8-and-9
diff --git a/PlanetLabConf/f8/yum.myplc.d/fedora.repo.in b/PlanetLabConf/f8/yum.myplc.d/fedora.repo.in
new file mode 100644 (file)
index 0000000..f7b37c6
--- /dev/null
@@ -0,0 +1,29 @@
+[fedora]
+name=Fedora $releasever - $basearch
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
+@EXCLUDE@
+enabled=1
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
+
+[fedora-debuginfo]
+name=Fedora $releasever - $basearch - Debug
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch
+@EXCLUDE@
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
+
+[fedora-source]
+name=Fedora $releasever - Source
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch
+@EXCLUDE@
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
diff --git a/PlanetLabConf/f9 b/PlanetLabConf/f9
new file mode 120000 (symlink)
index 0000000..8d1095b
--- /dev/null
@@ -0,0 +1 @@
+f8
\ No newline at end of file
diff --git a/PlanetLabConf/myplc.repo.php b/PlanetLabConf/myplc.repo.php
new file mode 100644 (file)
index 0000000..492e2fb
--- /dev/null
@@ -0,0 +1,101 @@
+<?php
+//
+// part of yum config on nodes
+//
+// Thierry Parmentelat 
+// Copyright (C) 2008 INRIA
+//
+// $Id: myplc.repo.php 9818 2008-07-04 07:54:06Z 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");
+  # don't define the repo in this case
+  exit;
+ }
+
+list( $id, $dir, $name) = $repo;
+
+echo <<< __PLC_REPO__
+[$id]
+name=$name
+baseurl=$topurl/$dir
+gpgcheck=$gpgcheck
+
+__PLC_REPO__;
+
+?>
diff --git a/PlanetLabConf/yum.conf.php b/PlanetLabConf/yum.conf.php
deleted file mode 100755 (executable)
index 9eaf430..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-<?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;
-
-$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;
-}
-
-// 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;
-}
-
-// Requesting yum.conf. See above for the mirrorlist definition.
-echo <<<EOF
-[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=iptables kernel kernel kernel-devel kernel-smp kernel-smp-devel kernel-xen0 kernel-xen0-devel kernel-xenU kernel-xenU-devel mysql ulogd
-
-[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=iptables kernel kernel kernel-devel kernel-smp kernel-smp-devel kernel-xen0 kernel-xen0-devel kernel-xenU kernel-xenU-devel mysql ulogd
-
-EOF;
-
-// Figure out which repositories we actually have on this
-// machine. MyPLC installations, for instance, generally only have
-// PlanetLab RPMS installed.
-foreach ($repos as $repo) {
-  $id = $repo[0];
-  $name = $repo[1] . " -- " . "$PLC_NAME Central";
-  $dir = "/install-rpms/" . $repo[2];
-  $baseurl = "https://$PLC_BOOT_HOST" . $dir . "/";
-
-  if (is_dir(realpath($_SERVER['DOCUMENT_ROOT'] . $dir))) {
-    echo <<<EOF
-[$id]
-name=$name
-baseurl=$baseurl
-gpgcheck=$gpgcheck
-
-
-EOF;
-  }
-}
-
-?>