Subversion Repositories camp_sysinfo_client_3

Rev

Rev 2 | Rev 11 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#! /usr/bin/perl -w

# 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;