From 04045efb32bee5e9cff9bd1027aa53135fa5c915 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 2 Apr 2010 07:54:50 +0000 Subject: [PATCH] multi-fcdistro yum config --- bootstrapfs.spec | 19 +++------- db-config.d/030-conf_files_node_update | 6 ++-- nodeconfig/yum/centos5/yum.conf | 5 +-- .../centos5/yum.myplc.d/CentOS-Base.repo.in | 1 + .../yum/centos5/yum.myplc.d/epel.repo.in | 1 + nodeconfig/yum/f10/yum.conf | 3 ++ .../f10/yum.myplc.d/fedora-updates.repo.in | 1 + nodeconfig/yum/f10/yum.myplc.d/fedora.repo.in | 1 + nodeconfig/yum/f12/yum.conf | 3 ++ .../f12/yum.myplc.d/fedora-updates.repo.in | 1 + nodeconfig/yum/f12/yum.myplc.d/fedora.repo.in | 1 + nodeconfig/yum/f8/yum.conf | 3 ++ .../yum/f8/yum.myplc.d/fedora-updates.repo.in | 1 + nodeconfig/yum/f8/yum.myplc.d/fedora.repo.in | 1 + nodeconfig/yum/{stock.repo.php => yum.php} | 36 +++++++++---------- 15 files changed, 44 insertions(+), 39 deletions(-) rename nodeconfig/yum/{stock.repo.php => yum.php} (56%) diff --git a/bootstrapfs.spec b/bootstrapfs.spec index 9cfd9af..90eca6a 100644 --- a/bootstrapfs.spec +++ b/bootstrapfs.spec @@ -68,6 +68,7 @@ pushd BootstrapFS popd ############################## server-side +# ship all fcdistros for multi-fcdistros myplc, and let the php scripts do the right thing pushd BootstrapFS/nodeconfig/yum # scan fcdistros and catenate all repos in 'stock.repo' so db-config can be distro-independant for fcdistro in $(ls); do @@ -91,7 +92,6 @@ rm -rf $RPM_BUILD_ROOT ############################## node-side pushd BootstrapFS -#arch=$(uname -i) install -D -m 644 bootstrapfs-%{nodefamily}.tar.bz2 \ $RPM_BUILD_ROOT/var/www/html/boot/bootstrapfs-%{nodefamily}.tar.bz2 @@ -108,21 +108,11 @@ done popd ############################## server-side -# xxx unfinished business here -# xxx in a multi-flavour myplc, we should ship for all fcdistros -# and let the php scripts do the right thing +# ship all fcdistros for multi-fcdistros myplc, and let the php scripts do the right thing pushd BootstrapFS -echo "* Installing MyPLC-side nodes yum config utilities" -echo "* Multi-fcdistro yum stuff" +echo "* Installing MyPLC-side nodes yum config utilities (support for multi-fcdistro)" mkdir -p $RPM_BUILD_ROOT/var/www/html/yum/ -rsync -av ./nodeconfig/yum/ $RPM_BUILD_ROOT/var/www/html/yum/ -echo "* Legacy (single fcdistro) yum stuff" -# expose (fixed) myplc.repo.php as https:///yum.legacy/myplc.repo.php -install -D -m 644 ./nodeconfig/yum/myplc.repo.php $RPM_BUILD_ROOT/var/www/html/yum.legacy/myplc.repo.php -# expose the fcdistro-dependant yum.conf as https:///yum.legacy/yum.conf -install -D -m 644 ./nodeconfig/yum/%{distroname}/yum.conf $RPM_BUILD_ROOT/var/www/html/yum.legacy/yum.conf -# expose the (fcdistro-dependant) stock.repo as https:///yum.legacy/stock.repo -install -D -m 644 ./nodeconfig/yum/%{distroname}/yum.myplc.d/stock.repo $RPM_BUILD_ROOT/var/www/html/yum.legacy/stock.repo +rsync -av ./nodeconfig/yum/ $RPM_BUILD_ROOT/var/www/html/yum/ # Install initscripts echo "* Installing plc.d initscripts" @@ -150,7 +140,6 @@ rm -rf $RPM_BUILD_ROOT %files -n nodeyum %defattr(-,root,root,-) /var/www/html/yum -/var/www/html/yum.legacy /etc/planetlab/db-config.d /etc/plc.d diff --git a/db-config.d/030-conf_files_node_update b/db-config.d/030-conf_files_node_update index fc3c5a6..69ebcf4 100644 --- a/db-config.d/030-conf_files_node_update +++ b/db-config.d/030-conf_files_node_update @@ -8,21 +8,21 @@ conf_files = [ # myplc/noderepo # YUM configuration {'enabled': True, - 'source': 'yum.legacy/myplc.repo.php?gpgcheck=1', + 'source': 'yum/myplc.repo.php?gpgcheck=1', 'dest': '/etc/yum.myplc.d/myplc.repo', 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root', 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '', 'ignore_cmd_errors': False, 'always_update': False}, {'enabled': True, - 'source': 'yum.legacy/yum.conf', + 'source': 'yum/yum.php?path=yum.conf', 'dest': '/etc/yum.conf', 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root', 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '', 'ignore_cmd_errors': False, 'always_update': False}, {'enabled': True, - 'source': 'yum.legacy/stock.repo', + 'source': 'yum/yum.php?path=yum.myplc.d/stock.repo', 'dest': '/etc/yum.myplc.d/stock.repo', 'file_permissions': '644', 'file_owner': 'root', 'file_group': 'root', 'preinstall_cmd': '', 'postinstall_cmd': '', 'error_cmd': '', diff --git a/nodeconfig/yum/centos5/yum.conf b/nodeconfig/yum/centos5/yum.conf index bfff95d..3dc1b2a 100644 --- a/nodeconfig/yum/centos5/yum.conf +++ b/nodeconfig/yum/centos5/yum.conf @@ -1,4 +1,7 @@ +# CentOS 5 +# $URL$ [main] +# Overwriting the default yum repos dir reposdir=/etc/yum.myplc.d pkgpolicy=newest exactarch=0 @@ -18,5 +21,3 @@ 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/nodeconfig/yum/centos5/yum.myplc.d/CentOS-Base.repo.in b/nodeconfig/yum/centos5/yum.myplc.d/CentOS-Base.repo.in index be1e9c2..154f207 100644 --- a/nodeconfig/yum/centos5/yum.myplc.d/CentOS-Base.repo.in +++ b/nodeconfig/yum/centos5/yum.myplc.d/CentOS-Base.repo.in @@ -1,3 +1,4 @@ +# $URL # CentOS-Base.repo # # This file uses a new mirrorlist system developed by Lance Davis for CentOS. diff --git a/nodeconfig/yum/centos5/yum.myplc.d/epel.repo.in b/nodeconfig/yum/centos5/yum.myplc.d/epel.repo.in index 1a844c1..cad784c 100644 --- a/nodeconfig/yum/centos5/yum.myplc.d/epel.repo.in +++ b/nodeconfig/yum/centos5/yum.myplc.d/epel.repo.in @@ -1,3 +1,4 @@ +# $URL [epel] name=Extra Packages for Enterprise Linux 5 - $basearch #baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch diff --git a/nodeconfig/yum/f10/yum.conf b/nodeconfig/yum/f10/yum.conf index 13046c8..ab30e9f 100644 --- a/nodeconfig/yum/f10/yum.conf +++ b/nodeconfig/yum/f10/yum.conf @@ -1,4 +1,7 @@ +# Fedora 10 +# $URL$ [main] +# Overwriting the default yum repos dir reposdir=/etc/yum.myplc.d cachedir=/var/cache/yum debuglevel=1 diff --git a/nodeconfig/yum/f10/yum.myplc.d/fedora-updates.repo.in b/nodeconfig/yum/f10/yum.myplc.d/fedora-updates.repo.in index 2323288..6c460c4 100644 --- a/nodeconfig/yum/f10/yum.myplc.d/fedora-updates.repo.in +++ b/nodeconfig/yum/f10/yum.myplc.d/fedora-updates.repo.in @@ -1,3 +1,4 @@ +# $URL [updates] name=Fedora $releasever - $basearch - Updates failovermethod=priority diff --git a/nodeconfig/yum/f10/yum.myplc.d/fedora.repo.in b/nodeconfig/yum/f10/yum.myplc.d/fedora.repo.in index b7cea58..ce95e4b 100644 --- a/nodeconfig/yum/f10/yum.myplc.d/fedora.repo.in +++ b/nodeconfig/yum/f10/yum.myplc.d/fedora.repo.in @@ -1,3 +1,4 @@ +# $URL [fedora] name=Fedora $releasever - $basearch failovermethod=priority diff --git a/nodeconfig/yum/f12/yum.conf b/nodeconfig/yum/f12/yum.conf index 13046c8..5b6d3a6 100644 --- a/nodeconfig/yum/f12/yum.conf +++ b/nodeconfig/yum/f12/yum.conf @@ -1,4 +1,7 @@ +# Fedora 12 +# $URL$ [main] +# Overwriting the default yum repos dir reposdir=/etc/yum.myplc.d cachedir=/var/cache/yum debuglevel=1 diff --git a/nodeconfig/yum/f12/yum.myplc.d/fedora-updates.repo.in b/nodeconfig/yum/f12/yum.myplc.d/fedora-updates.repo.in index 2323288..6c460c4 100644 --- a/nodeconfig/yum/f12/yum.myplc.d/fedora-updates.repo.in +++ b/nodeconfig/yum/f12/yum.myplc.d/fedora-updates.repo.in @@ -1,3 +1,4 @@ +# $URL [updates] name=Fedora $releasever - $basearch - Updates failovermethod=priority diff --git a/nodeconfig/yum/f12/yum.myplc.d/fedora.repo.in b/nodeconfig/yum/f12/yum.myplc.d/fedora.repo.in index b7cea58..ce95e4b 100644 --- a/nodeconfig/yum/f12/yum.myplc.d/fedora.repo.in +++ b/nodeconfig/yum/f12/yum.myplc.d/fedora.repo.in @@ -1,3 +1,4 @@ +# $URL [fedora] name=Fedora $releasever - $basearch failovermethod=priority diff --git a/nodeconfig/yum/f8/yum.conf b/nodeconfig/yum/f8/yum.conf index 13046c8..8e8e63f 100644 --- a/nodeconfig/yum/f8/yum.conf +++ b/nodeconfig/yum/f8/yum.conf @@ -1,4 +1,7 @@ +# Fedora 8 +# $URL$ [main] +# Overwriting the default yum repos dir reposdir=/etc/yum.myplc.d cachedir=/var/cache/yum debuglevel=1 diff --git a/nodeconfig/yum/f8/yum.myplc.d/fedora-updates.repo.in b/nodeconfig/yum/f8/yum.myplc.d/fedora-updates.repo.in index 9f9b7f6..c1cd6e5 100644 --- a/nodeconfig/yum/f8/yum.myplc.d/fedora-updates.repo.in +++ b/nodeconfig/yum/f8/yum.myplc.d/fedora-updates.repo.in @@ -1,3 +1,4 @@ +# $URL [updates] name=Fedora $releasever - $basearch - Updates failovermethod=priority diff --git a/nodeconfig/yum/f8/yum.myplc.d/fedora.repo.in b/nodeconfig/yum/f8/yum.myplc.d/fedora.repo.in index b7cea58..ce95e4b 100644 --- a/nodeconfig/yum/f8/yum.myplc.d/fedora.repo.in +++ b/nodeconfig/yum/f8/yum.myplc.d/fedora.repo.in @@ -1,3 +1,4 @@ +# $URL [fedora] name=Fedora $releasever - $basearch failovermethod=priority diff --git a/nodeconfig/yum/stock.repo.php b/nodeconfig/yum/yum.php similarity index 56% rename from nodeconfig/yum/stock.repo.php rename to nodeconfig/yum/yum.php index fa73cad..81dd1b6 100644 --- a/nodeconfig/yum/stock.repo.php +++ b/nodeconfig/yum/yum.php @@ -25,44 +25,42 @@ if (isset($_REQUEST['gpgcheck'])) { $gpgcheck = 0; } -echo "# Generated by stock.repo.php\n"; +echo "# Generated by yum.php\n"; echo '# $Id$' . "\n"; echo '# $URL$' . "\n"; # we assume the node is not so old that it would not send node_id # get node family if ( ! isset($_REQUEST['node_id'])) { - echo "# node_id is needed\n"; + echo "# yum.php expects node_id to be set\n"; echo "# looks like you're running a very old NodeManager...\n"; echo "# bailing out..\n"; exit; } - $node_id = intval($_REQUEST['node_id']); $nodeflavour=$adm->GetNodeFlavour($node_id); -$nodefcdistro=$nodeflavour['fcdistro']; +$fcdistro=$nodeflavour['fcdistro']; + +if ( ! isset($_REQUEST['path'])) { + echo "# yum.php expect path to be set - bailing out\n"; + exit; + } +$path = $_REQUEST['path']; -# try to open /var/www/html/yum//yum.myplc.d/stock.repo -# otherwise use the static version in -# /var/www/html/yum.legacy/stock.repo -$fc_name="/var/www/html/yum/" . $fcdistro . "/yum.myplc.d/stock.repo"; -$fb_name="/var/www/html/yum.legacy/stock.repo"; +# try to open /var/www/html/yum// +$fc_name="/var/www/html/yum/" . $fcdistro . "/" . $path; $fc_contents=file_get_contents($fc_name); if ($fc_contents) { - echo "# retrieved " . $fc_name . "\n"; + echo "#\n"; + echo "# yum.php has retrieved " . $fc_name . "\n"; + echo "#\n"; print $fc_contents; exit; } -$fb_contents=file_get_contents($fb_name); -if ($fb_contents) { - echo "# retrieved fallback (fcdistro " . $fcdistro " unknown) " . $fb_name . "\n"; - print $fb_contents; - exit; - } -echo "# Could not find any of the following\n"; +echo "#\n"; +echo "# yum.php could not find the following path\n"; echo "# " . $fc_name . "\n"; -echo "# " . $fb_name . "\n"; -echo "# bailing out"; +echo "# bailing out\n"; -- 2.45.2