|
|
d03fcc |
From a98532ac7d6c79889703603d9f4ab008f0febd53 Mon Sep 17 00:00:00 2001
|
|
|
d03fcc |
From: Neil Hanlon <neil@resf.org>
|
|
|
d03fcc |
Date: Fri, 10 Dec 2021 08:50:48 +0000
|
|
|
d03fcc |
Subject: [PATCH] Add detection support for Rocky Linux (CentOS/RHEL-like)
|
|
|
d03fcc |
|
|
|
d03fcc |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2030709
|
|
|
d03fcc |
Thanks: label@rockylinux.org
|
|
|
d03fcc |
|
|
|
d03fcc |
---
|
|
|
d03fcc |
|
|
|
d03fcc |
RWMJ notes: I fixed the original patch so it compiled. This patch
|
|
|
d03fcc |
sets osinfo to "rocky8", which doesn't exist in the osinfo db yet.
|
|
|
d03fcc |
Arguably we might want to set this to "centos8", but we can see what
|
|
|
d03fcc |
libosinfo decides to do. Here is partial virt-inspector output on a
|
|
|
d03fcc |
Rocky Linux disk image:
|
|
|
d03fcc |
|
|
|
d03fcc |
$ ./run virt-inspector -a disk.img
|
|
|
d03fcc |
|
|
|
d03fcc |
<operatingsystems>
|
|
|
d03fcc |
<operatingsystem>
|
|
|
d03fcc |
<root>/dev/rl/root</root>
|
|
|
d03fcc |
<name>linux</name>
|
|
|
d03fcc |
<arch>x86_64</arch>
|
|
|
d03fcc |
<distro>rocky</distro>
|
|
|
d03fcc |
<product_name>Rocky Linux 8.5 (Green Obsidian)</product_name>
|
|
|
d03fcc |
<major_version>8</major_version>
|
|
|
d03fcc |
<minor_version>5</minor_version>
|
|
|
d03fcc |
<package_format>rpm</package_format>
|
|
|
d03fcc |
<package_management>dnf</package_management>
|
|
|
d03fcc |
<hostname>localhost.localdomain</hostname>
|
|
|
d03fcc |
<osinfo>rocky8</osinfo>
|
|
|
d03fcc |
<mountpoints>
|
|
|
d03fcc |
<mountpoint dev="/dev/rl/root">/</mountpoint>
|
|
|
d03fcc |
<mountpoint dev="/dev/sda1">/boot</mountpoint>
|
|
|
d03fcc |
</mountpoints>
|
|
|
d03fcc |
<filesystems>
|
|
|
d03fcc |
<filesystem dev="/dev/rl/root">
|
|
|
d03fcc |
<type>xfs</type>
|
|
|
d03fcc |
<uuid>fed8331f-9f25-40cd-883e-090cd640559d</uuid>
|
|
|
d03fcc |
</filesystem>
|
|
|
d03fcc |
<filesystem dev="/dev/rl/swap">
|
|
|
d03fcc |
<type>swap</type>
|
|
|
d03fcc |
<uuid>6da2c121-ea7d-49ce-98a3-14a37fceaadd</uuid>
|
|
|
d03fcc |
</filesystem>
|
|
|
d03fcc |
<filesystem dev="/dev/sda1">
|
|
|
d03fcc |
<type>xfs</type>
|
|
|
d03fcc |
<uuid>4efafe61-2d20-4d93-8055-537e09bfd033</uuid>
|
|
|
d03fcc |
</filesystem>
|
|
|
d03fcc |
</filesystems>
|
|
|
d03fcc |
(cherry picked from commit 631962c0e88a321646846be91d0fbea1ba14e263)
|
|
|
d03fcc |
---
|
|
|
d03fcc |
daemon/inspect_fs.ml | 2 ++
|
|
|
d03fcc |
daemon/inspect_fs_unix.ml | 13 ++++++++++++-
|
|
|
d03fcc |
daemon/inspect_types.ml | 2 ++
|
|
|
d03fcc |
daemon/inspect_types.mli | 1 +
|
|
|
d03fcc |
generator/actions_inspection.ml | 4 ++++
|
|
|
d03fcc |
lib/inspect-icon.c | 1 +
|
|
|
d03fcc |
lib/inspect-osinfo.c | 4 ++++
|
|
|
d03fcc |
7 files changed, 26 insertions(+), 1 deletion(-)
|
|
|
d03fcc |
|
|
|
d03fcc |
diff --git a/daemon/inspect_fs.ml b/daemon/inspect_fs.ml
|
|
|
d03fcc |
index 77f0f6aea..9c73d97ef 100644
|
|
|
d03fcc |
--- a/daemon/inspect_fs.ml
|
|
|
d03fcc |
+++ b/daemon/inspect_fs.ml
|
|
|
d03fcc |
@@ -259,6 +259,7 @@ and check_package_format { distro } =
|
|
|
d03fcc |
| None -> None
|
|
|
d03fcc |
| Some DISTRO_ALTLINUX
|
|
|
d03fcc |
| Some DISTRO_CENTOS
|
|
|
d03fcc |
+ | Some DISTRO_ROCKY
|
|
|
d03fcc |
| Some DISTRO_FEDORA
|
|
|
d03fcc |
| Some DISTRO_MAGEIA
|
|
|
d03fcc |
| Some DISTRO_MANDRIVA
|
|
|
d03fcc |
@@ -329,6 +330,7 @@ and check_package_management { distro; version } =
|
|
|
d03fcc |
Some PACKAGE_MANAGEMENT_DNF
|
|
|
d03fcc |
|
|
|
d03fcc |
| Some DISTRO_CENTOS
|
|
|
d03fcc |
+ | Some DISTRO_ROCKY
|
|
|
d03fcc |
| Some DISTRO_ORACLE_LINUX
|
|
|
d03fcc |
| Some DISTRO_REDHAT_BASED
|
|
|
d03fcc |
| Some DISTRO_RHEL
|
|
|
d03fcc |
diff --git a/daemon/inspect_fs_unix.ml b/daemon/inspect_fs_unix.ml
|
|
|
d03fcc |
index 7f6eb92e9..63cb279d0 100644
|
|
|
d03fcc |
--- a/daemon/inspect_fs_unix.ml
|
|
|
d03fcc |
+++ b/daemon/inspect_fs_unix.ml
|
|
|
d03fcc |
@@ -32,6 +32,8 @@ let re_rhel_no_minor = PCRE.compile "Red Hat.*release (\\d+)"
|
|
|
d03fcc |
let re_centos_old = PCRE.compile "CentOS.*release (\\d+).*Update (\\d+)"
|
|
|
d03fcc |
let re_centos = PCRE.compile "CentOS.*release (\\d+)\\.(\\d+)"
|
|
|
d03fcc |
let re_centos_no_minor = PCRE.compile "CentOS.*release (\\d+)"
|
|
|
d03fcc |
+let re_rocky = PCRE.compile "Rocky Linux.*release (\\d+)\\.(\\d+)"
|
|
|
d03fcc |
+let re_rocky_no_minor = PCRE.compile "Rocky Linux.*release (\\d+)"
|
|
|
d03fcc |
let re_scientific_linux_old =
|
|
|
d03fcc |
PCRE.compile "Scientific Linux.*release (\\d+).*Update (\\d+)"
|
|
|
d03fcc |
let re_scientific_linux =
|
|
|
d03fcc |
@@ -106,7 +108,7 @@ let rec parse_os_release release_file data =
|
|
|
d03fcc |
* we detect that situation then bail out and use the release
|
|
|
d03fcc |
* files instead.
|
|
|
d03fcc |
*)
|
|
|
d03fcc |
- | { distro = Some (DISTRO_DEBIAN|DISTRO_CENTOS);
|
|
|
d03fcc |
+ | { distro = Some (DISTRO_DEBIAN|DISTRO_CENTOS|DISTRO_ROCKY);
|
|
|
d03fcc |
version = Some (_, 0) } ->
|
|
|
d03fcc |
false
|
|
|
d03fcc |
|
|
|
d03fcc |
@@ -155,6 +157,7 @@ and distro_of_os_release_id = function
|
|
|
d03fcc |
| "pardus" -> Some DISTRO_PARDUS
|
|
|
d03fcc |
| "pld" -> Some DISTRO_PLD_LINUX
|
|
|
d03fcc |
| "rhel" -> Some DISTRO_RHEL
|
|
|
d03fcc |
+ | "rocky" -> Some DISTRO_ROCKY
|
|
|
d03fcc |
| "sles" | "sled" -> Some DISTRO_SLES
|
|
|
d03fcc |
| "ubuntu" -> Some DISTRO_UBUNTU
|
|
|
d03fcc |
| "void" -> Some DISTRO_VOID_LINUX
|
|
|
d03fcc |
@@ -405,6 +408,10 @@ let linux_root_tests : tests = [
|
|
|
d03fcc |
DISTRO_CENTOS;
|
|
|
d03fcc |
"/etc/centos-release", parse_generic ~rex:re_centos_no_minor
|
|
|
d03fcc |
DISTRO_CENTOS;
|
|
|
d03fcc |
+ "/etc/rocky-release", parse_generic ~rex:re_rocky
|
|
|
d03fcc |
+ DISTRO_ROCKY;
|
|
|
d03fcc |
+ "/etc/rocky-release", parse_generic ~rex:re_rocky_no_minor
|
|
|
d03fcc |
+ DISTRO_ROCKY;
|
|
|
d03fcc |
"/etc/altlinux-release", parse_generic DISTRO_ALTLINUX;
|
|
|
d03fcc |
"/etc/redhat-release", parse_generic ~rex:re_fedora
|
|
|
d03fcc |
DISTRO_FEDORA;
|
|
|
d03fcc |
@@ -420,6 +427,10 @@ let linux_root_tests : tests = [
|
|
|
d03fcc |
DISTRO_CENTOS;
|
|
|
d03fcc |
"/etc/redhat-release", parse_generic ~rex:re_centos_no_minor
|
|
|
d03fcc |
DISTRO_CENTOS;
|
|
|
d03fcc |
+ "/etc/redhat-release", parse_generic ~rex:re_rocky
|
|
|
d03fcc |
+ DISTRO_ROCKY;
|
|
|
d03fcc |
+ "/etc/redhat-release", parse_generic ~rex:re_rocky_no_minor
|
|
|
d03fcc |
+ DISTRO_ROCKY;
|
|
|
d03fcc |
"/etc/redhat-release", parse_generic ~rex:re_scientific_linux_old
|
|
|
d03fcc |
DISTRO_SCIENTIFIC_LINUX;
|
|
|
d03fcc |
"/etc/redhat-release", parse_generic ~rex:re_scientific_linux
|
|
|
d03fcc |
diff --git a/daemon/inspect_types.ml b/daemon/inspect_types.ml
|
|
|
d03fcc |
index e2bc7165c..9395c51f9 100644
|
|
|
d03fcc |
--- a/daemon/inspect_types.ml
|
|
|
d03fcc |
+++ b/daemon/inspect_types.ml
|
|
|
d03fcc |
@@ -95,6 +95,7 @@ and distro =
|
|
|
d03fcc |
| DISTRO_PLD_LINUX
|
|
|
d03fcc |
| DISTRO_REDHAT_BASED
|
|
|
d03fcc |
| DISTRO_RHEL
|
|
|
d03fcc |
+ | DISTRO_ROCKY
|
|
|
d03fcc |
| DISTRO_SCIENTIFIC_LINUX
|
|
|
d03fcc |
| DISTRO_SLACKWARE
|
|
|
d03fcc |
| DISTRO_SLES
|
|
|
d03fcc |
@@ -228,6 +229,7 @@ and string_of_distro = function
|
|
|
d03fcc |
| DISTRO_PLD_LINUX -> "pldlinux"
|
|
|
d03fcc |
| DISTRO_REDHAT_BASED -> "redhat-based"
|
|
|
d03fcc |
| DISTRO_RHEL -> "rhel"
|
|
|
d03fcc |
+ | DISTRO_ROCKY -> "rocky"
|
|
|
d03fcc |
| DISTRO_SCIENTIFIC_LINUX -> "scientificlinux"
|
|
|
d03fcc |
| DISTRO_SLACKWARE -> "slackware"
|
|
|
d03fcc |
| DISTRO_SLES -> "sles"
|
|
|
d03fcc |
diff --git a/daemon/inspect_types.mli b/daemon/inspect_types.mli
|
|
|
d03fcc |
index 43c79818f..29c76e8ab 100644
|
|
|
d03fcc |
--- a/daemon/inspect_types.mli
|
|
|
d03fcc |
+++ b/daemon/inspect_types.mli
|
|
|
d03fcc |
@@ -102,6 +102,7 @@ and distro =
|
|
|
d03fcc |
| DISTRO_PLD_LINUX
|
|
|
d03fcc |
| DISTRO_REDHAT_BASED
|
|
|
d03fcc |
| DISTRO_RHEL
|
|
|
d03fcc |
+ | DISTRO_ROCKY
|
|
|
d03fcc |
| DISTRO_SCIENTIFIC_LINUX
|
|
|
d03fcc |
| DISTRO_SLACKWARE
|
|
|
d03fcc |
| DISTRO_SLES
|
|
|
d03fcc |
diff --git a/generator/actions_inspection.ml b/generator/actions_inspection.ml
|
|
|
d03fcc |
index 0c6d39b43..f8b744993 100644
|
|
|
d03fcc |
--- a/generator/actions_inspection.ml
|
|
|
d03fcc |
+++ b/generator/actions_inspection.ml
|
|
|
d03fcc |
@@ -278,6 +278,10 @@ Some Red Hat-derived distro.
|
|
|
d03fcc |
|
|
|
d03fcc |
Red Hat Enterprise Linux.
|
|
|
d03fcc |
|
|
|
d03fcc |
+=item \"rocky\"
|
|
|
d03fcc |
+
|
|
|
d03fcc |
+Rocky Linux.
|
|
|
d03fcc |
+
|
|
|
d03fcc |
=item \"scientificlinux\"
|
|
|
d03fcc |
|
|
|
d03fcc |
Scientific Linux.
|
|
|
d03fcc |
diff --git a/lib/inspect-icon.c b/lib/inspect-icon.c
|
|
|
d03fcc |
index 725af574b..3bffa4f80 100644
|
|
|
d03fcc |
--- a/lib/inspect-icon.c
|
|
|
d03fcc |
+++ b/lib/inspect-icon.c
|
|
|
d03fcc |
@@ -138,6 +138,7 @@ guestfs_impl_inspect_get_icon (guestfs_h *g, const char *root, size_t *size_r,
|
|
|
d03fcc |
else if (STREQ (distro, "rhel") ||
|
|
|
d03fcc |
STREQ (distro, "redhat-based") ||
|
|
|
d03fcc |
STREQ (distro, "centos") ||
|
|
|
d03fcc |
+ STREQ (distro, "rocky") ||
|
|
|
d03fcc |
STREQ (distro, "scientificlinux") ||
|
|
|
d03fcc |
STREQ (distro, "oraclelinux")) {
|
|
|
d03fcc |
r = icon_rhel (g, guestfs_inspect_get_major_version (g, root), &size);
|
|
|
d03fcc |
diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c
|
|
|
d03fcc |
index db38d87f7..90e57e6df 100644
|
|
|
d03fcc |
--- a/lib/inspect-osinfo.c
|
|
|
d03fcc |
+++ b/lib/inspect-osinfo.c
|
|
|
d03fcc |
@@ -47,6 +47,10 @@ guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root)
|
|
|
d03fcc |
else if (major == 6)
|
|
|
d03fcc |
return safe_asprintf (g, "%s%d.%d", distro, major, minor);
|
|
|
d03fcc |
}
|
|
|
d03fcc |
+ else if (STREQ (distro, "rocky")) {
|
|
|
d03fcc |
+ if (major >= 8)
|
|
|
d03fcc |
+ return safe_asprintf (g, "%s%d", distro, major);
|
|
|
d03fcc |
+ }
|
|
|
d03fcc |
else if (STREQ (distro, "debian")) {
|
|
|
d03fcc |
if (major >= 4)
|
|
|
d03fcc |
return safe_asprintf (g, "%s%d", distro, major);
|
|
|
d03fcc |
--
|
|
|
69da20 |
2.31.1
|
|
|
d03fcc |
|