Do not ask for EFI GRUB installation when installing onto MBR disk

This commit is contained in:
Fierelier 2023-08-01 15:59:14 +02:00
parent 23d8b676da
commit ddeec85174
1 changed files with 9 additions and 8 deletions

View File

@ -269,10 +269,10 @@ def main():
formatEsp = False
if gptInfo["espFormatted"] == False:
formatEsp = choiceYn("The disk's ESP partition (" +gptInfo["espPart"]+ ") does not seem to be formatted correctly. Format it?")
defaultChoice = "i386"
if callString(["uname","-m"]) == "x86_64": defaultChoice = "x86_64"
grubVersion = choice("Which version of EFI GRUB should be installed? Note that 'both' is not always compatible.",["i386","x86_64","both"],defaultChoice)
defaultChoice = "i386"
if callString(["uname","-m"]) == "x86_64": defaultChoice = "x86_64"
grubVersion = choice("Which version of EFI GRUB should be installed? Note that 'both' is not always compatible.",["i386","x86_64","both"],defaultChoice)
print("")
print("The rest of this setup will continue without your input ...")
@ -401,10 +401,11 @@ def main():
call(["mount",gptInfo["espPart"],ipth("boot/efi")])
print("Installing GRUB (EFI) ...")
if grubVersion in ["i386","both"]:
chroot(ipth(),["grub-install","--target=i386-efi","--uefi-secure-boot","--efi-directory=/boot/efi","--boot-directory=/boot",grubDisk])
if grubVersion in ["x86_64","both"]:
chroot(ipth(),["grub-install","--target=x86_64-efi","--uefi-secure-boot","--efi-directory=/boot/efi","--boot-directory=/boot",grubDisk])
grubTargets = []
if grubVersion in ["i386","both"]: grubTargets.append("i386-efi")
if grubVersion in ["x86_64","both"]: grubTargets.append("amd64-efi")
for target in grubTargets:
chroot(ipth(),["grub-install","--target=" +target,"--uefi-secure-boot","--efi-directory=/boot/efi","--boot-directory=/boot","--force-extra-removable","--no-nvram",grubDisk])
print("Unmounting ESP ...")
call(["umount","-l",ipth("boot/efi")])