From 938295d7e264022e82cd8c7213879d96c7c62949 Mon Sep 17 00:00:00 2001 From: Matthew Bardsley <43888969+mhbardsley@users.noreply.github.com> Date: Wed, 15 May 2024 16:29:29 +0100 Subject: [PATCH] Parse generated/utsversion.h to parse the Kernel Version on newer COS kernels (#80) --- pkg/operatingsystem/cos/kernel-package.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/operatingsystem/cos/kernel-package.go b/pkg/operatingsystem/cos/kernel-package.go index 15e2de7..ff9f4ee 100644 --- a/pkg/operatingsystem/cos/kernel-package.go +++ b/pkg/operatingsystem/cos/kernel-package.go @@ -219,11 +219,11 @@ func extractKernelDetails(buildID string, kernelHeaders io.Reader, kp *operating } kp.KernelRelease = components[0] case tar.TypeReg: - // Read kernel version and machine from generated/compile.h + // Read kernel version and machine from generated/compile.h and generated/utsversion.h if kp.KernelVersion != "" && kp.KernelMachine != "" { continue } - if !strings.Contains(header.Name, "generated/compile.h") { + if !(strings.Contains(header.Name, "generated/compile.h") || strings.Contains(header.Name, "generated/utsversion.h")) { continue } scanner := bufio.NewScanner(extractedKernelHeaders)