diff options
author | Guido Günther <agx@sigxcpu.org> | 2010-02-24 09:07:56 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-02-24 15:30:41 +0000 |
commit | de33cc91ee93f85f06b9976fdc5454c0eb851b8e (patch) | |
tree | 1151d7a745ef18fe5ca588b3002298c3536ad1e3 /perl | |
parent | b5c307b7d6c154337b1d2427b81418ebc9e16251 (diff) | |
download | libguestfs-de33cc91ee93f85f06b9976fdc5454c0eb851b8e.tar.gz libguestfs-de33cc91ee93f85f06b9976fdc5454c0eb851b8e.tar.xz libguestfs-de33cc91ee93f85f06b9976fdc5454c0eb851b8e.zip |
List application in Debian based vm images
Hi,
attached patch adds the code to list applications installed in Debian
based vm images.
Cheers,
-- Guido
>From 9427a14725b33415058a0713923c62bd231504ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Tue, 23 Feb 2010 21:05:02 +0100
Subject: [PATCH 2/2] Add application listing for Debian
Diffstat (limited to 'perl')
-rw-r--r-- | perl/lib/Sys/Guestfs/Lib.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index c7b5e7e1..e8796ad3 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -1453,6 +1453,23 @@ sub _check_for_applications push @apps, $app } } + } elsif (defined $package_format && $package_format eq "deb") { + my @lines = $g->command_lines + (["dpkg-query", + "-f", '${Package} ${Version} ${Architecture} ${Status}\n', + "-W"]); + foreach (@lines) { + if (m/^(.*) (.*) (.*) (.*) (.*) (.*)$/) { + if ( $6 eq "installed" ) { + my $app = { + name => $1, + version => $2, + arch => $3 + }; + push @apps, $app + } + } + } } } elsif ($osn eq "windows") { # XXX |