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;
2 rodolico 3
 
20 rodolico 4
$main::VERSION = '1.0';
5
 
6
# Debian software module for sysinfo client
7
# Author: R. W. Rodolico
8
# Date:   2016-04-08
9
 
2 rodolico 10
# gets information on software on systems with dpkg on them (Debian)
11
 
12
BEGIN {
13
   push @INC, shift;
14
}
15
 
16
use library;
17
 
18
my $dpkg = &validCommandOnSystem( 'dpkg' );
19
my $grep = &validCommandOnSystem( 'grep' );
20
 
21
exit 1 unless $dpkg && $grep;
22
 
23
my $CATEGORY = 'software';
24
 
25
my @packageList  = split( "\n", qx($dpkg -l | $grep ^i));
26
chomp @packageList;
27
for ( $i = 0; $i < @packageList; $i++ ) {
28
   my ($status,$package, $version, @description) = split ' ', $packageList[$i];
29
   print "$CATEGORY\t$package\tversion\t$version\n";
30
   print "$CATEGORY\t$package\tdescription\t" . join(" ", @description) . "\n";
31
}