!157 update the initiazation repo file
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
6040f272e4
86
0019-update-the-initilization-repo-file.patch
Normal file
86
0019-update-the-initilization-repo-file.patch
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
From 0e49cc38358147a06f2ddcb0888553eb57e47274 Mon Sep 17 00:00:00 2001
|
||||||
|
From: xuezhixin <xuezhixin@uniontech.com>
|
||||||
|
Date: Tue, 14 Nov 2023 09:37:02 +0800
|
||||||
|
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=9D=E5=A7=8B=E5=8C=96re?=
|
||||||
|
=?UTF-8?q?pos=E6=96=87=E4=BB=B6?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
---
|
||||||
|
sysmig_agent/short_task.py | 46 ++++++++++++++++++++++++--------------
|
||||||
|
1 file changed, 29 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sysmig_agent/short_task.py b/sysmig_agent/short_task.py
|
||||||
|
index 4e4dae3..2ef4ac6 100644
|
||||||
|
--- a/sysmig_agent/short_task.py
|
||||||
|
+++ b/sysmig_agent/short_task.py
|
||||||
|
@@ -160,36 +160,48 @@ def init_remove_oldrepo():
|
||||||
|
os.remove(path_file)
|
||||||
|
|
||||||
|
|
||||||
|
-#初始化repo文件
|
||||||
|
+# 初始化repo文件
|
||||||
|
def initRepoFile(baseurl):
|
||||||
|
os_version_ret = platform.dist()
|
||||||
|
- version = os_version_ret[1].split('.',-1)
|
||||||
|
- reposdir = '/etc/yum.repos.d/'
|
||||||
|
+ version = os_version_ret[1].split('.', -1)
|
||||||
|
+ AGENT_OS = os_version_ret[0] + version[0]
|
||||||
|
+ if re.search('7', AGENT_OS):
|
||||||
|
+ reposdir = '/etc/yum.repos.d/'
|
||||||
|
+ else:
|
||||||
|
+ reposdir = '/etc/yum.repos.d/'
|
||||||
|
+ # reposdir = dnf.Base().conf.get_reposdir
|
||||||
|
h = 0
|
||||||
|
- if re.match('file:',baseurl):
|
||||||
|
- str0, path = baseurl.split('://',1)
|
||||||
|
+ if re.search('file', baseurl):
|
||||||
|
+ str0, path = baseurl.split('://', 1)
|
||||||
|
path = '/' + path.strip('/') + '/'
|
||||||
|
else:
|
||||||
|
- h = 1
|
||||||
|
- if re.fullmatch('8',version[0]):
|
||||||
|
- path_appstream = baseurl+'/AppStream'
|
||||||
|
- path_baseos = baseurl+'/BaseOS'
|
||||||
|
- path_310 = baseurl+'/kernel-3.10'
|
||||||
|
- path_419 = baseurl+'/kernel419'
|
||||||
|
- path_510 = baseurl+'/kernel510'
|
||||||
|
+ h = 1
|
||||||
|
+ if re.fullmatch('8', version[0]):
|
||||||
|
+ path_appstream = baseurl + '/AppStream'
|
||||||
|
+ path_baseos = baseurl + '/BaseOS'
|
||||||
|
+ path_310 = baseurl + '/kernel-3.10'
|
||||||
|
+ path_418 = baseurl + '/kernel-4.18'
|
||||||
|
+ path_419 = baseurl + '/kernel419'
|
||||||
|
+ path_510 = baseurl + '/kernel510'
|
||||||
|
|
||||||
|
- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+path_appstream.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = '''+path_baseos.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = '''+path_419.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = '''+path_510.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n
|
||||||
|
+ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = ''' + path_appstream.strip(
|
||||||
|
+ '\n') + '''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-BaseOS]\nname = UniontechOS BaseOS\nbaseurl = ''' + path_baseos.strip(
|
||||||
|
+ '\n') + '''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-4.18.0]\nname = UniontechOS Kernel-4.18.0\nbaseurl = ''' + path_418.strip(
|
||||||
|
+ '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-4.19.0]\nname = UniontechOS Kernel-4.19.0\nbaseurl = ''' + path_419.strip(
|
||||||
|
+ '\n') + '''\nenabled = 1\ngpgcheck = 0\nskip_if_unavailable = 1\n\n[UniontechOS-kernel-5.10.0]\nname = UniontechOS Kernel-5.10.0\nbaseurl = ''' + path_510.strip(
|
||||||
|
+ '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n\n
|
||||||
|
'''
|
||||||
|
else:
|
||||||
|
- path_310 = baseurl+'/kernel-3.10'
|
||||||
|
- repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = '''+baseurl.strip('\n')+'''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = '''+path_310.strip('\n')+'''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n
|
||||||
|
+ path_310 = baseurl + '/kernel-3.10'
|
||||||
|
+ repostr_uos = '''[UniontechOS-AppStream]\nname = UniontechOS AppStream\nbaseurl = ''' + baseurl.strip(
|
||||||
|
+ '\n') + '''\nenabled = 1\ngpgcheck = 0\n\n[UniontechOS-kernel-3.10.0]\nname = UniontechOS Kernel-3.10.0\nbaseurl = ''' + path_310.strip(
|
||||||
|
+ '\n') + '''\nenabled = 0\ngpgcheck = 0\nskip_if_unavailable = 1\n
|
||||||
|
'''
|
||||||
|
repofile = os.path.join(reposdir, 'switch-to-uos.repo')
|
||||||
|
- with open(repofile,'w') as f_repo:
|
||||||
|
+ with open(repofile, 'w') as f_repo:
|
||||||
|
f_repo.write(repostr_uos)
|
||||||
|
f_repo.close()
|
||||||
|
|
||||||
|
-
|
||||||
|
#检测repo文件创建缓存
|
||||||
|
def checkRepoMakeCache():
|
||||||
|
os.system('yum clean all')
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: migration-tools
|
Name: migration-tools
|
||||||
Version: 1.0.3
|
Version: 1.0.3
|
||||||
Release: 18
|
Release: 19
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
@ -25,6 +25,8 @@ Patch015: 0015-agent-sends-the-task-after-receving-the-request.patch
|
|||||||
Patch016: 0016-export-migration-log.patch
|
Patch016: 0016-export-migration-log.patch
|
||||||
Patch017: 0017-add-task-to-check-repo.patch
|
Patch017: 0017-add-task-to-check-repo.patch
|
||||||
Patch018: 0018-add-interface-in-agent.patch
|
Patch018: 0018-add-interface-in-agent.patch
|
||||||
|
Patch019: 0019-update-the-initilization-repo-file.patch
|
||||||
|
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
@ -123,6 +125,9 @@ rm -rf /usr/bin/migration-tools
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-19
|
||||||
|
- 0019-update-the-initilization-repo-file.patch
|
||||||
|
|
||||||
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-18
|
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-18
|
||||||
- 0018-add-interface-in-agent.patch
|
- 0018-add-interface-in-agent.patch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user