summaryrefslogtreecommitdiffstats
path: root/src/inspect-fs.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-27 17:38:31 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-29 18:22:00 +0000
commit90e7981082a2685b235724a6dd9b737cb90fe553 (patch)
tree6bc644091168c32da81994314614d9b15ec0e42a /src/inspect-fs.c
parent31101db4c706ac0b8a32ee08f2ba19c0f33208f8 (diff)
downloadlibguestfs-90e7981082a2685b235724a6dd9b737cb90fe553.tar.gz
libguestfs-90e7981082a2685b235724a6dd9b737cb90fe553.tar.xz
libguestfs-90e7981082a2685b235724a6dd9b737cb90fe553.zip
inspection: Read libosinfo database in order to inspect OS install CD/DVD/ISOs (RHBZ#803650, RHBZ#805417).
Diffstat (limited to 'src/inspect-fs.c')
-rw-r--r--src/inspect-fs.c42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index 0ddeae13..2c81e412 100644
--- a/src/inspect-fs.c
+++ b/src/inspect-fs.c
@@ -80,8 +80,6 @@ free_regexps (void)
}
static int check_filesystem (guestfs_h *g, const char *device, int is_block, int is_partnum);
-static void check_package_format (guestfs_h *g, struct inspect_fs *fs);
-static void check_package_management (guestfs_h *g, struct inspect_fs *fs);
static int extend_fses (guestfs_h *g);
/* Find out if 'device' contains a filesystem. If it does, add
@@ -118,6 +116,24 @@ guestfs___check_for_filesystem_on (guestfs_h *g, const char *device,
return 0;
}
+ /* If it's a whole device, see if it is an install ISO. */
+ if (is_block) {
+ if (extend_fses (g) == -1)
+ return -1;
+ fs = &g->fses[g->nr_fses-1];
+
+ r = guestfs___check_installer_iso (g, fs, device);
+ if (r == -1) { /* Fatal error. */
+ g->nr_fses--;
+ return -1;
+ }
+ if (r > 0) /* Found something. */
+ return 0;
+
+ /* Didn't find anything. Fall through ... */
+ g->nr_fses--;
+ }
+
/* Try mounting the device. As above, ignore errors. */
guestfs_push_error_handler (g, NULL, NULL);
if (vfs_type && STREQ (vfs_type, "ufs")) { /* Hack for the *BSDs. */
@@ -276,8 +292,14 @@ check_filesystem (guestfs_h *g, const char *device,
*/
fs->arch = safe_strdup (g, "i386");
}
- /* Install CD/disk? Skip these checks if it's not a whole device
- * (eg. CD) or the first partition (eg. bootable USB key).
+ /* Install CD/disk?
+ *
+ * Note that we checked (above) for an install ISO, but there are
+ * other types of install image (eg. USB keys) which that check
+ * wouldn't have picked up.
+ *
+ * Skip these checks if it's not a whole device (eg. CD) or the
+ * first partition (eg. bootable USB key).
*/
else if ((is_block || is_partnum == 1) &&
(guestfs_is_file (g, "/isolinux/isolinux.cfg") > 0 ||
@@ -298,8 +320,8 @@ check_filesystem (guestfs_h *g, const char *device,
/* The above code should have set fs->type and fs->distro fields, so
* we can now guess the package management system.
*/
- check_package_format (g, fs);
- check_package_management (g, fs);
+ guestfs___check_package_format (g, fs);
+ guestfs___check_package_management (g, fs);
return 0;
}
@@ -403,8 +425,8 @@ guestfs___parse_major_minor (guestfs_h *g, struct inspect_fs *fs)
* simple function of the distro and major_version fields, so these
* can never return an error. We might be cleverer in future.
*/
-static void
-check_package_format (guestfs_h *g, struct inspect_fs *fs)
+void
+guestfs___check_package_format (guestfs_h *g, struct inspect_fs *fs)
{
switch (fs->distro) {
case OS_DISTRO_FEDORA:
@@ -450,8 +472,8 @@ check_package_format (guestfs_h *g, struct inspect_fs *fs)
}
}
-static void
-check_package_management (guestfs_h *g, struct inspect_fs *fs)
+void
+guestfs___check_package_management (guestfs_h *g, struct inspect_fs *fs)
{
switch (fs->distro) {
case OS_DISTRO_FEDORA: