Skip to content

Commit 34e3dbc

Browse files
marta-lewandowskanfrayer
authored andcommitted
grub-install on EFI if forced
UEFI Secure Boot requires signed grub binaries to work, so grub- install should not be used. However, users who have Secure Boot disabled and wish to use the command should not be prevented from doing so if they invoke --force. fixes bz#1917213 / bz#2240994 Signed-off-by: Marta Lewandowska <[email protected]>
1 parent 69d8c2e commit 34e3dbc

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

util/grub-install.c

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -899,22 +899,6 @@ main (int argc, char *argv[])
899899

900900
platform = grub_install_get_target (grub_install_source_directory);
901901

902-
switch (platform)
903-
{
904-
case GRUB_INSTALL_PLATFORM_ARM_EFI:
905-
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
906-
case GRUB_INSTALL_PLATFORM_I386_EFI:
907-
case GRUB_INSTALL_PLATFORM_IA64_EFI:
908-
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
909-
is_efi = 1;
910-
grub_util_error (_("this utility cannot be used for EFI platforms"
911-
" because it does not support UEFI Secure Boot"));
912-
break;
913-
default:
914-
is_efi = 0;
915-
break;
916-
}
917-
918902
{
919903
char *platname = grub_install_get_platform_name (platform);
920904
fprintf (stderr, _("Installing for %s platform.\n"), platname);
@@ -1027,6 +1011,32 @@ main (int argc, char *argv[])
10271011
grub_hostfs_init ();
10281012
grub_host_init ();
10291013

1014+
switch (platform)
1015+
{
1016+
case GRUB_INSTALL_PLATFORM_I386_EFI:
1017+
case GRUB_INSTALL_PLATFORM_X86_64_EFI:
1018+
case GRUB_INSTALL_PLATFORM_ARM_EFI:
1019+
case GRUB_INSTALL_PLATFORM_ARM64_EFI:
1020+
case GRUB_INSTALL_PLATFORM_RISCV32_EFI:
1021+
case GRUB_INSTALL_PLATFORM_RISCV64_EFI:
1022+
case GRUB_INSTALL_PLATFORM_IA64_EFI:
1023+
is_efi = 1;
1024+
if (!force)
1025+
grub_util_error (_("This utility should not be used for EFI platforms"
1026+
" because it does not support UEFI Secure Boot."
1027+
" If you really wish to proceed, invoke the --force"
1028+
" option.\nMake sure Secure Boot is disabled before"
1029+
" proceeding"));
1030+
break;
1031+
default:
1032+
is_efi = 0;
1033+
break;
1034+
1035+
/* pacify warning. */
1036+
case GRUB_INSTALL_PLATFORM_MAX:
1037+
break;
1038+
}
1039+
10301040
/* Find the EFI System Partition. */
10311041
if (is_efi)
10321042
{

0 commit comments

Comments
 (0)