Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/perl5/vendor_perl/Ocsinventory/Agent/Backend/OS/Generic/Packaging/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/perl5/vendor_perl/Ocsinventory/Agent/Backend/OS/Generic/Packaging/ByHand.pm
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;

Hry