Daniel P. Berrangé
2018-Feb-07 17:27 UTC
[Libguestfs] [PATCH] daemon: add inspector support for MS-DOS distro
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@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
Richard W.M. Jones
2018-Feb-07 17:54 UTC
Re: [Libguestfs] [PATCH] daemon: add inspector support for MS-DOS distro
On Wed, Feb 07, 2018 at 05:27:13PM +0000, 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@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(+)You need to add the distro to the long list in generator/actions_inspection.ml (after =item \"meego\"). Apart from that it seems fine. Rich.> 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 > > _______________________________________________ > Libguestfs mailing list > Libguestfs@redhat.com > https://www.redhat.com/mailman/listinfo/libguestfs-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Pino Toscano
2018-Feb-07 17:56 UTC
Re: [Libguestfs] [PATCH] daemon: add inspector support for MS-DOS distro
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@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_OPENBSDMostly 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
Maybe Matching Threads
- [PATCH v2] daemon: add inspector support for MS-DOS distro
- [PATCH] daemon: inspection: Add support for NeoKylin (RHBZ#1476081).
- [PATCH v12 08/11] daemon: Implement inspection types and utility functions.
- [PATCH] UNFINISHED daemon: Reimplement most inspection APIs in the daemon.
- [PATCH v12 09/11] daemon: Implement inspection of Linux and other Unix-like operating systems.