From 103d2cfcdbc7096ac0fa2298ee6f4ec6948c3b6a Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Fri, 10 Nov 2023 13:59:30 +0800
Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E8=BF=87=E7=A8=8B=E5=8F=AF?=
 =?UTF-8?q?=E9=80=89=E6=8B=A9=E4=B8=8D=E8=BF=81=E7=A7=BB=E5=86=85=E6=A0=B8?=
 =?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 sysmig_agent/migration.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/sysmig_agent/migration.py b/sysmig_agent/migration.py
index 76b3b8e..e510680 100644
--- a/sysmig_agent/migration.py
+++ b/sysmig_agent/migration.py
@@ -103,3 +103,21 @@ def Sysmig(kernel_version):
             run_cmd2file(cmd)
             sql_mig_statue('3')
 
+
+def ifnot_mig_kernel(kernel_version):
+    with open('/etc/yum.conf', 'r') as f:
+        content = f.read()
+        f.close()
+    if re.search(r'^distroverpkg=', content, re.MULTILINE):
+        content = re.sub(r"\n(distroverpkg=)", r"\n#\1", content)
+    if re.search(r'bugtracker_url=', content, re.MULTILINE):
+        content = re.sub(r"\n(bugtracker_url=)", r"\n#\1", content)
+    with open('/etc/yum.conf', 'w') as f:
+        f.write(content)
+        f.close()
+    if kernel_version == '0' or kernel_version == '3.10.0':
+        kernel_patterns = 'exclude= kernel* kernel-tools python3-perf kernel-headers kernel-devel bpftool perf kernel-core kmod-kvdo kpatch glibc-headers \n'
+        with open('/etc/yum.conf', 'a+') as f:
+            f.write(kernel_patterns)
+            f.close()
+
-- 
2.20.1

