From d179a9e3b12083f894aa9e72b944b81df38fc3c1 Mon Sep 17 00:00:00 2001 From: crispg72 Date: Tue, 24 Oct 2017 20:32:15 +0100 Subject: [PATCH 1/3] Tidied up bitness check --- src/modules/bootloader/main.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index ecc305503..7c3684c8c 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -235,10 +235,18 @@ def install_grub(efi_directory, fw_type): # if the kernel is older than 4.0, the UEFI bitness likely isn't # exposed to the userspace so we assume a 64 bit UEFI here efi_bitness = "64" - bitness_translate = {"32": "--target=i386-efi", - "64": "--target=x86_64-efi"} + + if efi_bitness == "32": + efi_target = "i386-efi" + efi_grub_file = "grubia32.efi" + efi_boot_file = "bootia32.efi" + elif efi_bitness == "64": + efi_target = "x86_64-efi" + efi_grub_file = "grubx64.efi" + efi_boot_file = "bootx64.efi" + check_target_env_call([libcalamares.job.configuration["grubInstall"], - bitness_translate[efi_bitness], + "--target=" + efi_target, "--efi-directory=" + efi_directory, "--bootloader-id=" + efi_bootloader_id, "--force"]) @@ -260,19 +268,13 @@ def install_grub(efi_directory, fw_type): os.makedirs(install_efi_boot_directory) # Workaround for some UEFI firmwares - efi_file_source = {"32": os.path.join(install_efi_directory_firmware, - efi_bootloader_id, - "grubia32.efi"), - "64": os.path.join(install_efi_directory_firmware, - efi_bootloader_id, - "grubx64.efi")} - - efi_file_target = {"32": os.path.join(install_efi_boot_directory, - "bootia32.efi"), - "64": os.path.join(install_efi_boot_directory, - "bootx64.efi")} - - shutil.copy2(efi_file_source[efi_bitness], efi_file_target[efi_bitness]) + efi_file_source = os.path.join(install_efi_directory_firmware, + efi_bootloader_id, + efi_grub_file), + efi_file_target = os.path.join(install_efi_boot_directory, + efi_boot_file), + + shutil.copy2(efi_file_source, efi_file_target) else: print("Bootloader: grub (bios)") if libcalamares.globalstorage.value("bootLoader") is None: From cc6db5b8089f92859ea5823993bd1fd95b5eb14d Mon Sep 17 00:00:00 2001 From: Bezzy1999 Date: Wed, 25 Oct 2017 18:45:58 +0100 Subject: [PATCH 2/3] pep8 --- src/modules/bootloader/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index 7c3684c8c..e64a4c13b 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -269,10 +269,10 @@ def install_grub(efi_directory, fw_type): # Workaround for some UEFI firmwares efi_file_source = os.path.join(install_efi_directory_firmware, - efi_bootloader_id, - efi_grub_file), + efi_bootloader_id, + efi_grub_file), efi_file_target = os.path.join(install_efi_boot_directory, - efi_boot_file), + efi_boot_file), shutil.copy2(efi_file_source, efi_file_target) else: From 17fb91cda5bd7bd3dbf1e9cc8ae345196e7a306b Mon Sep 17 00:00:00 2001 From: Bezzy1999 Date: Wed, 25 Oct 2017 18:47:23 +0100 Subject: [PATCH 3/3] added my name --- src/modules/bootloader/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index e64a4c13b..cb94ae45d 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -13,6 +13,7 @@ # Copyright 2017, Alf Gaida # Copyright 2017, Adriaan de Groot # Copyright 2017, Gabriel Craciunescu +# Copyright 2017, Ben Green # # Calamares is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by