Subversion Repositories camp_sysinfo_client_3

Rev

Rev 87 | Details | Compare with Previous | 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
 
233 rodolico 5
use utf8;                                # Source code encoded using UTF-8
6
 
37 rodolico 7
# Description: Get software installed by dpkg or apt(itutde) (Debian)
20 rodolico 8
 
37 rodolico 9
our $VERSION = '1.2';
10
 
20 rodolico 11
# Debian software module for sysinfo client
12
# Author: R. W. Rodolico
13
# Date:   2016-04-08
14
 
2 rodolico 15
# gets information on software on systems with dpkg on them (Debian)
16
 
17
BEGIN {
18
   push @INC, shift;
19
}
20
 
21
use library;
22
 
23
my $dpkg = &validCommandOnSystem( 'dpkg' );
24
my $grep = &validCommandOnSystem( 'grep' );
25
 
26
exit 1 unless $dpkg && $grep;
27
 
28
my $CATEGORY = 'software';
29
 
30
my @packageList  = split( "\n", qx($dpkg -l | $grep ^i));
31
chomp @packageList;
233 rodolico 32
 
28 rodolico 33
for ( my $i = 0; $i < @packageList; $i++ ) {
233 rodolico 34
   utf8::encode( $packageList[$i] );
2 rodolico 35
   my ($status,$package, $version, @description) = split ' ', $packageList[$i];
36
   print "$CATEGORY\t$package\tversion\t$version\n";
37
   print "$CATEGORY\t$package\tdescription\t" . join(" ", @description) . "\n";
38
}