From d47d7f55da5d2bb824dacab08979a780efd407b7 Mon Sep 17 00:00:00 2001 From: jxy_git Date: Mon, 6 Nov 2023 17:39:17 +0800 Subject: [PATCH] add Kylin policy --- add-Kylin-OS-support.patch | 53 ++++++++++++++++++++++++++++++++++++++ sos.spec | 6 ++++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 add-Kylin-OS-support.patch diff --git a/add-Kylin-OS-support.patch b/add-Kylin-OS-support.patch new file mode 100644 index 0000000..4d31180 --- /dev/null +++ b/add-Kylin-OS-support.patch @@ -0,0 +1,53 @@ +From 143db4a9516bd0e1c4c4b1e8a7aa91c04ee1699e Mon Sep 17 00:00:00 2001 +From: jxy_git +Date: Mon, 6 Nov 2023 17:31:38 +0800 +Subject: [PATCH] add Kylin OS support + +--- + sos/policies/Kylin.py | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + create mode 100644 sos/policies/Kylin.py + +diff --git a/sos/policies/Kylin.py b/sos/policies/Kylin.py +new file mode 100644 +index 0000000..dbbb229 +--- /dev/null ++++ b/sos/policies/Kylin.py +@@ -0,0 +1,34 @@ ++from sos.policies.redhat import RedHatPolicy, OS_RELEASE ++import os ++ ++class KylinPolicy(RedHatPolicy): ++ ++ distro = "Kylin Linux Advanced Server" ++ vendor = "Kylin" ++ vendor_urls = [ ++ ('Distribution Website', 'https://www.kylinos.cn/'), ++ ('Vendor Website', 'https://www.kylinos.cn/') ++ ] ++ ++ def __init__(self, sysroot=None, init=None, probe_runtime=True, ++ remote_exec=None): ++ super(KylinPolicy, self).__init__(sysroot=sysroot, init=init, ++ probe_runtime=probe_runtime, ++ remote_exec=remote_exec) ++ ++ @classmethod ++ def check(cls, remote=''): ++ ++ if remote: ++ return cls.distro in remote ++ ++ if not os.path.exists(OS_RELEASE): ++ return False ++ ++ with open(OS_RELEASE, 'r') as f: ++ for line in f: ++ if line.startswith('NAME'): ++ if 'Kylin Linux' in line: ++ return True ++ return False ++ +-- +2.33.0 + diff --git a/sos.spec b/sos.spec index 0fb6516..e1371d5 100644 --- a/sos.spec +++ b/sos.spec @@ -2,7 +2,7 @@ Name: sos Version: 4.5.6 -Release: 1 +Release: 2 Summary: A set of tools to gather troubleshooting information from a system License: GPLv2+ URL: https://github.com/sosreport/sos @@ -12,6 +12,7 @@ Patch9000: openEuler-add-openEuler-policy.patch Patch9001: add-uniontech-os-support.patch Patch9002: Fix-sos-command-failed-in-sos-4.0.patch Patch9003: add-KylinSec-OS-support.patch +Patch9004: add-Kylin-OS-support.patch BuildRequires: python3-devel gettext Requires: bzip2 xz python3-rpm tar python3-pexpect @@ -66,6 +67,9 @@ rm -rf ${RPM_BUILD_ROOT}/usr/config/ %{_mandir}/man5/* %changelog +* Mon Nov 06 2023 jiangxinyu - 4.5.6-2 +- add Kylin policy + * Thu Jul 27 2023 dillon chen < dillon.chen@gmail.com> - 4.5.6-1 - update to 4.5.6 -- Gitee