Subversion Repositories camp_sysinfo_client_3

Rev

Rev 244 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#!/usr/bin/env perl
use warnings;
use strict;  

# Description: Get software installed by dpkg or apt(itutde) (Debian)

our $VERSION = '1.2';

# Debian software module for sysinfo client
# Author: R. W. Rodolico
# Date:   2016-04-08

# gets information on software on systems with dpkg on them (Debian)

BEGIN {
   push @INC, shift;
}

use library;

exit 1 unless &getOperatingSystem() =~ m/bsd/i;

my $pkg = &validCommandOnSystem( 'pkg' );

exit 1 unless $pkg;

my $CATEGORY = 'software';

my @packageList  = split( "\n", qx($pkg info));
chomp @packageList;
for ( my $i = 0; $i < @packageList; $i++ ) {
   $packageList[$i] =~ m/^(.+)-([^ ]+)\s+(.*)/;
   print "$CATEGORY\t$1\tversion\t$2\n";
   print "$CATEGORY\t$1\tdescription\t$3\n";
}