!324 revert Set default entry to the BLS id instead of the entry index

From: @sun_hai_10 
Reviewed-by: @t_feng 
Signed-off-by: @t_feng
This commit is contained in:
openeuler-ci-bot 2023-12-23 11:43:37 +00:00 committed by Gitee
commit e12577b0c4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 59 additions and 1 deletions

View File

@ -1,7 +1,7 @@
%define _empty_manifest_terminate_build 0
Name: anaconda
Version: 36.16.5
Release: 25
Release: 26
Summary: Graphical system installer
License: GPLv2+ and MIT
URL: http://fedoraproject.org/wiki/Anaconda
@ -56,6 +56,8 @@ Patch6009: backport-Fix-the-systemd-generator-for-systemd-253-2165433.patch
Patch9023: bugfix-change-root-and-storage-interface-shows.patch
Patch9024: bugfix-revert-Set-default-entry-to-the-BLS-id-instead-of-the-entry-index.patch
%define dasbusver 1.3
%define dbusver 1.2.3
%define dnfver 3.6.0
@ -309,6 +311,12 @@ update-desktop-database &> /dev/null || :
%{_prefix}/libexec/anaconda/dd_*
%changelog
* Sat Dec 23 2023 sunhai <sunhai10@huawei.com> - 36.16.5-26
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: revert "Set default entry to the BLS id instead of the entry index"
* Sat Sep 23 2023 wangyueliang <wangyueliang@kylinos.cn> - 36.16.5-25
- Type:feature
- ID:NA

View File

@ -0,0 +1,50 @@
From 971650357e4d7228cfa95ea01bc61e69715b159c Mon Sep 17 00:00:00 2001
From: zhangqiumiao <zhangqiumiao1@huawei.com>
Date: Thu, 29 Apr 2021 09:09:10 -0400
Subject: [PATCH] revert "Set default entry to the BLS id instead of the entry index"
revert the patch of "Set default entry to the BLS id instead of the entry index"
Reference: https://github.com/rhinstaller/anaconda/commit/a252e4424bd51d6236d3b7b8e3840d8ca0af90a2
Conflict: https://github.com/rhinstaller/anaconda/commit/a252e4424bd51d6236d3b7b8e3840d8ca0af90a2
---
.../modules/storage/bootloader/grub2.py | 24 ++++++++-----------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/pyanaconda/modules/storage/bootloader/grub2.py b/pyanaconda/modules/storage/bootloader/grub2.py
index 48ca354..964c56a 100644
--- a/pyanaconda/modules/storage/bootloader/grub2.py
+++ b/pyanaconda/modules/storage/bootloader/grub2.py
@@ -335,20 +335,16 @@ class GRUB2(BootLoader):
# make sure the default entry is the OS we are installing
if self.default is not None:
- machine_id_path = conf.target.system_root + "/etc/machine-id"
- if not os.access(machine_id_path, os.R_OK):
- log.error("failed to read machine-id, default entry not set")
- return
-
- with open(machine_id_path, "r") as fd:
- machine_id = fd.readline().strip()
-
- default_entry = "%s-%s" % (machine_id, self.default.version)
- rc = util.execWithRedirect(
- "grub2-set-default",
- [default_entry],
- root=conf.target.system_root
- )
+ # find the index of the default image
+ try:
+ default_index = self.images.index(self.default)
+ except ValueError:
+ # pylint: disable=no-member
+ log.warning("Failed to find default image (%s), defaulting to 0",
+ self.default.label)
+ default_index = 0
+
+ rc = util.execInSysroot("grub2-set-default", [str(default_index)])
if rc:
log.error("failed to set default menu entry to %s", productName)
--
2.19.1