X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ocsinventory-agent-cn.git;a=blobdiff_plain;f=Deb.pm;fp=Deb.pm;h=b64552ac61cfe61fbaf3e5599315898adf59e239;hp=0000000000000000000000000000000000000000;hb=0173cf11e9654d7d16fdc4081ac033c2e8fc3a76;hpb=babaaceab2dc0c4760b9a776c46f60bae3f5f9d8 diff --git a/Deb.pm b/Deb.pm new file mode 100644 index 0000000..b64552a --- /dev/null +++ b/Deb.pm @@ -0,0 +1,26 @@ +package Ocsinventory::Agent::Backend::OS::Generic::Packaging::Deb; + +use strict; +use warnings; + +sub check { can_run("dpkg") } + +sub run { + my $params = shift; + my $common = $params->{common}; + +# use dpkg-query --show --showformat='${Package}|||${Version}\n' + foreach(`dpkg-query --show --showformat='\${Status}---\${Package}---\${Version}---\${Installed-Size}---\${Description}\n' | grep ^'install ok installed'`) { + if (/^(\S+)---(\S+)---(\S+)---(\S+)---(.*)/) { + $common->addSoftware ({ + 'NAME' => $2, + 'VERSION' => $3, + 'FILESIZE' => $4, + 'COMMENTS' => $5, + 'FROM' => 'deb' + }); + } + } +} + +1;