37 $usage =
"$argv[0], -h -o -s <srcpath> 39 -o: overwrite existing config file 40 -s: path to alternate source\n";
42 $configFile =
'TestEnvironment.php';
45 $options = getopt(
'hos:');
47 if (array_key_exists(
'h', $options)) {
51 if (array_key_exists(
'o', $options)) {
54 if (array_key_exists(
's', $options)) {
55 $sourcePath = $options[
's'];
61 echo
"overwritting file\n";
62 $cconfig = callConfig();
69 if(file_exists($configFile))
71 echo
"file exists, exiting\n";
76 echo
"file does not exist, creating...\n";
77 $exists = callConfig();
94 function callConfig($sourcePath=NULL)
98 if(empty($sourcePath))
104 $last = exec(
'hostname -f', $out, $rtn);
107 echo
"Fatal, could not get fully qalified hostname, cannot create config file.\n";
109 print_r($out) .
"\n";
113 $fossology =
'http://' . $last .
'/repo/';
117 $cmd = $sourcePath .
"/configTestEnv.php $fossology $user $pw 2>&1";
118 $lastConfig = exec($cmd, $configOut, $rtn);
122 echo
"Fatal, configTestEnv failed!, Error was:\n$lastConfig\n";
123 print_r($configOut) .
"\n";