From 0b0990f5d335933568c9b8ccd1724f88211b61ae Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 1 Apr 2010 14:51:04 +0000 Subject: [PATCH] scaffolding multi-fcdistro yum config --- bootstrapfs.spec | 16 +++--- db-config.d/030-conf_files_node_update | 6 +-- nodeconfig/yum/stock.repo.php | 69 ++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 nodeconfig/yum/stock.repo.php diff --git a/bootstrapfs.spec b/bootstrapfs.spec index b7f4611..44ae655 100644 --- a/bootstrapfs.spec +++ b/bootstrapfs.spec @@ -113,12 +113,16 @@ popd # and let the php scripts do the right thing pushd BootstrapFS echo "* Installing MyPLC-side nodes yum config utilities" -# expose (fixed) myplc.repo.php as https:///yum/myplc.repo.php -install -D -m 644 ./nodeconfig/yum/myplc.repo.php $RPM_BUILD_ROOT/var/www/html/yum/myplc.repo.php -# expose the fcdistro-dependant yum.conf as https:///yum/yum.conf -install -D -m 644 ./nodeconfig/yum/%{distroname}/yum.conf $RPM_BUILD_ROOT/var/www/html/yum/yum.conf -# expose the (fcdistro-dependant) stock.repo as https:///yum/stock.repo -install -D -m 644 ./nodeconfig/yum/%{distroname}/yum.myplc.d/stock.repo $RPM_BUILD_ROOT/var/www/html/yum/stock.repo +echo "* Multi-fcdistro yum stuff" +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 # Install initscripts echo "* Installing plc.d initscripts" diff --git a/db-config.d/030-conf_files_node_update b/db-config.d/030-conf_files_node_update index d3d9434..fc3c5a6 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/myplc.repo.php?gpgcheck=1', + 'source': 'yum.legacy/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/yum.conf', + 'source': 'yum.legacy/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/stock.repo', + 'source': 'yum.legacy/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/stock.repo.php b/nodeconfig/yum/stock.repo.php new file mode 100644 index 0000000..fa73cad --- /dev/null +++ b/nodeconfig/yum/stock.repo.php @@ -0,0 +1,69 @@ +GetNodeFlavour($node_id); +$nodefcdistro=$nodeflavour['fcdistro']; + +# 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"; + +$fc_contents=file_get_contents($fc_name); +if ($fc_contents) { + echo "# retrieved " . $fc_name . "\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 "# " . $fc_name . "\n"; +echo "# " . $fb_name . "\n"; +echo "# bailing out"; + + + + -- 2.43.0