--- ocsinventory-client.pl 2009-06-18 16:38:45.069000000 -0500 +++ /tmp/ocsinventory-client.pl 2015-10-01 10:45:07.000000000 -0500 @@ -890,6 +898,91 @@ }; } } + # We need to see if Matlab is installed + my $file = '' ; + my @liclines ; + my $comm = '' ; + my $lic = '' ; + my @dir_search_matlab = ('/usr/local/matlab/','/usr/local/MATLAB/','/usr/local/Matlab','/usr/Matlab/') ; + my $dir = ''; + my @dir_found ; + my @foundfiles; + #Find matlab dirs + foreach $dir (@dir_search_matlab) { + #print "top of foreach dir is: " . $dir . "\n"; + if (-e $dir and -d $dir) { + # print "found dir: " . $dir . "\n"; + push(@dir_found, $dir ) ; + } + } + if ( @dir_found ) { + use File::stat ; + use File::Find ; + find( sub { push @foundfiles, $File::Find::name if ( /\.lic$/ || /^license\.dat$/ ) }, @dir_found ); + } + foreach $file (@foundfiles) { + #print "element of foundfiles is: " .$file . "\n"; + + #Get info about the license file + if (-e $file ) { + @liclines=""; + open(LIC,$file); + @liclines = <LIC>; + close (LIC); + $comm = ""; + foreach $lic (@liclines) { + $comm = $comm . $lic ; + } + + $NAME = $file ; + $VERSION = 'license file' ; + $DATEINSTALLED = stat($file)->ctime ; + $PUBLISHER = 'MathWorks' ; + $COMMENTS = $comm ; + push @values, ($NAME,$VERSION,$DATEINSTALLED,$PUBLISHER,$COMMENTS); + $pushcount = $pushcount + 1; + push @{$request{'CONTENT'}{'SOFTWARES'}}, { + 'NAME' => [ $NAME ], + 'VERSION' => [ $VERSION ], + 'DATEINSTALLED' => [ $DATEINSTALLED ], + 'PUBLISHER' => [ $PUBLISHER ], + 'COMMENTS' => [ $COMMENTS ], + }; + } + } + @foundfiles = () ; + if ( @dir_found ) { + find( sub { push @foundfiles, $File::Find::name if /^toolbox$/ }, @dir_found ); + } + foreach $dir (@foundfiles) { + #print "element of foundfiles is: " .$dir . "\n"; + if (-e $dir and -d $dir) { + opendir(TOOLBOX,$dir); + while ($file = readdir(TOOLBOX) ) { + if ($file ne ".." && $file ne "." && $file ne "shared" && $file ne +"local"){ + if (-e $dir . "/" . $file and -d $dir . "/" . $file) { + $NAME = $dir."/".$file ; + $VERSION = 'toolbox entry' ; + $DATEINSTALLED = stat($dir."/".$file)->ctime ; + $PUBLISHER = 'MathWorks' ; + $COMMENTS = 'toolbox directory entry' ; + push @values, ($NAME,$VERSION,$DATEINSTALLED,$PUBLISHER,$COMMENTS); + $pushcount = $pushcount + 1; + push @{$request{'CONTENT'}{'SOFTWARES'}}, { + 'NAME' => [ $NAME ], + 'VERSION' => [ $VERSION ], + 'DATEINSTALLED' => [ $DATEINSTALLED ], + 'PUBLISHER' => [ $PUBLISHER ], + 'COMMENTS' => [ $COMMENTS ], + }; + } + } + } + closedir(TOOLBOX) ; + } + } + #Checksum #Note that if --xml is used the first time after a change, the #change will only go to xml, we should see it again when another