26 $usage =
"$argv[0], -h -o -s <srcpath>
28 -o: overwrite existing config file
29 -s: path to alternate source\n";
31 $configFile =
'TestEnvironment.php';
34 $options = getopt(
'hos:');
36 if (array_key_exists(
'h', $options)) {
40 if (array_key_exists(
'o', $options)) {
43 if (array_key_exists(
's', $options)) {
44 $sourcePath = $options[
's'];
50 echo
"overwritting file\n";
51 $cconfig = callConfig();
58 if(file_exists($configFile))
60 echo
"file exists, exiting\n";
65 echo
"file does not exist, creating...\n";
66 $exists = callConfig();
83 function callConfig($sourcePath=NULL)
87 if(empty($sourcePath))
93 $last = exec(
'hostname -f', $out, $rtn);
96 echo
"Fatal, could not get fully qalified hostname, cannot create config file.\n";
102 $fossology =
'http://' . $last .
'/repo/';
106 $cmd = $sourcePath .
"/configTestEnv.php $fossology $user $pw 2>&1";
107 $lastConfig = exec($cmd, $configOut, $rtn);
111 echo
"Fatal, configTestEnv failed!, Error was:\n$lastConfig\n";
112 print_r($configOut) .
"\n";