From 4d6c997a1b315481be11727e947f22ff4021b2b1 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 26 Sep 2008 08:50:29 +0000 Subject: [PATCH] merged yum config logic from 4.2, and added support for f9 and centos5 --- PlanetLabConf/centos5/yum.conf | 22 +++ .../centos5/yum.myplc.d/CentOS-Base.repo.in | 62 ++++++++ .../centos5/yum.myplc.d/epel.repo.in | 29 ++++ PlanetLabConf/f8/yum.conf | 10 ++ .../f8/yum.myplc.d/fedora-updates.repo.in | 59 ++++++++ PlanetLabConf/f8/yum.myplc.d/fedora.repo.in | 29 ++++ PlanetLabConf/f9 | 1 + PlanetLabConf/myplc.repo.php | 101 +++++++++++++ PlanetLabConf/yum.conf.php | 135 ------------------ 9 files changed, 313 insertions(+), 135 deletions(-) create mode 100644 PlanetLabConf/centos5/yum.conf create mode 100644 PlanetLabConf/centos5/yum.myplc.d/CentOS-Base.repo.in create mode 100644 PlanetLabConf/centos5/yum.myplc.d/epel.repo.in create mode 100644 PlanetLabConf/f8/yum.conf create mode 100644 PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo.in create mode 100644 PlanetLabConf/f8/yum.myplc.d/fedora.repo.in create mode 120000 PlanetLabConf/f9 create mode 100644 PlanetLabConf/myplc.repo.php delete mode 100755 PlanetLabConf/yum.conf.php diff --git a/PlanetLabConf/centos5/yum.conf b/PlanetLabConf/centos5/yum.conf new file mode 100644 index 0000000..bfff95d --- /dev/null +++ b/PlanetLabConf/centos5/yum.conf @@ -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 index 0000000..b7b4f5c --- /dev/null +++ b/PlanetLabConf/centos5/yum.myplc.d/CentOS-Base.repo.in @@ -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 index 0000000..98bc984 --- /dev/null +++ b/PlanetLabConf/centos5/yum.myplc.d/epel.repo.in @@ -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 index 0000000..13046c8 --- /dev/null +++ b/PlanetLabConf/f8/yum.conf @@ -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 index 0000000..a04d45b --- /dev/null +++ b/PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo.in @@ -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 index 0000000..f7b37c6 --- /dev/null +++ b/PlanetLabConf/f8/yum.myplc.d/fedora.repo.in @@ -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 index 0000000..8d1095b --- /dev/null +++ b/PlanetLabConf/f9 @@ -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 index 0000000..492e2fb --- /dev/null +++ b/PlanetLabConf/myplc.repo.php @@ -0,0 +1,101 @@ +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 index 9eaf430..0000000 --- a/PlanetLabConf/yum.conf.php +++ /dev/null @@ -1,135 +0,0 @@ - -// 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 << -- 2.43.0