36 $euid = posix_getuid();
38 print
"Error, this script must be run as root\n";
49 function installST() {
51 if (is_readable(
'/etc/fossology/Proxy.conf')) {
52 print
"Using proxy found in file /etc/fossology/Proxy.conf\n";
53 $cmd =
". /etc/fossology/Proxy.conf;" .
54 "wget -nv -t 1 'http://downloads.sourceforge.net/simpletest/simpletest_1.0.1.tar.gz'";
56 else if (is_readable(
'/usr/local/etc/fossology/Proxy.conf')) {
57 print
"Using proxy found in file /usr/local/etc/fossology/Proxy.conf\n";
58 $cmd =
". /usr/local/etc/fossology/Proxy.conf;" .
59 "wget -nv -t 1 'http://downloads.sourceforge.net/simpletest/simpletest_1.0.1.tar.gz'";
62 print
"No proxy used when attempting to download simpletest\n";
63 $cmd =
"wget -nv -t 1 'http://downloads.sourceforge.net/simpletest/simpletest_1.0.1.tar.gz'";
65 if(chdir(
'/usr/local/')) {
66 $wLast = exec($cmd, $wgetOut, $rtn);
68 $tar =
'tar -xf simpletest_1.0.1.tar.gz';
69 $tLast = exec($tar, $tout, $rtn);
70 if(is_readable(
'/usr/local/simpletest')) {
72 $rl = exec(
'rm simpletest_1.0.1.tar.gz', $toss, $notchecked);
77 print
"ERROR! failed to un-tar simpletest into /usr/local\n";
78 print
"tar output was:$tLast\n";print_r($tout) .
"\n";
79 print
"Investigate and install simpletest into /usr/local then rerun this script\n";
84 print
"ERROR! problem with downloading simpletest with wget, need a proxy?\n";
85 print
"wget output was:$wLast\n";print_r($wgetOut) .
"\n";
86 print
"Investigate and install simpletest into /usr/local then rerun this script\n";
91 print
"ERROR! cannot cd to /usr/local\n";
92 print
"Investigate and install simpletest into /usr/local then rerun this script\n";
103 print
"installing fo-runTests into /usr/local/bin\n";
105 $cmd =
"ln -s $wd/fo-runTests.php /usr/local/bin/fo-runTests 2>&1";
106 $last = exec($cmd, $tossme, $rtn);
108 $OK = preg_grep(
'/File exists/', $tossme);
110 print
"Error, could not create sym link in /usr/local/bin for fo-runTests\n";
114 $rm =
'rm /usr/local/bin/fo-runTests';
115 $last = exec($rm, $tossme, $rtn);
117 print
"Error, could not remove /usr/local/bin/fo-runTests\n";
118 print
"Remove by hand and remake the symbolic link to the appropriate test source\n";
121 $last = exec($cmd, $tossme, $rtn);
123 print
"Error, could not create sym link in /usr/local/bin for fo-runTests\n";
124 print
"Investigate and remake the symbolic link to the appropriate test source\n";
131 print
"Check to see if simpletest is installed in /usr/local\n";
133 if(!is_readable(
'/usr/local/simpletest')) {
134 print
"Attempting to download and install simpletest into /usr/local\n";
137 print
"FATAL ERROR!, install simpletest into /usr/local, then rerun this script\n";
145 if(!is_executable(
"./makeDbUser")) {
146 if(!chmod(
"./makeDbUser",0755)) {
147 print
"FATAL, could not make ./makeDbUser executable\n";
151 $last = exec(
"./makeDbUser",$tossme, $rtn);
153 print
"makeDbUser Failed, Investigate, run by hand\n";
156 print
"Creating fosstester and noemail users\n";
157 if(!is_executable(
"./CreateTestUser.sh")) {
158 if(!chmod(
"./CreateTestUser.sh",0755)) {
159 print
"FATAL, could not make ./CreateTestUser.sh executable\n";
163 $last = exec(
"./CreateTestUser.sh",$tossme, $rtn);
165 print
"CreateTestUser.sh Failed, Investigate, run by hand\n";
169 print
"loading test data into the fosstester home directory\n";
170 $last = exec(
"./installTestData.sh",$tossme, $rtn);
172 foreach($tossme as $line){
177 print
"adjusting servers file in .subversion so checkouts work\n";
178 if(chdir(
'/home/fosstester/.subversion') === TRUE) {
179 if(!copy(
'servers.hp',
'servers')) {
180 print
"Warning! could not adjust servers file, may not be able to check out sources\n";
184 if(chdir($Tconfig) === FALSE){
185 print
"Warning! cannot cd to $Tconfig, the next steps may fail\n";
190 print
"Creating UI test users fosstester and noemail\n";
192 $last = exec(
"./configTestEnv.php 'http://localhost/repo/' fossy fossy",$tossme, $rtn);
194 print
"./configTestEnv.php Failed for fossy, Investigate\n";
196 $last = exec(
"./fo-runTests.php -l 'createUIUsers.php'",$tossme, $rtn);
198 print
"./createUIUsers Failed!, Investigate\n";
200 $last = exec(
"./configTestEnv.php 'http://localhost/repo/' fosstester fosstester",$tossme, $rtn);
202 print
"./configTestEnv.php Failed for fosstester, Investigate\n";
207 echo
"Removing fo-runtests link in /usr/local/bin/\n";
208 $last = exec(
'sudo rm /usr/local/bin/fo-runTests', $tossme, $rtn);
209 echo
"Creating fo-runtests link in /usr/local/bin/\n";
210 $last = exec(
"ln -s fo-runtests.php /usr/local/bin/fo-runtests",$tossme, $rtn);
212 print
"FATAL! Could create fo-runtests link, Investigate and create by hand\n";