From 0c292330626680d8551d189dc8cc498ddcf9c50a Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 16 Sep 2016 10:52:42 +0200 Subject: [PATCH 1/2] Warning in debug output when the RequirementsChecker is misconfigured. CAL-390 #close --- src/modules/welcome/WelcomeViewStep.cpp | 4 ++++ .../welcome/checker/RequirementsChecker.cpp | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/modules/welcome/WelcomeViewStep.cpp b/src/modules/welcome/WelcomeViewStep.cpp index ca24254e8..3c9d29993 100644 --- a/src/modules/welcome/WelcomeViewStep.cpp +++ b/src/modules/welcome/WelcomeViewStep.cpp @@ -20,6 +20,7 @@ #include "WelcomePage.h" #include "checker/RequirementsChecker.h" +#include "utils/Logger.h" #include @@ -128,5 +129,8 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap ) if ( configurationMap.contains( "requirements" ) && configurationMap.value( "requirements" ).type() == QVariant::Map ) m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() ); + else + cDebug() << "WARNING: no valid requirements map found in welcome " + "module configuration."; } diff --git a/src/modules/welcome/checker/RequirementsChecker.cpp b/src/modules/welcome/checker/RequirementsChecker.cpp index 0a7233e3d..a8207a876 100644 --- a/src/modules/welcome/checker/RequirementsChecker.cpp +++ b/src/modules/welcome/checker/RequirementsChecker.cpp @@ -185,6 +185,7 @@ RequirementsChecker::widget() const void RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) { + bool incompleteConfiguration = false; if ( configurationMap.contains( "requiredStorage" ) && ( configurationMap.value( "requiredStorage" ).type() == QVariant::Double || configurationMap.value( "requiredStorage" ).type() == QVariant::Int ) ) @@ -199,6 +200,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) else { m_requiredStorageGB = 3.; + incompleteConfiguration = true; } if ( configurationMap.contains( "requiredRam" ) && @@ -208,11 +210,15 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) bool ok = false; m_requiredRamGB = configurationMap.value( "requiredRam" ).toDouble( &ok ); if ( !ok ) + { m_requiredRamGB = 1.; + incompleteConfiguration = true; + } } else { m_requiredRamGB = 1.; + incompleteConfiguration = true; } if ( configurationMap.contains( "check" ) && @@ -221,6 +227,8 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) m_entriesToCheck.clear(); m_entriesToCheck.append( configurationMap.value( "check" ).toStringList() ); } + else + incompleteConfiguration = true; if ( configurationMap.contains( "required" ) && configurationMap.value( "required" ).type() == QVariant::List ) @@ -228,6 +236,19 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) m_entriesToRequire.clear(); m_entriesToRequire.append( configurationMap.value( "required" ).toStringList() ); } + else + incompleteConfiguration = true; + + if ( incompleteConfiguration ) + { + cDebug() << "WARNING: The RequirementsChecker configuration map provided by " + "the welcome module configuration file is incomplete or " + "incorrect.\n" + "Startup will continue for debugging purposes, but one or " + "more checks might not function correctly.\n" + "RequirementsChecker configuration map:\n" + << configurationMap; + } } From 77fb264129d9cf97202e5a07aa694d66083aee4f Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 16 Sep 2016 16:30:17 +0200 Subject: [PATCH 2/2] Fix VFAT filename handling in bootloader module. CAL-385 #close --- src/modules/bootloader/main.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index e0125ee64..d292de6fd 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -220,15 +220,14 @@ def install_grub(efi_directory, fw_type): "--force"]) # VFAT is weird, see issue CAL-385 - efi_directory_firmware = case_insensitive_subdir(efi_directory, - ["EFI", "Efi", "efi"]) - if not efi_directory_firmware: - efi_directory_firmware = os.path.join(efi_directory, "EFI") + efi_directory_firmware = os.path.join(efi_directory, "EFI") + if os.path.exists(efi_directory_firmware): + efi_directory_firmware = vfat_correct_case(efi_directory, "EFI") - efi_boot_directory = case_insensitive_subdir(efi_directory_firmware, - ["Boot", "boot", "BOOT"]) - if not efi_boot_directory: - efi_boot_directory = os.path.join(efi_directory_firmware, "boot") + efi_boot_directory = os.path.join(efi_directory_firmware, "boot") + if os.path.exists(efi_boot_directory): + efi_boot_directory = vfat_correct_case(efi_directory_firmware, "boot") + else: check_target_env_call(["mkdir", "-p", efi_boot_directory]) # Workaround for some UEFI firmwares @@ -251,11 +250,11 @@ def install_grub(efi_directory, fw_type): libcalamares.job.configuration["grubCfg"]]) -def case_insensitive_subdir(parent, candidate_dirnames): - for dirname in candidate_dirnames: - if os.path.isdir(os.path.join(parent, dirname)): - return os.path.join(parent, dirname) - return "" +def vfat_correct_case(parent, name): + for candidate in os.listdir(parent): + if name.lower() == candidate.lower(): + return candidate + return os.path.join(parent, name) def prepare_bootloader(fw_type):