Rev 11 | Rev 26 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!/usr/bin/env perl
use warnings;
$main::VERSION = '1.0';
# IPFire 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 unless -d '/opt/pakfire';
my $CATEGORY = 'software';
my $pakfireInstallInfo = '/opt/pakfire/db/installed';
my $updates = 'meta-core-upgrade-' . `cat /opt/pakfire/db/core/mine`;
chomp $updates;
opendir( my $installsDir, $pakfireInstallInfo ) or die "could not open pakFire installs dir $pakfireInstallInfo: $!\n";
my @files = grep { ! /^\./ && -f "$pakfireInstallInfo/$_" } readdir( $installsDir );
closedir $installsDir;
foreach my $thisPackage ( @files ) {
next if $thisPackage =~ m/meta-core-upgrade/ && $thisPackage ne $updates;
open PACKAGE, "<$pakfireInstallInfo/$thisPackage" or die "could not open package file $pakfireInstallInfo/$thisPackage: $!\n";
my %packageInfo;
while ( $line = <PACKAGE> ) {
next unless $line =~ m/:/;
chomp $line;
my ( $key, $value ) = split( ':', $line );
$packageInfo{$key} = $value;
}
print "$CATEGORY\t$packageInfo{'Name'}\tversion\t$packageInfo{'ProgVersion'}\n";
print "$CATEGORY\t$packageInfo{'Name'}\trelease\t$packageInfo{'Release'}\n";
}
1;