the migration process can choose not to migrate the kernel

This commit is contained in:
xuezhixin 2024-11-05 20:31:49 +08:00
parent 8560a779b9
commit e5e74e7727
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,43 @@
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

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.2
Release: 34
Release: 35
License: MulanPSL-2.0
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
Source0: %{name}-%{version}.tar.gz
@ -41,6 +41,7 @@ Patch31: 0031-migration-check-and-extract-macros.patch
Patch32: 0032-add-migration.py-to-migration-function.patch
Patch33: 0033-check-system-kernrel.patch
Patch34: 0034-add-centos7-and-centos8-migration-interface.patch
Patch35: 0035-the-migration-process-can-choose-not-to-migrate-the-kernel.patch
BuildArch: noarch
@ -140,6 +141,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-35
- 0035-the-migration-process-can-choose-not-to-migrate-the-kernel.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-34
- 0034-add-centos7-and-centos8-migration-interface.patch