FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
lnfo-runTests.php
1 #!/usr/bin/php
2 <?php
3 /***********************************************************
4  Copyright (C) 2008 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  ***********************************************************/
29 /* Check for Super User */
30 $euid = posix_getuid();
31 if($euid != 0) {
32  print "Error, this script must be run as root\n";
33  exit(1);
34 }
35 
36 /* Create sym link to fo-runTests */
37 $OK = array();
38 print "installing fo-runTests into /usr/local/bin\n";
39 $wd = getcwd();
40 $rmCmd = "rm /usr/local/bin/fo-runTests 2>&1";
41 $last = exec($rmCmd, $tossme, $rtn);
42 if($rtn != 0) {
43  $OK = preg_grep('/No such file/', $tossme);
44  if(empty($OK)) {
45  print "Error, could not remove /usr/local/bin/fo-runTests, remove by hand\n";
46  exit(1);
47  }
48 }
49 $cmd = "ln -s $wd/fo-runTests.php /usr/local/bin/fo-runTests 2>&1";
50 $last = exec($cmd, $tossme, $rtn);
51 if($rtn != 0) {
52  print "Error, could not create sym link in /usr/local/bin for fo-runTests\n";
53  exit(1);
54 }
55 exit(0);
56 ?>