It seems recent (?) NetBSD versions have their kernel as /netbsd, so also check for it to detect NetBSD installations. The current detection so far basically relied on generic files and directories which can potentially be in every UNIX system, misdetecting them if a /etc/release file is present in them. --- src/inspect-fs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/inspect-fs.c b/src/inspect-fs.c index c011b5a..21d2a23 100644 --- a/src/inspect-fs.c +++ b/src/inspect-fs.c @@ -222,6 +222,7 @@ check_filesystem (guestfs_h *g, const char *mountable, } else if (is_dir_etc && is_dir_bin && + guestfs_is_file (g, "/netbsd") > 0 && guestfs_is_file (g, "/etc/fstab") > 0 && guestfs_is_file (g, "/etc/release") > 0) { /* Ignore /dev/sda1 which is a shadow of the real root filesystem -- 1.9.3
Richard W.M. Jones
2014-Jun-10 10:13 UTC
Re: [Libguestfs] [PATCH] inspect: tighten NetBSD detection
On Tue, Jun 03, 2014 at 10:14:21AM +0200, Pino Toscano wrote:> It seems recent (?) NetBSD versions have their kernel as /netbsd, so > also check for it to detect NetBSD installations. > > The current detection so far basically relied on generic files and > directories which can potentially be in every UNIX system, misdetecting > them if a /etc/release file is present in them. > --- > src/inspect-fs.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/src/inspect-fs.c b/src/inspect-fs.c > index c011b5a..21d2a23 100644 > --- a/src/inspect-fs.c > +++ b/src/inspect-fs.c > @@ -222,6 +222,7 @@ check_filesystem (guestfs_h *g, const char *mountable, > } > else if (is_dir_etc && > is_dir_bin && > + guestfs_is_file (g, "/netbsd") > 0 && > guestfs_is_file (g, "/etc/fstab") > 0 && > guestfs_is_file (g, "/etc/release") > 0) { > /* Ignore /dev/sda1 which is a shadow of the real root filesystem > -- > 1.9.3I guess this might break detection of some earlier NetBSD releases. However I have pushed it anyway. NetBSD users can comment here if they are interested. Thanks, Rich. -- 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/