Neil Hanlon
2021-Dec-09 14:50 UTC
[Libguestfs] [PATCH] Add detection support for Rocky Linux (CentOS/RHEL-like)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2001636 Thanks: label at rockylinux.org --- daemon/inspect_fs.ml | 2 ++ daemon/inspect_fs_unix.ml | 13 ++++++++++++- daemon/inspect_types.ml | 2 ++ generator/actions_inspection.ml | 4 ++++ lib/inspect-icon.c | 1 + lib/inspect-osinfo.c | 4 ++++ website/index.html.in | 2 +- 7 files changed, 26 insertions(+), 2 deletions(-) diff --git a/daemon/inspect_fs.ml b/daemon/inspect_fs.ml index 77f0f6aea..9c73d97ef 100644 --- a/daemon/inspect_fs.ml +++ b/daemon/inspect_fs.ml @@ -259,6 +259,7 @@ and check_package_format { distro } | None -> None | Some DISTRO_ALTLINUX | Some DISTRO_CENTOS + | Some DISTRO_ROCKY | Some DISTRO_FEDORA | Some DISTRO_MAGEIA | Some DISTRO_MANDRIVA @@ -329,6 +330,7 @@ and check_package_management { distro; version } Some PACKAGE_MANAGEMENT_DNF | Some DISTRO_CENTOS + | Some DISTRO_ROCKY | Some DISTRO_ORACLE_LINUX | Some DISTRO_REDHAT_BASED | Some DISTRO_RHEL diff --git a/daemon/inspect_fs_unix.ml b/daemon/inspect_fs_unix.ml index 7f6eb92e9..63cb279d0 100644 --- a/daemon/inspect_fs_unix.ml +++ b/daemon/inspect_fs_unix.ml @@ -32,6 +32,8 @@ let re_rhel_no_minor = PCRE.compile "Red Hat.*release (\\d+)" let re_centos_old = PCRE.compile "CentOS.*release (\\d+).*Update (\\d+)" let re_centos = PCRE.compile "CentOS.*release (\\d+)\\.(\\d+)" let re_centos_no_minor = PCRE.compile "CentOS.*release (\\d+)" +let re_rocky = PCRE.compile "Rocky Linux.*release (\\d+)\\.(\\d+)" +let re_rocky_no_minor = PCRE.compile "Rocky Linux.*release (\\d+)" let re_scientific_linux_old PCRE.compile "Scientific Linux.*release (\\d+).*Update (\\d+)" let re_scientific_linux @@ -106,7 +108,7 @@ let rec parse_os_release release_file data * we detect that situation then bail out and use the release * files instead. *) - | { distro = Some (DISTRO_DEBIAN|DISTRO_CENTOS); + | { distro = Some (DISTRO_DEBIAN|DISTRO_CENTOS|DISTRO_ROCKY); version = Some (_, 0) } -> false @@ -155,6 +157,7 @@ and distro_of_os_release_id = function | "pardus" -> Some DISTRO_PARDUS | "pld" -> Some DISTRO_PLD_LINUX | "rhel" -> Some DISTRO_RHEL + | "rocky" -> Some DISTRO_ROCKY | "sles" | "sled" -> Some DISTRO_SLES | "ubuntu" -> Some DISTRO_UBUNTU | "void" -> Some DISTRO_VOID_LINUX @@ -405,6 +408,10 @@ let linux_root_tests : tests = [ DISTRO_CENTOS; "/etc/centos-release", parse_generic ~rex:re_centos_no_minor DISTRO_CENTOS; + "/etc/rocky-release", parse_generic ~rex:re_rocky + DISTRO_ROCKY; + "/etc/rocky-release", parse_generic ~rex:re_rocky_no_minor + DISTRO_ROCKY; "/etc/altlinux-release", parse_generic DISTRO_ALTLINUX; "/etc/redhat-release", parse_generic ~rex:re_fedora DISTRO_FEDORA; @@ -420,6 +427,10 @@ let linux_root_tests : tests = [ DISTRO_CENTOS; "/etc/redhat-release", parse_generic ~rex:re_centos_no_minor DISTRO_CENTOS; + "/etc/redhat-release", parse_generic ~rex:re_rocky + DISTRO_ROCKY; + "/etc/redhat-release", parse_generic ~rex:re_rocky_no_minor + DISTRO_ROCKY; "/etc/redhat-release", parse_generic ~rex:re_scientific_linux_old DISTRO_SCIENTIFIC_LINUX; "/etc/redhat-release", parse_generic ~rex:re_scientific_linux diff --git a/daemon/inspect_types.ml b/daemon/inspect_types.ml index e2bc7165c..9395c51f9 100644 --- a/daemon/inspect_types.ml +++ b/daemon/inspect_types.ml @@ -95,6 +95,7 @@ and distro | DISTRO_PLD_LINUX | DISTRO_REDHAT_BASED | DISTRO_RHEL + | DISTRO_ROCKY | DISTRO_SCIENTIFIC_LINUX | DISTRO_SLACKWARE | DISTRO_SLES @@ -228,6 +229,7 @@ and string_of_distro = function | DISTRO_PLD_LINUX -> "pldlinux" | DISTRO_REDHAT_BASED -> "redhat-based" | DISTRO_RHEL -> "rhel" + | DISTRO_ROCKY -> "rocky" | DISTRO_SCIENTIFIC_LINUX -> "scientificlinux" | DISTRO_SLACKWARE -> "slackware" | DISTRO_SLES -> "sles" diff --git a/generator/actions_inspection.ml b/generator/actions_inspection.ml index 0c6d39b43..6ace7cbd4 100644 --- a/generator/actions_inspection.ml +++ b/generator/actions_inspection.ml @@ -278,6 +278,10 @@ Some Red Hat-derived distro. Red Hat Enterprise Linux. +=item \"rhel\" + +Rocky Linux. + =item \"scientificlinux\" Scientific Linux. diff --git a/lib/inspect-icon.c b/lib/inspect-icon.c index 725af574b..3bffa4f80 100644 --- a/lib/inspect-icon.c +++ b/lib/inspect-icon.c @@ -138,6 +138,7 @@ guestfs_impl_inspect_get_icon (guestfs_h *g, const char *root, size_t *size_r, else if (STREQ (distro, "rhel") || STREQ (distro, "redhat-based") || STREQ (distro, "centos") || + STREQ (distro, "rocky") || STREQ (distro, "scientificlinux") || STREQ (distro, "oraclelinux")) { r = icon_rhel (g, guestfs_inspect_get_major_version (g, root), &size); diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c index db38d87f7..90e57e6df 100644 --- a/lib/inspect-osinfo.c +++ b/lib/inspect-osinfo.c @@ -47,6 +47,10 @@ guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root) else if (major == 6) return safe_asprintf (g, "%s%d.%d", distro, major, minor); } + else if (STREQ (distro, "rocky")) { + if (major >= 8) + return safe_asprintf (g, "%s%d", distro, major); + } else if (STREQ (distro, "debian")) { if (major >= 4) return safe_asprintf (g, "%s%d", distro, major); diff --git a/website/index.html.in b/website/index.html.in index 7453129d6..08b7a6015 100644 --- a/website/index.html.in +++ b/website/index.html.in @@ -261,7 +261,7 @@ enterprise environments, and with many happy and successful users. <h3>Getting started</h3> <pre> -sudo yum install libguestfs-tools # Fedora/RHEL/CentOS +sudo yum install libguestfs-tools # Fedora/RHEL/CentOS/Rocky sudo apt-get install libguestfs-tools # Debian/Ubuntu guestfish --ro -i -a disk.img </pre> -- 2.33.1 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 228 bytes Desc: This is a digitally signed message part URL: <http://listman.redhat.com/archives/libguestfs/attachments/20211209/340b93cf/attachment.sig>