修复openeuler迁移问题
(cherry picked from commit 22ca63384f669047d4259d746d6c07601bc3bf6c)
This commit is contained in:
parent
ac057d0979
commit
6f446918f2
32
0002-fix-uefi-boot-failed.patch
Normal file
32
0002-fix-uefi-boot-failed.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From b7df99566ea6988c5411468b2b9d7e02f25bc85a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Super User <root@localhost.localdomain>
|
||||||
|
Date: Wed, 6 Sep 2023 17:14:29 +0800
|
||||||
|
Subject: [PATCH] allow uefi boot
|
||||||
|
|
||||||
|
---
|
||||||
|
.../centos7/openeuler/centos72openeuler.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/ut-Migration-tools/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py b/ut-Migration-tools/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
||||||
|
index 1cedebf..f24d765 100644
|
||||||
|
--- a/ut-Migration-tools/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
||||||
|
+++ b/ut-Migration-tools/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
||||||
|
@@ -195,7 +195,6 @@ def main():
|
||||||
|
|
||||||
|
if system_sync():
|
||||||
|
subprocess.run('dnf -y groupinstall Minimal Install', shell=True)
|
||||||
|
- conf_grub()
|
||||||
|
else:
|
||||||
|
print("Removing confilct package yum...")
|
||||||
|
os.system("rpm -e --nodeps yum")
|
||||||
|
@@ -216,6 +215,7 @@ def main():
|
||||||
|
if os.path.exists(yum_conflict_dir):
|
||||||
|
shutil.rmtree(yum_conflict_dir)
|
||||||
|
print("Installing yum...")
|
||||||
|
+ conf_grub()
|
||||||
|
run_subprocess('dnf install -y yum'.split())
|
||||||
|
|
||||||
|
print("System migration completed, rebooting system")
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
72
0003-modify-grub-rules-to-match-NIC-name.patch
Normal file
72
0003-modify-grub-rules-to-match-NIC-name.patch
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
From 76920b1ab0b7204c2feaf7dc2fa04b6d72730b5a Mon Sep 17 00:00:00 2001
|
||||||
|
From: lixin <lixinb@uniontech.com>
|
||||||
|
Date: Wed, 6 Sep 2023 17:23:29 +0800
|
||||||
|
Subject: [PATCH] modify grub rules to match NIC name
|
||||||
|
|
||||||
|
---
|
||||||
|
.../centos7/openeuler/centos72openeuler.py | 41 ++++++++++++++++++-
|
||||||
|
1 file changed, 40 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/ut-Migration-tools/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py b/ut-Migration-tools/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
||||||
|
index f24d765..2be7b6b 100644
|
||||||
|
--- a/ut-Migration-tools/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
||||||
|
+++ b/ut-Migration-tools/ut-Migration-tools-0.1/centos7/openeuler/centos72openeuler.py
|
||||||
|
@@ -83,6 +83,43 @@ def add_boot_option():
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
+
|
||||||
|
+def set_grub_biosdev_rules():
|
||||||
|
+ """
|
||||||
|
+ Set grub bisodev rule which can be don`t modify network configuration names.
|
||||||
|
+ When the leapp has been made initrd, the function will set net.ifnames in /etc/default/grub.
|
||||||
|
+ Returns:
|
||||||
|
+ """
|
||||||
|
+ default_grub_path = "/etc/default/grub"
|
||||||
|
+ set_content = "net.ifnames=0 biosdevname=0"
|
||||||
|
+ if not os.path.exists(default_grub_path):
|
||||||
|
+ return
|
||||||
|
+ with open(default_grub_path, 'r') as gf:
|
||||||
|
+ gret = gf.readlines()
|
||||||
|
+ gf.close()
|
||||||
|
+ grub_content = ''
|
||||||
|
+ for i in range(len(gret)):
|
||||||
|
+ if "GRUB_CMDLINE_LINUX" in gret[i]:
|
||||||
|
+ cmdline_tmp = gret[i].split('"', -1)[1]
|
||||||
|
+ grub_content += 'GRUB_CMDLINE_LINUX="' + cmdline_tmp + ' ' + set_content + '"\n'
|
||||||
|
+ continue
|
||||||
|
+ grub_content += gret[i]
|
||||||
|
+ try:
|
||||||
|
+ if not os.path.exists(default_grub_path + '.disable'):
|
||||||
|
+ shutil.copyfile(default_grub_path, default_grub_path + '.disable')
|
||||||
|
+ os.remove(default_grub_path)
|
||||||
|
+ else:
|
||||||
|
+ print("grub file has been modified")
|
||||||
|
+ return
|
||||||
|
+ except Exception as e:
|
||||||
|
+ print(e)
|
||||||
|
+ return
|
||||||
|
+ with open(default_grub_path, 'w+') as wgf:
|
||||||
|
+ wgf.write(grub_content)
|
||||||
|
+ wgf.close()
|
||||||
|
+ return True
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def swap_release(release):
|
||||||
|
tmp_dir = '/var/tmp'
|
||||||
|
rpme_release = 'rpm -qf /etc/os-release | xargs -i rpm -e --nodeps {}'
|
||||||
|
@@ -214,8 +251,10 @@ def main():
|
||||||
|
yum_conflict_dir = '/etc/yum/'
|
||||||
|
if os.path.exists(yum_conflict_dir):
|
||||||
|
shutil.rmtree(yum_conflict_dir)
|
||||||
|
- print("Installing yum...")
|
||||||
|
+ print("Configuring grub...")
|
||||||
|
+ set_grub_biosdev_rules()
|
||||||
|
conf_grub()
|
||||||
|
+ print("Installing yum...")
|
||||||
|
run_subprocess('dnf install -y yum'.split())
|
||||||
|
|
||||||
|
print("System migration completed, rebooting system")
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
@ -1,10 +1,12 @@
|
|||||||
Name: migration-tools
|
Name: migration-tools
|
||||||
Version: 1.0.0
|
Version: 1.0.0
|
||||||
Release: 3
|
Release: 4
|
||||||
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
|
||||||
License: MulanPSL-2.0
|
License: MulanPSL-2.0
|
||||||
Source0: ut-Migration-tools.tar.gz
|
Source0: ut-Migration-tools.tar.gz
|
||||||
Patch0: 0001-fix-export-error-and-no-migration-details-issue.patch
|
Patch0: 0001-fix-export-error-and-no-migration-details-issue.patch
|
||||||
|
Patch1: 0002-fix-uefi-boot-failed.patch
|
||||||
|
Patch2: 0003-modify-grub-rules-to-match-NIC-name.patch
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%description
|
%description
|
||||||
UOS Migration Software
|
UOS Migration Software
|
||||||
@ -26,6 +28,8 @@ Migration software server side
|
|||||||
%prep
|
%prep
|
||||||
%setup -c
|
%setup -c
|
||||||
%patch 0 -p1
|
%patch 0 -p1
|
||||||
|
%patch 1 -p1
|
||||||
|
%patch 2 -p1
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
@ -61,6 +65,10 @@ rm -rf /usr/lib/systemd/system/migration-tools-server.service
|
|||||||
/usr/lib/migration-tools-server
|
/usr/lib/migration-tools-server
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Sep 06 2023 lixin <lixinb@uniontech.com> - 1.0.0-4
|
||||||
|
- fix: fix uefi boot failed
|
||||||
|
- fix: modify grub rules to match NIC name after migration
|
||||||
|
|
||||||
* Tue Aug 22 2023 lixin <lixinb@uniontech.com> - 1.0.0-3
|
* Tue Aug 22 2023 lixin <lixinb@uniontech.com> - 1.0.0-3
|
||||||
- feat: add aarch64 agent package
|
- feat: add aarch64 agent package
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user