FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
createRC.php
1 File Edit Options Buffers Tools Help
2 <?php
3 /*
4  Copyright (C) 2011 Hewlett-Packard Development Company, L.P.
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License
8  version 2 as published by the Free Software Foundation.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
28 function createRC()
29 {
30 // first try the environment
31 // second look for a source install
32 // third look for a package install
33 // give up and error out.
34 
35 // @todo who uses the rc file?
36 
37 $sysconf = NULL;
38 
39 $sysconf = getenv('SYSCONFDIR');
40 if($sysconf === FALSE)
41 {
42  if(file_exists('/usr/local/etc/fossology'))
43  {
44  $sysconf = '/usr/local/etc/fossology';
45  }
46  else if(file_exists('/etc/fossology'))
47  {
48  $sysconf = '/etc/fossology';
49  }
50 }
51 if($sysconf === FALSE || $sysconf == NULL)
52 {
53  echo "FATAL! cannot determine where the fossology sysconfigdir is located\n";
54  exit(1);
55 }
56 $RC = fopen("fossology.rc", 'w');
57 if($RC === FALSE)
58 {
59  echo "FATAL! could not open fossology.rc for writting\n";
60  exit(1);
61 }
62 $many = fwrite($RC, $sysconf);
63 fclose($RC);
64 
65 // put in globals and export to environment.
66 //echo "DBCRC: sysconf is:$sysconf\n";
67 $GLOBALS['SYSCONFDIR'] = $sysconf;
68 putenv("SYSCONFDIR={$GLOBALS['SYSCONFDIR']}");
69 $_ENV['SYSCONFDIR'] = $GLOBALS['SYSCONFDIR'];
70 }
71 ?>
72 
Definition: monk.h:72