Skip to content

Commit

Permalink
Add detection support for Circle Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
bella485 authored and rwmjones committed Feb 6, 2024
1 parent f878f72 commit 72f9981
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions daemon/inspect_fs.ml
Expand Up @@ -259,6 +259,7 @@ and check_package_format { distro } =
| None -> None
| Some DISTRO_ALTLINUX
| Some DISTRO_CENTOS
| Some DISTRO_CIRCLE
| Some DISTRO_ROCKY
| Some DISTRO_FEDORA
| Some DISTRO_MAGEIA
Expand Down Expand Up @@ -331,6 +332,7 @@ and check_package_management { distro; version } =
Some PACKAGE_MANAGEMENT_DNF

| Some DISTRO_CENTOS
| Some DISTRO_CIRCLE
| Some DISTRO_ROCKY
| Some DISTRO_ORACLE_LINUX
| Some DISTRO_REDHAT_BASED
Expand Down
13 changes: 12 additions & 1 deletion daemon/inspect_fs_unix.ml
Expand Up @@ -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_circle= PCRE.compile "Circle Linux.*release (\\d+)\\.(\\d+)"
let re_circle_no_minor = PCRE.compile "Circle Linux.*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 =
Expand Down Expand Up @@ -111,7 +113,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_ROCKY);
| { distro = Some (DISTRO_DEBIAN|DISTRO_CENTOS|DISTRO_CIRCLE|DISTRO_ROCKY);
version = Some (_, 0) } ->
false

Expand Down Expand Up @@ -145,6 +147,7 @@ and distro_of_os_release_id = function
| "altlinux" -> Some DISTRO_ALTLINUX
| "arch" -> Some DISTRO_ARCHLINUX
| "centos" -> Some DISTRO_CENTOS
| "circle" -> Some DISTRO_CIRCLE
| "coreos" -> Some DISTRO_COREOS
| "debian" -> Some DISTRO_DEBIAN
| "fedora" -> Some DISTRO_FEDORA
Expand Down Expand Up @@ -415,6 +418,10 @@ let linux_root_tests : tests = [
DISTRO_CENTOS;
"/etc/centos-release", parse_generic ~rex:re_centos_no_minor
DISTRO_CENTOS;
"/etc/circle-release", parse_generic ~rex:re_circle
DISTRO_CIRCLE;
"/etc/circle-release", parse_generic ~rex:re_circle_no_minor
DISTRO_CIRCLE;
"/etc/rocky-release", parse_generic ~rex:re_rocky
DISTRO_ROCKY;
"/etc/rocky-release", parse_generic ~rex:re_rocky_no_minor
Expand All @@ -434,6 +441,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_circle
DISTRO_CIRCLE;
"/etc/redhat-release", parse_generic ~rex:re_circle_no_minor
DISTRO_CIRCLE;
"/etc/redhat-release", parse_generic ~rex:re_rocky
DISTRO_ROCKY;
"/etc/redhat-release", parse_generic ~rex:re_rocky_no_minor
Expand Down
2 changes: 2 additions & 0 deletions daemon/inspect_types.ml
Expand Up @@ -71,6 +71,7 @@ and distro =
| DISTRO_ARCHLINUX
| DISTRO_BUILDROOT
| DISTRO_CENTOS
| DISTRO_CIRCLE
| DISTRO_CIRROS
| DISTRO_COREOS
| DISTRO_DEBIAN
Expand Down Expand Up @@ -208,6 +209,7 @@ and string_of_distro = function
| DISTRO_ARCHLINUX -> "archlinux"
| DISTRO_BUILDROOT -> "buildroot"
| DISTRO_CENTOS -> "centos"
| DISTRO_CIRCLE -> "circle"
| DISTRO_CIRROS -> "cirros"
| DISTRO_COREOS -> "coreos"
| DISTRO_DEBIAN -> "debian"
Expand Down
1 change: 1 addition & 0 deletions daemon/inspect_types.mli
Expand Up @@ -78,6 +78,7 @@ and distro =
| DISTRO_ARCHLINUX
| DISTRO_BUILDROOT
| DISTRO_CENTOS
| DISTRO_CIRCLE
| DISTRO_CIRROS
| DISTRO_COREOS
| DISTRO_DEBIAN
Expand Down
4 changes: 4 additions & 0 deletions generator/actions_inspection.ml
Expand Up @@ -178,6 +178,10 @@ Buildroot-derived distro, but not one we specifically recognize.
CentOS.
=item \"circle\"
Circle Linux.
=item \"cirros\"
Cirros.
Expand Down
1 change: 1 addition & 0 deletions lib/inspect-icon.c
Expand Up @@ -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, "circle") ||
STREQ (distro, "rocky") ||
STREQ (distro, "scientificlinux") ||
STREQ (distro, "oraclelinux")) {
Expand Down
4 changes: 4 additions & 0 deletions lib/inspect-osinfo.c
Expand Up @@ -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, "circle")) {
if (major >= 8)
return safe_asprintf (g, "%s%d", distro, major);
}
else if (STREQ (distro, "rocky")) {
if (major >= 8)
return safe_asprintf (g, "%s%d", distro, major);
Expand Down

0 comments on commit 72f9981

Please sign in to comment.