Subversion Repositories camp_sysinfo_client_3

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
 
11
my $CATEGORY = 'software';
12
my $pakfireInstallInfo = '/opt/pakfire/db/installed';
13
my $updates = 'meta-core-upgrade-' . `cat /opt/pakfire/db/core/mine`;
14
chomp $updates;
15
 
16
opendir( my $installsDir, $pakfireInstallInfo ) or die "could not open pakFire installs dir $pakfireInstallInfo: $!\n";
17
my @files = grep { ! /^\./ && -f "$pakfireInstallInfo/$_" } readdir( $installsDir );
18
closedir $installsDir;
19
 
20
foreach my $thisPackage ( @files ) {
21
   next if $thisPackage =~ m/meta-core-upgrade/ && $thisPackage ne $updates;
22
   open PACKAGE, "<$pakfireInstallInfo/$thisPackage" or die "could not open package file $pakfireInstallInfo/$thisPackage: $!\n";
23
   my %packageInfo;
24
   while ( $line = <PACKAGE> ) {
25
      next unless $line =~ m/:/;
26
      chomp $line;
27
      my ( $key, $value ) = split( ':', $line );
28
      $packageInfo{$key} = $value;
29
   }
30
   print "$CATEGORY\t$packageInfo{'Name'}\tversion\t$packageInfo{'ProgVersion'}\n";
31
   print "$CATEGORY\t$packageInfo{'Name'}\trelease\t$packageInfo{'Release'}\n";
32
}
33
1;