2 |
rodolico |
1 |
#! /usr/bin/perl -w
|
|
|
2 |
|
|
|
3 |
# gets information on software on systems with dpkg on them (Debian)
|
|
|
4 |
|
|
|
5 |
BEGIN {
|
|
|
6 |
push @INC, shift;
|
|
|
7 |
}
|
|
|
8 |
|
|
|
9 |
use library;
|
|
|
10 |
|
7 |
rodolico |
11 |
exit unless -d '/opt/pakfire';
|
2 |
rodolico |
12 |
my $CATEGORY = 'software';
|
|
|
13 |
my $pakfireInstallInfo = '/opt/pakfire/db/installed';
|
|
|
14 |
my $updates = 'meta-core-upgrade-' . `cat /opt/pakfire/db/core/mine`;
|
|
|
15 |
chomp $updates;
|
|
|
16 |
|
|
|
17 |
opendir( my $installsDir, $pakfireInstallInfo ) or die "could not open pakFire installs dir $pakfireInstallInfo: $!\n";
|
|
|
18 |
my @files = grep { ! /^\./ && -f "$pakfireInstallInfo/$_" } readdir( $installsDir );
|
|
|
19 |
closedir $installsDir;
|
|
|
20 |
|
|
|
21 |
foreach my $thisPackage ( @files ) {
|
|
|
22 |
next if $thisPackage =~ m/meta-core-upgrade/ && $thisPackage ne $updates;
|
|
|
23 |
open PACKAGE, "<$pakfireInstallInfo/$thisPackage" or die "could not open package file $pakfireInstallInfo/$thisPackage: $!\n";
|
|
|
24 |
my %packageInfo;
|
|
|
25 |
while ( $line = <PACKAGE> ) {
|
|
|
26 |
next unless $line =~ m/:/;
|
|
|
27 |
chomp $line;
|
|
|
28 |
my ( $key, $value ) = split( ':', $line );
|
|
|
29 |
$packageInfo{$key} = $value;
|
|
|
30 |
}
|
|
|
31 |
print "$CATEGORY\t$packageInfo{'Name'}\tversion\t$packageInfo{'ProgVersion'}\n";
|
|
|
32 |
print "$CATEGORY\t$packageInfo{'Name'}\trelease\t$packageInfo{'Release'}\n";
|
|
|
33 |
}
|
|
|
34 |
1;
|