OSSP CVS Repository

ossp - Check-in [4662]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4662
Date: 2004-Jul-30 11:31:23 (local)
2004-Jul-30 09:31:23 (UTC)
User:thl
Branch:
Comment: support a configurable OpenPKG instance and detect and handle OpenPKG 1.x and 2.x
Tickets:
Inspections:
Files:
ossp-pkg/snmpdx/snmpdx.d/swOp.pm      1.8 -> 1.9     11 inserted, 1 deleted

ossp-pkg/snmpdx/snmpdx.d/swOp.pm 1.8 -> 1.9

--- swOp.pm      2004/07/28 13:37:48     1.8
+++ swOp.pm      2004/07/30 09:31:23     1.9
@@ -35,10 +35,20 @@
 
 sub probe ($$) {
     my ($self, $obj) = @_;
+    my $openpkg = $self->{-ctx}->{-opt}->{openpkg};
+
+    my $rpm;
+    if    ( -x "$openpkg/bin/openpkg" and -x "$openpkg/libexec/openpkg/rpm" ) { #OpenPKG 2.x
+        $rpm="$openpkg/bin/openpkg rpm"
+    }
+    elsif ( -x "$openpkg/bin/rpm" and not -x "$openpkg/libexec/openpkg/rpm" ) { #OpenPKG 1.x
+        $rpm="$openpkg/bin/rpm"
+    }
+    else { return; } #no (known) OpenPKG
 
     #   query details via rpm(1)
     my $out = $self->{-ctx}->{-sys}->run(
-        "openpkg rpm -qa --qf '[%{NAME} %{VERSION} %{RELEASE} %{BUILDTIME} %{INSTALLTIME}\\n]'", "10m");
+        "$rpm -qa --qf '[%{NAME} %{VERSION} %{RELEASE} %{BUILDTIME} %{INSTALLTIME}\\n]'", "10m");
     return if ($out->{-stdout} eq '');
 
     #   parse details into internal structure

CVSTrac 2.0.1