yum to use http to fetch myplc rpms as they are GPG checked anyway
[nodeimage.git] / nodeconfig / yum / myplc.repo.php
1 <?php
2 //
3 // part of yum config on nodes
4 //
5 // Thierry Parmentelat 
6 // Copyright (C) 2008 INRIA
7 //
8 // $Id$
9 // $URL$
10 //
11
12 // For PLC_NAME and PLC_BOOT_HOST
13 include('plc_config.php');
14
15 $PLC_NAME = PLC_NAME;
16 $PLC_BOOT_HOST = PLC_BOOT_HOST;
17
18 // Get admin API handle
19 require_once 'plc_api.php';
20 global $adm;
21
22 if (isset($_REQUEST['gpgcheck'])) {
23   $gpgcheck = $_REQUEST['gpgcheck'];
24 } else {
25   $gpgcheck = 0;
26 }
27
28 echo "# Generated by myplc.repo.php\n";
29 echo '# $Id$' . "\n";
30 echo '# $URL$' . "\n";
31 # we assume the node is not so old that it would not send node_id
32 # get node family
33 if ( ! isset($_REQUEST['node_id'])) {
34   echo "# node_id is needed\n";
35   echo "# looks like you're running a very old NodeManager...\n";
36   echo "# bailing out..\n";
37   exit;
38  }
39
40 $node_id = intval($_REQUEST['node_id']);
41 $nodeflavour=$adm->GetNodeFlavour($node_id);
42 $nodefamily=$nodeflavour['nodefamily'];
43
44 $topdir=$_SERVER['DOCUMENT_ROOT'] . "/install-rpms/" . $nodefamily;
45 # Thierry : starting with fedora 12, yum complains about not being able to 
46 # verify the certificates; as we're using gpgcheck on top of the rest, 
47 # it's safe to use http only
48 $topurl="http://$PLC_BOOT_HOST" . "/install-rpms/" . $nodefamily;
49
50 if ( is_dir (realpath($topdir))) {
51   echo "# This directory was checked to exist on the server-side\n";
52 } else{
53   echo "# WARNING: plc-side yum repo $topdir NOT FOUND !!\n";
54 }
55
56 $repo_id=$nodefamily;
57 $repo_name="$PLC_NAME $nodefamily";
58 echo <<< __PLC_REPO__
59 [$repo_id]
60 name=$repo_name
61 baseurl=$topurl
62 gpgcheck=$gpgcheck
63
64 __PLC_REPO__;
65
66 ?>