Generated code to support previous 2 commits.
[libguestfs.git] / inspector / virt-inspector.pl
index 2169431..a5ba005 100755 (executable)
@@ -566,12 +566,6 @@ if ($output !~ /.*fish$/) {
        check_for_applications ($root_dev);
        check_for_kernels ($root_dev);
 
-       # umount_all in libguestfs is buggy - it doesn't unmount
-       # filesystems in the correct order.  So let's unmount them
-       # in reverse first before calling umount_all as a last resort.
-       foreach (sort { $b cmp $a } keys %$mounts) {
-           eval "\$g->umount ('$_')";
-       }
        $g->umount_all ();
     }
 }
@@ -581,7 +575,34 @@ sub check_for_applications
     local $_;
     my $root_dev = shift;
 
-    # XXX rpm -qa, look in Program Files, or whatever
+    my @apps;
+
+    my $os = $oses{$root_dev}->{os};
+    if ($os eq "linux") {
+       my $distro = $oses{$root_dev}->{distro};
+       if ($distro eq "redhat") {
+           my @lines = $g->command_lines
+               (["rpm", "-q", "-a", "--qf",
+                 "%{name} %{epoch} %{version} %{release} %{arch}\n"]);
+           foreach (@lines) {
+               if (m/^(.*) (.*) (.*) (.*) (.*)$/) {
+                   $epoch = $2;
+                   $epoch = "" if $epoch eq "(none)";
+                   my $app = {
+                       name => $1,
+                       epoch => $epoch,
+                       version => $3,
+                       release => $4,
+                       arch => $5
+                   };
+                   push @apps, $app
+               }
+           }
+       }
+    } elsif ($os eq "windows") {
+       # This sucks ... XXX
+       XXX
+    }
 }
 
 sub check_for_kernels