!203 fix a mistake about revert "Set default entry to the BLS id instead of the entry index"

From: @wanglu210 
Reviewed-by: @anonymous_z 
Signed-off-by: @anonymous_z
This commit is contained in:
openeuler-ci-bot 2022-08-06 07:25:31 +00:00 committed by Gitee
commit 9d555c9a48
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,7 @@
%define _empty_manifest_terminate_build 0
Name: anaconda
Version: 33.19
Release: 44
Release: 45
Summary: Graphical system installer
License: GPLv2+ and MIT
URL: http://fedoraproject.org/wiki/Anaconda
@ -365,6 +365,12 @@ update-desktop-database &> /dev/null || :
%{_prefix}/libexec/anaconda/dd_*
%changelog
* Fri Aug 5 2022 wanglu <wanglu210@huawei.com> - 33.19-45
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix a mistake about revert "Set default entry to the BLS id instead of the entry index"
* Thu Aug 4 2022 wanglu <wanglu210@huawei.com> - 33.19-44
- Type:bugfix
- CVE:NA

View File

@ -29,16 +29,16 @@ index 3209ab7..6a6441b 100644
-
- default_entry = "%s-%s" % (machine_id, self.default.version)
- rc = util.execInSysroot("grub2-set-default", [default_entry])
+ #find the index of the default image
+ # find the index of the default image
+ try:
+ default_index = self.images.index(self.default)
+ except VauleError:
+ 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.exeInSysroot("grub2-set-default", [str(default_index)])
+ rc = util.execInSysroot("grub2-set-default", [str(default_index)])
if rc:
log.error("failed to set default menu entry to %s", productName)