56 lines
1.9 KiB
Diff
56 lines
1.9 KiB
Diff
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
|
||
|