!80 fix grub file for system option
From: @xuezhizone Reviewed-by: @xingwei-liu Signed-off-by: @xingwei-liu
This commit is contained in:
commit
c0ee17c3bd
111
0027-fix-grub-file-for-system-option.patch
Normal file
111
0027-fix-grub-file-for-system-option.patch
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
From b47bd5687781d5c82d1cd267c11c690fd01c5317 Mon Sep 17 00:00:00 2001
|
||||||
|
From: xuezhixin <xuezhixin@uniontech.com>
|
||||||
|
Date: Fri, 10 Nov 2023 10:57:31 +0800
|
||||||
|
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=81=E7=A7=BB=E5=90=8E?=
|
||||||
|
=?UTF-8?q?=E5=BC=95=E5=AF=BC=E9=A1=B9=E8=A6=86=E7=9B=96=E7=B3=BB=E7=BB=9F?=
|
||||||
|
=?UTF-8?q?=E4=B8=8D=E5=85=A8=E7=9A=84=E9=97=AE=E9=A2=98?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
---
|
||||||
|
sysmig_agent/share.py | 53 ++++++++++++++++++++++++++++++-------------
|
||||||
|
1 file changed, 37 insertions(+), 16 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sysmig_agent/share.py b/sysmig_agent/share.py
|
||||||
|
index 3e7bb30..68fcfa0 100644
|
||||||
|
--- a/sysmig_agent/share.py
|
||||||
|
+++ b/sysmig_agent/share.py
|
||||||
|
@@ -106,6 +106,8 @@ def local_disabled_release_repo():
|
||||||
|
os.remove(fpath)
|
||||||
|
|
||||||
|
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def getSysMigConf():
|
||||||
|
confpath = '/etc/migration-tools/migration-tools.conf'
|
||||||
|
if not os.path.exists(confpath):
|
||||||
|
@@ -234,45 +236,64 @@ def process_special_pkgs():
|
||||||
|
|
||||||
|
|
||||||
|
def title_conf(oldosname):
|
||||||
|
- oldosname=oldosname.strip()
|
||||||
|
+ """
|
||||||
|
+ Change the boot start option after system migration
|
||||||
|
+ :param oldosname:old system name
|
||||||
|
+ :return:
|
||||||
|
+ """
|
||||||
|
+ oldosname = oldosname.strip()
|
||||||
|
+ if oldosname == 'redhat':
|
||||||
|
+ capital = 'Red Hat'
|
||||||
|
+ elif oldosname == 'centos':
|
||||||
|
+ capital = 'CentOS'
|
||||||
|
path = '/boot/loader/entries'
|
||||||
|
- #path='/root/a'
|
||||||
|
+ # path='/root/a'
|
||||||
|
if os.path.exists(path):
|
||||||
|
file_list = os.listdir(path)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
fl = False
|
||||||
|
for file in file_list:
|
||||||
|
- fpath = os.path.join(path,file)
|
||||||
|
+ fpath = os.path.join(path, file)
|
||||||
|
if os.path.isdir(fpath):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
- with open(fpath,'r') as fp:
|
||||||
|
+ with open(fpath, 'r') as fp:
|
||||||
|
strall = fp.read()
|
||||||
|
fp.close()
|
||||||
|
- if re.search('uniontech',strall,re.IGNORECASE):
|
||||||
|
+ if re.search('uniontech', strall, re.IGNORECASE):
|
||||||
|
fl = True
|
||||||
|
for file in file_list:
|
||||||
|
- ustr=None
|
||||||
|
- fpath = os.path.join(path,file)
|
||||||
|
+ ustr = None
|
||||||
|
+ brackets = ""
|
||||||
|
+ fpath = os.path.join(path, file)
|
||||||
|
if os.path.isdir(fpath):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
- with open(fpath,'r') as fp:
|
||||||
|
+ with open(fpath, 'r') as fp:
|
||||||
|
strall = fp.read()
|
||||||
|
fp.close()
|
||||||
|
- if re.search(oldosname,strall,re.IGNORECASE):
|
||||||
|
+ '''
|
||||||
|
+ if re.search(oldosname, strall, re.IGNORECASE):
|
||||||
|
if fl:
|
||||||
|
os.remove(fpath)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
- ustr = re.sub(oldosname,"UniontechOS",strall,1,flags=re.IGNORECASE)
|
||||||
|
- if re.search('8 \(Core\)',strall):
|
||||||
|
- ustr = re.sub(' 8 ',' 20 ',ustr,1,flags=re.IGNORECASE)
|
||||||
|
- ustr = re.sub("Core","kongzi",ustr,1,flags=re.IGNORECASE)
|
||||||
|
- with open(fpath,'w') as ptitle:
|
||||||
|
- ptitle.write(ustr)
|
||||||
|
- ptitle.close()
|
||||||
|
+ print(strall,capital)
|
||||||
|
+ ustr = re.sub(capital, "UniontechOS", strall, 1, flags=re.IGNORECASE)
|
||||||
|
+ '''
|
||||||
|
+ if re.search(capital, strall):
|
||||||
|
+ line = strall.split('\n', -1)[0]
|
||||||
|
+ for char in range(len(line)):
|
||||||
|
+ if line[char] == '(':
|
||||||
|
+ p = char
|
||||||
|
+ continue
|
||||||
|
+ if line[char] == ')':
|
||||||
|
+ e = char+1
|
||||||
|
+ brackets = line[p:e]
|
||||||
|
+ break
|
||||||
|
+ title = 'title UniontechOS Linux ' + brackets + ' 20 (kongzi)'
|
||||||
|
+ open(fpath, 'w').write(strall.replace(line, title))
|
||||||
|
|
||||||
|
|
||||||
|
def main_conf(osname):
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: migration-tools
|
Name: migration-tools
|
||||||
Version: 1.0.2
|
Version: 1.0.2
|
||||||
Release: 26
|
Release: 27
|
||||||
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
|
||||||
@ -33,6 +33,8 @@ Patch23: 0023-update-the-status-of-the-migration-phase.patch
|
|||||||
Patch24: 0024-add-url-processing-function.patch
|
Patch24: 0024-add-url-processing-function.patch
|
||||||
Patch25: 0025-update-migration-status-to-database.patch
|
Patch25: 0025-update-migration-status-to-database.patch
|
||||||
Patch26: 0026-create-repository-and-disable-local-repofile.patch
|
Patch26: 0026-create-repository-and-disable-local-repofile.patch
|
||||||
|
Patch27: 0027-fix-grub-file-for-system-option.patch
|
||||||
|
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
@ -131,6 +133,9 @@ rm -rf /usr/bin/migration-tools
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-27
|
||||||
|
- 0027-fix-grub-file-for-system-option.patch
|
||||||
|
|
||||||
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-26
|
* Tue Nov 5 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.2-26
|
||||||
- 0026-create-repository-and-disable-local-repofile.patch
|
- 0026-create-repository-and-disable-local-repofile.patch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user