49 lines
1.4 KiB
Diff
49 lines
1.4 KiB
Diff
From ddede462f885e6a5826cefad49fbb6815436a593 Mon Sep 17 00:00:00 2001
|
|
From: panchenbo <panchenbo@uniontech.com>
|
|
Date: Tue, 25 May 2021 11:22:56 +0800
|
|
Subject: [PATCH] add UnionTech policy
|
|
|
|
---
|
|
sos/policies/UnionTech.py | 29 +++++++++++++++++++++++++++++
|
|
1 file changed, 29 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..7fbd42c
|
|
--- /dev/null
|
|
+++ b/sos/policies/UnionTech.py
|
|
@@ -0,0 +1,29 @@
|
|
+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):
|
|
+ """This method checks to see if we are running on UnionTechOS. It returns
|
|
+ True or False."""
|
|
+ try:
|
|
+ with open("/etc/UnionTech-release", "r") as f:
|
|
+ return "uos" in f.read()
|
|
+ except IOError:
|
|
+ return False
|
|
+
|
|
+ def UnionTech_version(self):
|
|
+ pkg = self.pkg_by_name("UnionTech-release") or \
|
|
+ self.all_pkgs_by_name_regex("UnionTech-release-.*")[-1]
|
|
+ return int(pkg["version"])
|
|
--
|
|
2.20.1
|
|
|