Displaying 20 results from an estimated 35 matches for "parse_os_release".
2017 Aug 08
1
Re: [PATCH v11 08/10] daemon: Implement inspection of Linux and other Unix-like operating systems.
...rse a os-release file.
> + *
> + * Only few fields are parsed, falling back to the usual detection if we
> + * cannot read all of them.
> + *
> + * For the format of os-release, see also:
> + * http://www.freedesktop.org/software/systemd/man/os-release.html
> + *)
> +let rec parse_os_release release_file data =
> + let chroot = Chroot.create ~name:"parse_os_release" () in
> + let lines =
> + Chroot.f chroot (
> + fun () ->
> + if not (is_small_file release_file) then (
> + eprintf "%s: not a regular file or too large\n"...
2016 Mar 30
2
[PATCH] inspect: use os-release for CoreOS
...this change works for you as well?
Thanks in advance.
src/inspect-fs-unix.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index 35181d6..dab4370 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -196,6 +196,8 @@ parse_os_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
distro = OS_DISTRO_ARCHLINUX;
else if (VALUE_IS ("centos"))
distro = OS_DISTRO_CENTOS;
+ else if (VALUE_IS ("coreos"))
+ distro = OS_DISTRO_COREOS;
else if (VALUE_IS ("de...
2017 Oct 17
1
[PATCH] daemon: simplify usage of Chroot.f
...inspect_fs_windows.ml | 2 +-
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/daemon/inspect_fs_unix.ml b/daemon/inspect_fs_unix.ml
index 59e26a05e..3ad119306 100644
--- a/daemon/inspect_fs_unix.ml
+++ b/daemon/inspect_fs_unix.ml
@@ -68,7 +68,7 @@ let arch_binaries =
*)
let rec parse_os_release release_file data =
let chroot = Chroot.create ~name:"parse_os_release" () in
- let lines = Chroot.f chroot (fun () -> read_small_file release_file) () in
+ let lines = Chroot.f chroot read_small_file release_file in
match lines with
| None -> false
@@ -182,7 +182,7 @@...
2015 Oct 09
1
[PATCH] inspect: Don't free uninitialized string.
...free it.
This fixes commit 32d19e3289bc259901f77398703f16cf6eabd510.
---
src/inspect-fs-unix.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index cda1b5d..3d19276 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -232,7 +232,6 @@ parse_os_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
char buf[value_len + 1];
snprintf (buf, sizeof buf, "%*s", (int) value_len, value);
major_version = guestfs_int_parse_unsigned_int (g, buf);
- free (major);
/* Handle cases where VERSION...
2016 Mar 30
0
Re: [PATCH] inspect: use os-release for CoreOS
...nce.
>
>
> src/inspect-fs-unix.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
> index 35181d6..dab4370 100644
> --- a/src/inspect-fs-unix.c
> +++ b/src/inspect-fs-unix.c
> @@ -196,6 +196,8 @@ parse_os_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
> distro = OS_DISTRO_ARCHLINUX;
> else if (VALUE_IS ("centos"))
> distro = OS_DISTRO_CENTOS;
> + else if (VALUE_IS ("coreos"))
> + distro = OS_DISTRO_COREOS;
>...
2018 Feb 14
1
[PATCH] inspect: use check_tests also for detecting Hurd
...d_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...
2016 Mar 31
1
Re: [PATCH] inspect: use os-release for CoreOS
...inspect-fs-unix.c | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
>> index 35181d6..dab4370 100644
>> --- a/src/inspect-fs-unix.c
>> +++ b/src/inspect-fs-unix.c
>> @@ -196,6 +196,8 @@ parse_os_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
>> distro = OS_DISTRO_ARCHLINUX;
>> else if (VALUE_IS ("centos"))
>> distro = OS_DISTRO_CENTOS;
>> + else if (VALUE_IS ("coreos"))
>> + distro = OS_DIST...
2017 Oct 16
4
[PATCH 1/3] daemon: add split_key_value_strings helper
Add a simple helper to turn a list of strings into key/value pairs,
splitting by '='.
---
daemon/utils.ml | 15 +++++++++++++++
daemon/utils.mli | 6 ++++++
2 files changed, 21 insertions(+)
diff --git a/daemon/utils.ml b/daemon/utils.ml
index d87ad75db..fd1681a86 100644
--- a/daemon/utils.ml
+++ b/daemon/utils.ml
@@ -229,3 +229,18 @@ let unix_canonical_path path =
let path =
2017 Oct 12
1
[PATCH] daemon: inspection: Add support for NeoKylin (RHBZ#1476081).
...pldlinux = PCRE.compile "(\\d+)\\.(\\d+) PLD Linux"
+let re_neokylin_version = PCRE.compile "^V(\\d+)Update(\\d+)$"
let arch_binaries =
[ "/bin/bash"; "/bin/ls"; "/bin/echo"; "/bin/rm"; "/bin/sh" ]
@@ -94,7 +95,7 @@ let rec parse_os_release release_file data =
else if key = "PRETTY_NAME" then
data.product_name <- Some value
else if key = "VERSION_ID" then
- parse_version_from_major_minor value data
+ parse_os_release_version_id value data
)...
2015 Sep 09
2
[PATCH] inspect: try to use /etc/os-release on Linux guests
...ect_fs *fs,
return 0;
}
+/* Parse a os-release file.
+ *
+ * Only few fields are parsed, falling back to the usual detection if we
+ * cannot read all of them.
+ *
+ * For the format of os-release, see also:
+ * http://www.freedesktop.org/software/systemd/man/os-release.html
+ */
+static int
+parse_os_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
+{
+ int64_t size;
+ CLEANUP_FREE_STRING_LIST char **lines = NULL;
+ size_t i;
+ enum inspect_os_distro distro = OS_DISTRO_UNKNOWN;
+ CLEANUP_FREE char *product_name = NULL;
+ int major_version = -1, minor_version = -1;
+
+ /* Don...
2017 Oct 16
2
Re: [PATCH v2 1/2] daemon: add split_key_value_strings helper
On Mon, Oct 16, 2017 at 05:58:10PM +0200, Pino Toscano wrote:
> Add a simple helper to turn a list of strings into key/value pairs,
> splitting by '=', with the possibility to apply a function to unquote
> values.
>
> Add also a simple unquote function.
> ---
> daemon/utils.ml | 16 ++++++++++++++++
> daemon/utils.mli | 11 +++++++++++
> 2 files changed, 27
2016 May 24
3
[PATCH 1/3] inspect: recognize the Void Linux distribution
...OS_DISTRO_ALTLINUX,
OS_DISTRO_FRUGALWARE,
OS_DISTRO_PLD_LINUX,
+ OS_DISTRO_VOID_LINUX,
};
enum inspect_os_package_format {
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index 0e64e33..4d41086 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -216,6 +216,8 @@ parse_os_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
distro = OS_DISTRO_SLES;
else if (VALUE_IS ("ubuntu"))
distro = OS_DISTRO_UBUNTU;
+ else if (VALUE_IS ("void"))
+ distro = OS_DISTRO_VOID_LINUX;
} else if (STRPREFIX (line, &quo...
2017 Oct 16
0
[PATCH 3/3] daemon: inspection: discard os-release w/o version
...4fbb3b42968792996748136700c8d8.
---
daemon/inspect_fs_unix.ml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/daemon/inspect_fs_unix.ml b/daemon/inspect_fs_unix.ml
index ba947c30e..8c7b1d83c 100644
--- a/daemon/inspect_fs_unix.ml
+++ b/daemon/inspect_fs_unix.ml
@@ -111,6 +111,10 @@ let rec parse_os_release release_file data =
data.version <- Some (0, 0);
true
+ (* No version detected, so fall back to other ways. *)
+ | { version = None } ->
+ false
+
| _ -> true
)
--
2.13.6
2017 Oct 16
0
Re: [PATCH v2 1/2] daemon: add split_key_value_strings helper
...gt;
> os-release uses some kind of escaping system. It does look as if
> shell_unquote may be appropriate here. (Of course whether writers of
> /etc/os-release are doing the right thing is another issue. I guess
> there is no validation).
Yes, this is what patch #2 already does, in parse_os_release:
+ let values = split_key_value_strings ~unquote:shell_unquote lines in
simple_unquote is used for parse_lsb_release: I could not find any
standard documentation for its format, and the examples I have have
either no quoting, or double quoting.
> > +let split_key_value_strings ?unquote...
2016 May 18
0
[PATCH 2/2] inspect: switch to version struct for os major/minor version
...)
-COMPILE_REGEXP (re_major_minor, "(\\d+)\\.(\\d+)", 0)
COMPILE_REGEXP (re_xdev, "^/dev/(h|s|v|xv)d([a-z]+)(\\d*)$", 0)
COMPILE_REGEXP (re_cciss, "^/dev/(cciss/c\\d+d\\d+)(?:p(\\d+))?$", 0)
COMPILE_REGEXP (re_mdN, "^(/dev/md\\d+)$", 0)
@@ -148,7 +147,8 @@ parse_os_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
size_t i;
enum inspect_os_distro distro = OS_DISTRO_UNKNOWN;
CLEANUP_FREE char *product_name = NULL;
- int major_version = -1, minor_version = -1;
+ struct version version;
+ guestfs_int_version_from_values (&version, -1, -...
2016 Dec 06
0
[PATCH 5/5] inspect: gather info from /usr filesystems as well (RHBZ#1401474)
...+guestfs_int_check_linux_usr (guestfs_h *g, struct inspect_fs *fs)
+{
+ int r;
+
+ fs->type = OS_TYPE_LINUX;
+ fs->role = OS_ROLE_USR;
+
+ if (guestfs_is_file_opts (g, "/lib/os-release",
+ GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) {
+ r = parse_os_release (g, fs, "/lib/os-release");
+ if (r == -1) /* error */
+ return -1;
+ if (r == 1) /* ok - detected the release from this file */
+ goto skip_release_checks;
+ }
+
+ skip_release_checks:;
+
+ /* Determine the architecture. */
+ check_architecture (g, fs);...
2019 Apr 02
6
[PATCH 0/5] Small inspection improvements
Few improvements to the results of the inspection on some distros.
Pino Toscano (5):
inspect: factorize list of rolling distros
inspect: detect Gentoo from os-release
inspect: fully detect Arch Linux from os-release
inspect: return osinfo short IDs for rolling distros
inspect: correct osinfo ID for ALT Linux >= 8
daemon/inspect_fs_unix.ml | 15 +++++++++------
2016 May 17
3
[PATCH 0/2] src: introduce an helper version struct
Hi,
this adds an helper version struct, and uses it in the backends (for the
libvirt and qemu versions) and inspection code. This also moves common
code to that, so it is not repeated in many places.
This should help with the small refactoring proposed with
https://www.redhat.com/archives/libguestfs/2016-May/msg00070.html
Thanks,
Pino Toscano (2):
src: start unifying version handling
2017 Oct 16
3
[PATCH v3 0/2] daemon: add and use parse_key_value_strings helper
Changes from v2 to v3:
- split_key_value_strings renamed to parse_key_value_strings
Changes from v1 to v2:
- split the "simple unquoting" as helper
- pass the unquoting function to split_key_value_strings
- use right unquoting function when applying split_key_value_strings
Pino Toscano (2):
daemon: add split_key_value_strings helper
daemon: use parse_key_value_strings
2016 May 18
3
[PATCH v2 0/2] src: introduce an helper version struct
Hi,
this adds an helper version struct, and uses it in the backends (for the
libvirt and qemu versions) and inspection code. This also moves common
code to that, so it is not repeated in many places.
This should help with the small refactoring proposed with
https://www.redhat.com/archives/libguestfs/2016-May/msg00070.html
Thanks,
Pino Toscano (2):
src: start unifying version handling