Blame SOURCES/0052-RHEL-7-Emphasize-libguestfs-winsupport-package-RHBZ-.patch

cd6068
From d8ce3805e2d5162ec882031f03c7bf80e3df7573 Mon Sep 17 00:00:00 2001
022f11
From: "Richard W.M. Jones" <rjones@redhat.com>
022f11
Date: Mon, 10 Jan 2011 16:07:12 +0000
022f11
Subject: [PATCH] RHEL 7: Emphasize libguestfs-winsupport package
022f11
 (RHBZ#627468).
022f11
022f11
This RHEL-only patch changes the error messages when the
022f11
inspection code cannot find an operating system inside the guest
022f11
image.  For a Windows guest this may happen because the user has not
022f11
installed the separate 'libguestfs-winsupport' package.  Therefore we
022f11
emphasize that the user may need to install this package.
022f11
022f11
Notes:
022f11
022f11
(1) In RHEL there are two pieces of inspection code, the old Perl code
022f11
(deprecated upstream) and the new C core inspection API.  Therefore
022f11
this patch has to touch two places with essentially the same change.
022f11
022f11
(2) This patch doesn't try to be clever and detect if it was a Windows
022f11
guest.  This should reduce the chance of failure.
022f11
022f11
Output from (Perl) virt-inspector now looks like this:
022f11
022f11
 $ virt-inspector disk.img
022f11
 No operating system could be detected inside this disk image.
022f11
022f11
 This may be because the file is not a disk image, or is not a virtual machine
022f11
 image, or because the OS type is not understood by virt-inspector.
022f11
022f11
 If you feel this is an error, please file a bug report including as much
022f11
 information about the disk image as possible.
022f11
022f11
 RHEL notice
022f11
 -------------
022f11
 libguestfs will return this error for Microsoft Windows guests if the
022f11
 separate 'libguestfs-winsupport' package is not installed. If the
022f11
 guest is running Microsoft Windows, please try again after installing
022f11
 'libguestfs-winsupport'.
022f11
022f11
Output from guestfish (ie. C core inspection API) now looks like this:
022f11
022f11
 $ guestfish -i disk.img
022f11
 guestfish: no operating system was found on this disk
022f11
022f11
 RHEL notice
022f11
 -------------
022f11
 libguestfs will return this error for Microsoft Windows guests if the
022f11
 separate 'libguestfs-winsupport' package is not installed. If the
022f11
 guest is running Microsoft Windows, please try again after installing
022f11
 'libguestfs-winsupport'.
022f11
---
022f11
 fish/inspect.c | 14 ++++++++++++++
022f11
 1 file changed, 14 insertions(+)
022f11
022f11
diff --git a/fish/inspect.c b/fish/inspect.c
022f11
index 801d867..8858fcd 100644
022f11
--- a/fish/inspect.c
022f11
+++ b/fish/inspect.c
022f11
@@ -22,6 +22,7 @@
022f11
 #include <stdlib.h>
022f11
 #include <string.h>
022f11
 #include <errno.h>
022f11
+#include <unistd.h>
022f11
 #include <libintl.h>
022f11
 
022f11
 #include "c-ctype.h"
022f11
@@ -68,6 +69,10 @@ inspect_mount (void)
022f11
     exit (EXIT_FAILURE);
022f11
 
022f11
   if (roots[0] == NULL) {
022f11
+    int libguestfs_winsupport_installed =
022f11
+      access ("/usr/lib/guestfs/supermin.d/ntfs.img", F_OK) == 0 ||
022f11
+      access ("/usr/lib64/guestfs/supermin.d/ntfs.img", F_OK) == 0;
022f11
+
022f11
     fprintf (stderr,
022f11
       _("%s: no operating system was found on this disk\n"
022f11
         "\n"
022f11
@@ -84,6 +89,15 @@ inspect_mount (void)
022f11
         "with these tools.  Use the guestfish equivalent commands\n"
022f11
         "(see the virt tool manual page).\n"),
022f11
              program_name);
022f11
+    if (!libguestfs_winsupport_installed)
022f11
+      fprintf (stderr,
022f11
+    _("\nRHEL notice\n"
022f11
+      "-------------\n"
022f11
+      "libguestfs will return this error for Microsoft Windows guests if the\n"
022f11
+      "separate 'libguestfs-winsupport' package is not installed. If the\n"
022f11
+      "guest is running Microsoft Windows, please try again after installing\n"
022f11
+      "'libguestfs-winsupport'.\n"));
022f11
+
022f11
     guestfs___free_string_list (roots);
022f11
     exit (EXIT_FAILURE);
022f11
   }
022f11
-- 
022f11
1.8.3.1
022f11