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

Pino Toscano ptoscano at redhat.com
Wed Feb 7 17:56:27 UTC 2018


On Wednesday, 7 February 2018 18:27:13 CET Daniel P. Berrangé wrote:
> 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 *)

I'd add the question mark to the comment, mostly for coherency with the
other comments.

> +  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

Mostly LGTM at a quick glance.

Can you please also document the new "msdos" distribution in the
documentation text of inspect_get_distro, in
generator/actions_inspection.ml?

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20180207/5cc884e2/attachment.sig>


More information about the Libguestfs mailing list