From a1ecfdad4c1187ccd645615b4b7b0e431e8a2d9d Mon Sep 17 00:00:00 2001
From: Watson Sato <wsato@redhat.com>
Date: Mon, 7 Dec 2020 11:11:48 +0100
Subject: [PATCH] Check kernel osrelease instead of using uname test
Check /proc/sys/kernel/osrelease to get arch of system.
uname test is not supported in offline mode
---
...oc_sys_kernel_osrelease_arch_not_s390x.xml | 34 +++++++++++++++++++
3 files changed, 35 insertions(+), 29 deletions(-)
create mode 100644 shared/checks/oval/proc_sys_kernel_osrelease_arch_not_s390x.xml
diff --git a/shared/checks/oval/proc_sys_kernel_osrelease_arch_not_s390x.xml b/shared/checks/oval/proc_sys_kernel_osrelease_arch_not_s390x.xml
new file mode 100644
index 0000000000..1fc625a1e7
--- /dev/null
+++ b/shared/checks/oval/proc_sys_kernel_osrelease_arch_not_s390x.xml
@@ -0,0 +1,34 @@
+<def-group>
+ <definition class="inventory" id="proc_sys_kernel_osrelease_arch_not_s390x"
+ version="1">
+ <metadata>
+ <title>Test for different architecture than s390x</title>
+ <affected family="unix">
+ <platform>multi_platform_all</platform>
+ </affected>
+ <description>Check that architecture of kernel in /proc/sys/kernel/osrelease is not s390x</description>
+ </metadata>
+ <criteria>
+ <criterion comment="Architecture is not s390x"
+ test_ref="test_proc_sys_kernel_osrelease_arch_s390x" negate="true"/>
+ </criteria>
+ </definition>
+ <ind:textfilecontent54_test check="all" check_existence="all_exist"
+ comment="proc_sys_kernel is for s390x architecture"
+ id="test_proc_sys_kernel_osrelease_arch_s390x"
+ version="1">
+ <ind:object object_ref="object_proc_sys_kernel_osrelease_arch_s390x" />
+ <ind:state state_ref="state_proc_sys_kernel_osrelease_arch_s390x" />
+ </ind:textfilecontent54_test>
+
+ <ind:textfilecontent54_object id="object_proc_sys_kernel_osrelease_arch_s390x" version="1">
+ <ind:filepath>/proc/sys/kernel/osrelease</ind:filepath>
+ <ind:pattern operation="pattern match">^.*\.(.*)$</ind:pattern>
+ <ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
+ </ind:textfilecontent54_object>
+
+ <ind:textfilecontent54_state id="state_proc_sys_kernel_osrelease_arch_s390x" version="1">
+ <ind:subexpression datatype="string" operation="pattern match">^s390x$</ind:subexpression>
+ </ind:textfilecontent54_state>
+
+</def-group>