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