Subversion Repositories camp_sysinfo_client_3

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 rodolico 1
#!/usr/bin/env perl
2
use warnings;
26 rodolico 3
use strict;  
2 rodolico 4
 
37 rodolico 5
# Description: Get software installed by dpkg or apt(itutde) (Debian)
20 rodolico 6
 
37 rodolico 7
our $VERSION = '1.2';
8
 
20 rodolico 9
# Debian software module for sysinfo client
10
# Author: R. W. Rodolico
11
# Date:   2016-04-08
12
 
2 rodolico 13
# gets information on software on systems with dpkg on them (Debian)
14
 
15
BEGIN {
16
   push @INC, shift;
17
}
18
 
19
use library;
20
 
21
my $dpkg = &validCommandOnSystem( 'dpkg' );
22
my $grep = &validCommandOnSystem( 'grep' );
23
 
24
exit 1 unless $dpkg && $grep;
25
 
26
my $CATEGORY = 'software';
27
 
28
my @packageList  = split( "\n", qx($dpkg -l | $grep ^i));
29
chomp @packageList;
28 rodolico 30
for ( my $i = 0; $i < @packageList; $i++ ) {
2 rodolico 31
   my ($status,$package, $version, @description) = split ' ', $packageList[$i];
32
   print "$CATEGORY\t$package\tversion\t$version\n";
33
   print "$CATEGORY\t$package\tdescription\t" . join(" ", @description) . "\n";
34
}