[bootloader] Modifications
- add more debug informations - simplify gpt detection code
This commit is contained in:
parent
43ccfbd9bd
commit
fe7c5bbe77
@ -107,6 +107,7 @@ def create_loader(loader_path):
|
|||||||
|
|
||||||
|
|
||||||
def install_gummiboot(efi_directory):
|
def install_gummiboot(efi_directory):
|
||||||
|
print("Bootloader: gummiboot")
|
||||||
install_path = libcalamares.globalstorage.value("rootMountPoint")
|
install_path = libcalamares.globalstorage.value("rootMountPoint")
|
||||||
install_efi_directory = install_path + efi_directory
|
install_efi_directory = install_path + efi_directory
|
||||||
fallback_kernel_line = libcalamares.job.configuration["fallbackKernelLine"]
|
fallback_kernel_line = libcalamares.job.configuration["fallbackKernelLine"]
|
||||||
@ -134,6 +135,7 @@ def install_gummiboot(efi_directory):
|
|||||||
|
|
||||||
def install_grub(efi_directory, fw_type):
|
def install_grub(efi_directory, fw_type):
|
||||||
if fw_type == "efi":
|
if fw_type == "efi":
|
||||||
|
print("Bootloader: grub (efi)")
|
||||||
efi_directory_firmware = efi_directory + "/EFI"
|
efi_directory_firmware = efi_directory + "/EFI"
|
||||||
check_chroot_call(["mkdir", "-p", "{!s}".format(efi_directory)])
|
check_chroot_call(["mkdir", "-p", "{!s}".format(efi_directory)])
|
||||||
if "efiBootloaderId" in libcalamares.job.configuration:
|
if "efiBootloaderId" in libcalamares.job.configuration:
|
||||||
@ -153,6 +155,7 @@ def install_grub(efi_directory, fw_type):
|
|||||||
efi_bootloader_id),
|
efi_bootloader_id),
|
||||||
"{!s}/boot/bootx64.efi".format(efi_directory_firmware)])
|
"{!s}/boot/bootx64.efi".format(efi_directory_firmware)])
|
||||||
else:
|
else:
|
||||||
|
print("Bootloader: grub (bios)")
|
||||||
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
boot_loader = libcalamares.globalstorage.value("bootLoader")
|
||||||
check_chroot_call(
|
check_chroot_call(
|
||||||
[libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
|
[libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
|
||||||
@ -182,8 +185,9 @@ def prepare_bootloader(fw_type):
|
|||||||
print("EFI directory: \"{!s}\"".format(efi_directory))
|
print("EFI directory: \"{!s}\"".format(efi_directory))
|
||||||
print("Boot partition: \"{!s}\"".format(boot_p))
|
print("Boot partition: \"{!s}\"".format(boot_p))
|
||||||
print("Boot device: \"{!s}\"".format(device))
|
print("Boot device: \"{!s}\"".format(device))
|
||||||
|
print("Set EF00 flag")
|
||||||
subprocess.call(["sgdisk", "--typecode={!s}:EF00".format(boot_p), "{!s}".format(device)])
|
subprocess.call(["sgdisk", "--typecode={!s}:EF00".format(boot_p), "{!s}".format(device)])
|
||||||
else:
|
if fw_type != "efi":
|
||||||
partitions = libcalamares.globalstorage.value("partitions")
|
partitions = libcalamares.globalstorage.value("partitions")
|
||||||
boot_p = ""
|
boot_p = ""
|
||||||
device = ""
|
device = ""
|
||||||
@ -194,21 +198,23 @@ def prepare_bootloader(fw_type):
|
|||||||
boot_p = boot_device[-1:]
|
boot_p = boot_device[-1:]
|
||||||
device = boot_device[:-1]
|
device = boot_device[:-1]
|
||||||
use_boot = True
|
use_boot = True
|
||||||
|
print("Partition (/boot): \"{!s}\"".format(boot_p))
|
||||||
|
print("Device: \"{!s}\"".format(device))
|
||||||
if (not use_boot and partition["mountPoint"] == "/"):
|
if (not use_boot and partition["mountPoint"] == "/"):
|
||||||
boot_device = partition["device"]
|
boot_device = partition["device"]
|
||||||
boot_p = boot_device[-1:]
|
boot_p = boot_device[-1:]
|
||||||
device = boot_device[:-1]
|
device = boot_device[:-1]
|
||||||
|
print("Partition (/): \"{!s}\"".format(boot_p))
|
||||||
|
print("Device: \"{!s}\"".format(device))
|
||||||
if (not boot_p or not device):
|
if (not boot_p or not device):
|
||||||
return ("Boot partition: \"{!s}\"",
|
return ("Boot partition not found!",
|
||||||
"Boot device: \"{!s}\"".format(boot_p,device))
|
"Partition: \"{!s}\"",
|
||||||
else:
|
"Device: \"{!s}\"".format(boot_p,device))
|
||||||
print("Boot partition: \"{!s}\"".format(boot_p))
|
|
||||||
print("Boot device: \"{!s}\"".format(device))
|
|
||||||
process = subprocess.Popen(["parted", "{!s}".format(device),
|
process = subprocess.Popen(["parted", "{!s}".format(device),
|
||||||
"--list"], stdout=subprocess.PIPE)
|
"--list"], stdout=subprocess.PIPE)
|
||||||
for line in process.stdout:
|
for line in process.stdout:
|
||||||
for part in line.split():
|
if b"gpt" in line:
|
||||||
if "gpt" in part:
|
|
||||||
subprocess.call(["parted", "{!s}".format(device),
|
subprocess.call(["parted", "{!s}".format(device),
|
||||||
"set {!s} bios_grub on".format(boot_p)])
|
"set {!s} bios_grub on".format(boot_p)])
|
||||||
if (efi_boot_loader == "gummiboot" and fw_type == "efi"):
|
if (efi_boot_loader == "gummiboot" and fw_type == "efi"):
|
||||||
|
Loading…
Reference in New Issue
Block a user