54 lines
1.5 KiB
Diff
54 lines
1.5 KiB
Diff
From 143db4a9516bd0e1c4c4b1e8a7aa91c04ee1699e Mon Sep 17 00:00:00 2001
|
|
From: jxy_git <jiangxinyu@kylinos.cn>
|
|
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
|
|
|