diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index efca4a1b8..ef8216361 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -29,17 +29,6 @@ import subprocess from libcalamares.utils import check_chroot_call -def detect_firmware_type(): - # Check for EFI variables support - if(os.path.exists("/sys/firmware/efi/efivars")): - fw_type = 'efi' - else: - fw_type = 'bios' - - libcalamares.globalstorage.insert("firmwareType", fw_type) - libcalamares.utils.debug("Firmware type: {!s}".format(fw_type)) - - def get_uuid(): root_mount_point = libcalamares.globalstorage.value("rootMountPoint") print(root_mount_point) @@ -158,7 +147,6 @@ def install_bootloader(boot_loader, fw_type): def run(): - detect_firmware_type() boot_loader = libcalamares.globalstorage.value("bootLoader") fw_type = libcalamares.globalstorage.value("firmwareType") install_bootloader(boot_loader, fw_type) diff --git a/src/modules/grub/main.py b/src/modules/grub/main.py index 1e8cb7a35..000623cdc 100644 --- a/src/modules/grub/main.py +++ b/src/modules/grub/main.py @@ -23,17 +23,6 @@ import libcalamares from libcalamares.utils import check_chroot_call -def detect_firmware_type(): - # Check for EFI variables support - if(os.path.exists("/sys/firmware/efi/efivars")): - fw_type = 'efi' - else: - fw_type = 'bios' - - libcalamares.globalstorage.insert("firmwareType", fw_type) - libcalamares.utils.debug("Firmware type: {!s}".format(fw_type)) - - def install_grub(boot_loader, fw_type): if fw_type == 'efi': efi_directory = "/boot/efi" @@ -49,7 +38,6 @@ def install_grub(boot_loader, fw_type): def run(): - detect_firmware_type() boot_loader = libcalamares.globalstorage.value("bootLoader") fw_type = libcalamares.globalstorage.value("firmwareType") install_grub(boot_loader, fw_type) diff --git a/src/modules/prepare/PrepareViewStep.cpp b/src/modules/prepare/PrepareViewStep.cpp index ef6c24a65..58eb480f2 100644 --- a/src/modules/prepare/PrepareViewStep.cpp +++ b/src/modules/prepare/PrepareViewStep.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -133,6 +134,9 @@ PrepareViewStep::PrepareViewStep( QObject* parent ) m_nextEnabled = canGoNext; emit nextStatusChanged( m_nextEnabled ); + if ( canGoNext ) + detectFirmwareType(); + timer->deleteLater(); } ); timer->start( 0 ); @@ -363,3 +367,10 @@ PrepareViewStep::checkHasInternet() return nmState == NM_STATE_CONNECTED_GLOBAL; } + +void +PrepareViewStep::detectFirmwareType() +{ + QString fwType = QFile::exists( "/sys/firmware/efi/efivars" ) ? "efi" : "bios"; + Calamares::JobQueue::instance()->globalStorage()->insert( "firmwareType", fwType ); +} diff --git a/src/modules/prepare/PrepareViewStep.h b/src/modules/prepare/PrepareViewStep.h index 3b9ada8f2..cf13a908b 100644 --- a/src/modules/prepare/PrepareViewStep.h +++ b/src/modules/prepare/PrepareViewStep.h @@ -75,6 +75,7 @@ private: bool checkBatteryExists(); bool checkHasPower(); bool checkHasInternet(); + void detectFirmwareType(); QWidget* m_widget; qreal m_requiredStorageGB;