[bootloader] Modifications

- add more debug informations
- simplify gpt detection code
This commit is contained in:
Philip 2015-02-22 17:34:12 +01:00
parent 43ccfbd9bd
commit fe7c5bbe77

View File

@ -107,6 +107,7 @@ def create_loader(loader_path):
def install_gummiboot(efi_directory):
print("Bootloader: gummiboot")
install_path = libcalamares.globalstorage.value("rootMountPoint")
install_efi_directory = install_path + efi_directory
fallback_kernel_line = libcalamares.job.configuration["fallbackKernelLine"]
@ -134,6 +135,7 @@ def install_gummiboot(efi_directory):
def install_grub(efi_directory, fw_type):
if fw_type == "efi":
print("Bootloader: grub (efi)")
efi_directory_firmware = efi_directory + "/EFI"
check_chroot_call(["mkdir", "-p", "{!s}".format(efi_directory)])
if "efiBootloaderId" in libcalamares.job.configuration:
@ -153,6 +155,7 @@ def install_grub(efi_directory, fw_type):
efi_bootloader_id),
"{!s}/boot/bootx64.efi".format(efi_directory_firmware)])
else:
print("Bootloader: grub (bios)")
boot_loader = libcalamares.globalstorage.value("bootLoader")
check_chroot_call(
[libcalamares.job.configuration["grubInstall"], "--target=i386-pc",
@ -182,8 +185,9 @@ def prepare_bootloader(fw_type):
print("EFI directory: \"{!s}\"".format(efi_directory))
print("Boot partition: \"{!s}\"".format(boot_p))
print("Boot device: \"{!s}\"".format(device))
print("Set EF00 flag")
subprocess.call(["sgdisk", "--typecode={!s}:EF00".format(boot_p), "{!s}".format(device)])
else:
if fw_type != "efi":
partitions = libcalamares.globalstorage.value("partitions")
boot_p = ""
device = ""
@ -194,23 +198,25 @@ def prepare_bootloader(fw_type):
boot_p = boot_device[-1:]
device = boot_device[:-1]
use_boot = True
print("Partition (/boot): \"{!s}\"".format(boot_p))
print("Device: \"{!s}\"".format(device))
if (not use_boot and partition["mountPoint"] == "/"):
boot_device = partition["device"]
boot_p = 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):
return ("Boot partition: \"{!s}\"",
"Boot device: \"{!s}\"".format(boot_p,device))
else:
print("Boot partition: \"{!s}\"".format(boot_p))
print("Boot device: \"{!s}\"".format(device))
return ("Boot partition not found!",
"Partition: \"{!s}\"",
"Device: \"{!s}\"".format(boot_p,device))
process = subprocess.Popen(["parted", "{!s}".format(device),
"--list"], stdout=subprocess.PIPE)
for line in process.stdout:
for part in line.split():
if "gpt" in part:
subprocess.call(["parted", "{!s}".format(device),
"set {!s} bios_grub on".format(boot_p)])
if b"gpt" in line:
subprocess.call(["parted", "{!s}".format(device),
"set {!s} bios_grub on".format(boot_p)])
if (efi_boot_loader == "gummiboot" and fw_type == "efi"):
install_gummiboot(efi_directory)
else: