From 2be33254274159375af1783396ee30b4c696d7c1 Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 10:06:58 +0800
Subject: [PATCH] =?UTF-8?q?ABI=E6=8A=A5=E5=91=8A=E5=A2=9E=E5=8A=A0?=
 =?UTF-8?q?=E5=86=85=E6=A0=B8=E6=A3=80=E6=B5=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 sysmig_agent/Abisystmcompchk.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
index abe6083..fdbe2e2 100644
--- a/sysmig_agent/Abisystmcompchk.py
+++ b/sysmig_agent/Abisystmcompchk.py
@@ -113,4 +113,22 @@ def abi_check_sys():
     return None
 
 ######################## add for test end ########################
-######################## add for test end ########################
\ No newline at end of file
+######################## add for test end ########################
+
+#20220107 add by lihp
+#20220112 modify by lihp: add deal kernel migration fail
+def platform_release(Flag):
+    if Flag == '0':
+        cmd = "rpm -qa | grep kernel | grep -E 'an7|an8|el7|el8'"
+    else:
+        cmd = "rpm -qa | grep kernel | grep -E 'el7|el8|an7|an8|uelc'"
+    kernel_version=''
+    for line in os.popen(cmd):
+        pattern = re.compile(r'^[-+]?[-0-9]\d*\.\d*|[-+]?\.?[0-9]\d*$')
+        if pattern.match(line[7]):
+            kernel_version = line.split('-',1)[1]
+            if 'uelc' in line:
+                break
+            elif 'oe1' in line:
+                break
+    return kernel_version.rsplit('.', 1)[0]
-- 
2.20.1

