On Wed, Feb 14, 2018 at 03:23:23PM +0100, Pino Toscano wrote:
Even though the list of checks is very short, at least this migrates
from imperative checks to a "declarative" one.
There should be no behaviour change, other than using os-release if it
contains all the needed information.
---
daemon/inspect_fs_unix.ml | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/daemon/inspect_fs_unix.ml b/daemon/inspect_fs_unix.ml
index 53c86e878..e2a7364bd 100644
--- a/daemon/inspect_fs_unix.ml
+++ b/daemon/inspect_fs_unix.ml
@@ -698,6 +698,17 @@ let rec check_openbsd_root mountable data =
and check_hostname_openbsd () =
check_hostname_from_file "/etc/myname"
+let hurd_root_tests : tests = [
+ (* Newer distros include /etc/os-release which is reasonably
+ * standardized. This entry should be first.
+ *)
+ "/etc/os-release", parse_os_release;
+ "/etc/debian_version", parse_generic DISTRO_DEBIAN;
+ (* Arch Hurd also exists, but inconveniently it doesn't have
+ * the normal /etc/arch-release file. XXX
+ *)
+]
+
(* The currently mounted device may be a Hurd root. Hurd has distros
* just like Linux.
*)
@@ -705,13 +716,7 @@ let rec check_hurd_root mountable data =
let os_type = OS_TYPE_HURD in
data.os_type <- Some os_type;
- if Is.is_file "/etc/debian_version" ~followsymlinks:true then (
- let distro = DISTRO_DEBIAN in
- ignore (parse_generic distro "/etc/debian_version" data)
- );
- (* Arch Hurd also exists, but inconveniently it doesn't have
- * the normal /etc/arch-release file. XXX
- *)
+ check_tests data linux_root_tests;
Is this supposed to be hurd_root_tests?
Rich.
(* Determine the architecture. *)
data.arch <- check_architecture ();
--
2.14.3
_______________________________________________
Libguestfs mailing list
Libguestfs(a)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
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW