[Libguestfs] [PATCH] daemon: add inspector support for MS-DOS distro

Daniel P. Berrangé berrange at redhat.com
Wed Feb 7 17:27:13 UTC 2018


An installation of MS-DOS has various files in a /DOS directory,
which COMMAND.COM looking like a reasonable signal that its MS-DOS
or a very close relative there-of.

This is validated with an MS-DOS 6.22 install.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---

BTW, I'm unclear if we should make any attempt to try to detect and
report Windows 3.x as a separate distro, since it requires an MS-DOS
install underneath it.

 daemon/inspect_fs.ml     | 14 ++++++++++++++
 daemon/inspect_types.ml  |  2 ++
 daemon/inspect_types.mli |  1 +
 3 files changed, 17 insertions(+)

diff --git a/daemon/inspect_fs.ml b/daemon/inspect_fs.ml
index 13ed127cd..a20de6761 100644
--- a/daemon/inspect_fs.ml
+++ b/daemon/inspect_fs.ml
@@ -220,6 +220,18 @@ and check_filesystem mountable =
      *)
     data.arch <- Some "i386"
   )
+  (* MS-DOS *)
+  else if is_dir_nocase "/DOS" &&
+          is_file_nocase "/DOS/COMMAND.COM" then (
+    debug_matching "MS-DOS";
+    role := `Root;
+    data.os_type <- Some OS_TYPE_DOS;
+    data.distro <- Some DISTRO_MSDOS;
+    (* MS-DOS is a mix of 16 and 32 bit, but
+     * assume it requires a 32 bit i386 processor.
+     *)
+    data.arch <- Some "i386"
+  )
   (* None of the above. *)
   else (
     debug_matching "no known OS partition"
@@ -282,6 +294,7 @@ and check_package_format { distro } =
   | Some DISTRO_FREEBSD
   | Some DISTRO_FREEDOS
   | Some DISTRO_FRUGALWARE
+  | Some DISTRO_MSDOS
   | Some DISTRO_NETBSD
   | Some DISTRO_OPENBSD
   | Some DISTRO_PLD_LINUX
@@ -365,6 +378,7 @@ and check_package_management { distro; version } =
   | Some DISTRO_FREEBSD
   | Some DISTRO_FREEDOS
   | Some DISTRO_FRUGALWARE
+  | Some DISTRO_MSDOS
   | Some DISTRO_NETBSD
   | Some DISTRO_OPENBSD
   | Some DISTRO_PLD_LINUX
diff --git a/daemon/inspect_types.ml b/daemon/inspect_types.ml
index 473939a67..464b8c2a6 100644
--- a/daemon/inspect_types.ml
+++ b/daemon/inspect_types.ml
@@ -82,6 +82,7 @@ and distro =
   | DISTRO_MAGEIA
   | DISTRO_MANDRIVA
   | DISTRO_MEEGO
+  | DISTRO_MSDOS
   | DISTRO_NEOKYLIN
   | DISTRO_NETBSD
   | DISTRO_OPENBSD
@@ -211,6 +212,7 @@ and string_of_distro = function
   | DISTRO_MAGEIA -> "mageia"
   | DISTRO_MANDRIVA -> "mandriva"
   | DISTRO_MEEGO -> "meego"
+  | DISTRO_MSDOS -> "msdos"
   | DISTRO_NEOKYLIN -> "neokylin"
   | DISTRO_NETBSD -> "netbsd"
   | DISTRO_OPENBSD -> "openbsd"
diff --git a/daemon/inspect_types.mli b/daemon/inspect_types.mli
index 6d75e5825..78051b510 100644
--- a/daemon/inspect_types.mli
+++ b/daemon/inspect_types.mli
@@ -89,6 +89,7 @@ and distro =
   | DISTRO_MAGEIA
   | DISTRO_MANDRIVA
   | DISTRO_MEEGO
+  | DISTRO_MSDOS
   | DISTRO_NEOKYLIN
   | DISTRO_NETBSD
   | DISTRO_OPENBSD
-- 
2.14.3




More information about the Libguestfs mailing list