From 4d1b1f24898d4082ecc43737ccec1d23477d0791 Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Tue, 5 Nov 2024 16:30:11 +0800 Subject: [PATCH] create reposotory and disable the local repository file --- ...epository-and-disable-local-repofile.patch | 55 +++++++++++++++++++ migration-tools.spec | 7 ++- 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 0026-create-repository-and-disable-local-repofile.patch diff --git a/0026-create-repository-and-disable-local-repofile.patch b/0026-create-repository-and-disable-local-repofile.patch new file mode 100644 index 0000000..99d145e --- /dev/null +++ b/0026-create-repository-and-disable-local-repofile.patch @@ -0,0 +1,55 @@ +From a5919afd74bff0611aed9f1ebe2064a51c4031e5 Mon Sep 17 00:00:00 2001 +From: xuezhixin +Date: Fri, 10 Nov 2023 10:51:43 +0800 +Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=BF=81=E7=A7=BB=E8=BD=AF?= + =?UTF-8?q?=E4=BB=B6=E6=BA=90=EF=BC=8C=E8=87=AA=E5=8A=A8disable=E6=8E=89?= + =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=BB=98=E8=AE=A4=E7=9A=84=E8=BD=AF=E4=BB=B6?= + =?UTF-8?q?=E6=BA=90?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + sysmig_agent/share.py | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/sysmig_agent/share.py b/sysmig_agent/share.py +index a3b2c2d..3e7bb30 100644 +--- a/sysmig_agent/share.py ++++ b/sysmig_agent/share.py +@@ -79,6 +79,32 @@ def abi_file_connect(sql_r): + s = DBHelper() + ret_sql_msg = s.execute(abi_sql) + ++def local_disabled_release_repo(): ++ """ ++ 将系统内存在的repository文件置为不可用,只保留switch-to-uos.repo ++ :return: ++ """ ++ path = '/etc/yum.repos.d' ++ if os.path.exists(path): ++ file_list = os.listdir(path) ++ for file in file_list: ++ fpath = os.path.join(path, file) ++ if os.path.isdir(fpath): ++ continue ++ else: ++ if re.fullmatch('switch-to-uos.repo', file, re.IGNORECASE): ++ continue ++ elif not re.search('repo', file, re.IGNORECASE): ++ continue ++ with open(fpath, 'r') as fdst: ++ allrepo = fdst.read() ++ fdst.close() ++ with open(fpath + '.disabled', 'w+') as fdst: ++ fdst.write( ++ '#This is a yum repository file that was disabled . \n' + allrepo) ++ fdst.close() ++ os.remove(fpath) ++ + + def getSysMigConf(): + confpath = '/etc/migration-tools/migration-tools.conf' +-- +2.20.1 + diff --git a/migration-tools.spec b/migration-tools.spec index f6f1ae0..bad86a5 100644 --- a/migration-tools.spec +++ b/migration-tools.spec @@ -1,6 +1,6 @@ Name: migration-tools Version: 1.0.2 -Release: 25 +Release: 26 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 @@ -32,7 +32,7 @@ Patch22: 0022-udpate-agent-host-status-online.patch Patch23: 0023-update-the-status-of-the-migration-phase.patch Patch24: 0024-add-url-processing-function.patch Patch25: 0025-update-migration-status-to-database.patch - +Patch26: 0026-create-repository-and-disable-local-repofile.patch BuildArch: noarch BuildRequires: systemd @@ -131,6 +131,9 @@ rm -rf /usr/bin/migration-tools %endif %changelog +* Tue Nov 5 2024 xuezhixin - 1.0.2-26 +- 0026-create-repository-and-disable-local-repofile.patch + * Tue Nov 5 2024 xuezhixin - 1.0.2-25 - 0025-update-migration-status-to-database.patch -- Gitee