From 580bf4d9ce645a3933c30e51da42eb2b5fc9fa45 Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 19 Jul 2021 15:52:56 +0800 Subject: [PATCH] [os support] add uniontech os support Signed-off-by: liugang --- add-uniontech-os-support.patch | 45 ++++++++++++++++++++++++++++++++++ sos.spec | 6 ++++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 add-uniontech-os-support.patch diff --git a/add-uniontech-os-support.patch b/add-uniontech-os-support.patch new file mode 100644 index 0000000..c865c31 --- /dev/null +++ b/add-uniontech-os-support.patch @@ -0,0 +1,45 @@ +From dcb9273e1f5f55fec2957629a5a69ca396f28c51 Mon Sep 17 00:00:00 2001 +From: root +Date: Mon, 19 Jul 2021 15:48:03 +0800 +Subject: [PATCH] add uniontech os support + +--- + sos/policies/uniontech.py | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + create mode 100644 sos/policies/uniontech.py + +diff --git a/sos/policies/uniontech.py b/sos/policies/uniontech.py +new file mode 100644 +index 0000000..cd30136 +--- /dev/null ++++ b/sos/policies/uniontech.py +@@ -0,0 +1,26 @@ ++from __future__ import print_function ++ ++from sos.plugins import RedHatPlugin ++from sos.policies.redhat import RedHatPolicy, OS_RELEASE ++import os ++ ++class UnionTechPolicy(RedHatPolicy): ++ ++ distro = "UnionTech" ++ vendor = "the UnionTech Project" ++ vendor_url = "https://www.chinauos.com/" ++ ++ def __init__(self, sysroot=None): ++ super(UnionTechPolicy, self).__init__(sysroot=sysroot) ++ ++ @classmethod ++ def check(cls): ++ 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 'UnionTech' in line: ++ return True ++ return False +-- +2.23.0 + diff --git a/sos.spec b/sos.spec index f47a3a5..178e581 100644 --- a/sos.spec +++ b/sos.spec @@ -2,7 +2,7 @@ Name: sos Version: 4.0 -Release: 3 +Release: 4 Summary: A set of tools to gather troubleshooting information from a system License: GPLv2+ URL: https://github.com/sosreport/sos @@ -10,6 +10,7 @@ Source0: https://github.com/sosreport/sos/archive/%{version}.tar.gz#/%{nam Patch6000: backport-Fix-dict-order-py38-incompatibility.patch Patch9000: openEuler-add-openEuler-policy.patch +Patch9001: add-uniontech-os-support.patch BuildRequires: python3-devel gettext Requires: libxml2-python3 bzip2 xz python3-rpm tar python3-pexpect @@ -58,6 +59,9 @@ install -m 644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf %{_mandir}/man5/* %changelog +* Mon Jul 19 2021 liugang - 4.0-4 +- add UnionTech policy + * Mon Mar 08 2021 shixuantong - 4.0-3 - add openEuler policy