FOSSology  4.4.0
Open Source License Compliance by Open Source Software
lnfo-runTests.php
1 #!/usr/bin/php
2 <?php
3 /*
4  SPDX-FileCopyrightText: © 2008 Hewlett-Packard Development Company, L.P.
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
18 /* Check for Super User */
19 $euid = posix_getuid();
20 if($euid != 0) {
21  print "Error, this script must be run as root\n";
22  exit(1);
23 }
24 
25 /* Create sym link to fo-runTests */
26 $OK = array();
27 print "installing fo-runTests into /usr/local/bin\n";
28 $wd = getcwd();
29 $rmCmd = "rm /usr/local/bin/fo-runTests 2>&1";
30 $last = exec($rmCmd, $tossme, $rtn);
31 if($rtn != 0) {
32  $OK = preg_grep('/No such file/', $tossme);
33  if(empty($OK)) {
34  print "Error, could not remove /usr/local/bin/fo-runTests, remove by hand\n";
35  exit(1);
36  }
37 }
38 $cmd = "ln -s $wd/fo-runTests.php /usr/local/bin/fo-runTests 2>&1";
39 $last = exec($cmd, $tossme, $rtn);
40 if($rtn != 0) {
41  print "Error, could not create sym link in /usr/local/bin for fo-runTests\n";
42  exit(1);
43 }
44 exit(0);