Use a static list of rolling distros, so it is easier to handle them
differently; use this list for handling the lack of VERSION_ID in
os-release files.
This is just refactoring, no behaviour changes.
---
daemon/inspect_fs_unix.ml | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/daemon/inspect_fs_unix.ml b/daemon/inspect_fs_unix.ml
index 57a24ef01..8b7096d30 100644
--- a/daemon/inspect_fs_unix.ml
+++ b/daemon/inspect_fs_unix.ml
@@ -58,6 +58,12 @@ let re_neokylin_version = PCRE.compile
"^V(\\d+)Update(\\d+)$"
let arch_binaries =
[ "/bin/bash"; "/bin/ls"; "/bin/echo";
"/bin/rm"; "/bin/sh" ]
+(* List of typical rolling distros, to ease handling them for common
+ * features.
+ *)
+let rolling_distros =
+ [ DISTRO_VOID_LINUX ]
+
(* Parse a os-release file.
*
* Only few fields are parsed, falling back to the usual detection if we
@@ -102,12 +108,8 @@ let rec parse_os_release release_file data =
version = Some (_, 0) } ->
false
- (* Rolling releases:
- * Void Linux has no VERSION_ID and no other version/release-
- * like file.
- *)
- | { distro = Some DISTRO_VOID_LINUX;
- version = None } ->
+ (* Rolling distros: no VERSION_ID available. *)
+ | { distro = Some d; version = None } when List.mem d rolling_distros ->
data.version <- Some (0, 0);
true
--
2.20.1