create reposotory and disable the local repository file

This commit is contained in:
xuezhixin 2024-11-05 16:30:11 +08:00
parent 0d1b7637e4
commit 4d1b1f2489
2 changed files with 60 additions and 2 deletions

View File

@ -0,0 +1,55 @@
From a5919afd74bff0611aed9f1ebe2064a51c4031e5 Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
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 . <Migration to UiniontechOS>\n' + allrepo)
+ fdst.close()
+ os.remove(fpath)
+
def getSysMigConf():
confpath = '/etc/migration-tools/migration-tools.conf'
--
2.20.1

View File

@ -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 <xuezhixin@uniontech.com> - 1.0.2-26
- 0026-create-repository-and-disable-local-repofile.patch
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-25
- 0025-update-migration-status-to-database.patch