1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
package Ocsinventory::Agent::Backend::OS::Generic::Packaging::ByHand;
#How does it work ?
#
#Create a directory called software in place where you have your
#"modules.conf" file.
#Put your scripts in this directory.
#The scripts have to write on the STDIO with the following format :
#publisher#software#version#comment
#
use strict;
use warnings;
sub check {
return(1);
1;
}
sub run()
{
my $params = shift;
my $common = $params->{common};
my $ligne;
my $soft;
my $comm;
my $version;
my $file;
my $vendor;
my $commentaire;
my @dots;
#if (!$file || !-d $file) {
foreach (@{$common->{config}{etcdir}}) {
$file = $_.'/softwares';
last if -d $file;
}
#}
my $logger = $params->{logger};
if ( opendir(my $dh, $file) )
{
@dots = readdir($dh);
foreach (@dots) {
if ( -f $file."/".$_ )
{
$comm = $file."/".$_;
$logger->debug("Running appli detection scripts from ".$comm);
foreach (`$comm`)
{
$ligne = $_;
chomp($ligne);
($vendor,$soft,$version,$commentaire) = split(/\#/,$ligne);
$common->addSoftware ({
'PUBLISHER' => $vendor,
'NAME' => $soft,
'VERSION' => $version,
'FILESIZE' => "",
'COMMENTS' => $commentaire,
'FROM' => 'ByHand'
});
}
}
}
closedir $dh;
}
1;
}
1;
|