uefi: Do not get the custom ESP location from libfwup

This commit is contained in:
Richard Hughes 2018-06-25 15:55:59 +01:00
parent fb0e94857f
commit cff980cfda

View File

@ -660,31 +660,6 @@ fu_plugin_uefi_test_secure_boot (FuPlugin *plugin)
fu_plugin_add_report_metadata (plugin, "SecureBoot", result_str); fu_plugin_add_report_metadata (plugin, "SecureBoot", result_str);
} }
static gboolean
fu_plugin_uefi_set_custom_mountpoint (FuPlugin *plugin, GError **error)
{
FuPluginData *data = fu_plugin_get_data (plugin);
const gchar *key = "OverrideESPMountPoint";
/* load from file and keep @key ref'd for the lifetime of the plugin as
* libfwupdate does not strdup the value in fwup_set_esp_mountpoint() */
data->esp_path = fu_plugin_get_config_value (plugin, key);
if (data->esp_path != NULL) {
if (!g_file_test (data->esp_path, G_FILE_TEST_IS_DIR)) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE,
"Invalid %s specified in %s config: %s",
fu_plugin_get_name (plugin), key,
data->esp_path);
return FALSE;
}
fwup_set_esp_mountpoint (data->esp_path);
}
return TRUE;
}
static gboolean static gboolean
fu_plugin_uefi_delete_old_capsules (FuPlugin *plugin, GError **error) fu_plugin_uefi_delete_old_capsules (FuPlugin *plugin, GError **error)
{ {
@ -738,6 +713,7 @@ gboolean
fu_plugin_startup (FuPlugin *plugin, GError **error) fu_plugin_startup (FuPlugin *plugin, GError **error)
{ {
FuPluginData *data = fu_plugin_get_data (plugin); FuPluginData *data = fu_plugin_get_data (plugin);
const gchar *key = "OverrideESPMountPoint";
/* get the supported status */ /* get the supported status */
data->esrt_status = fwup_supported (); data->esrt_status = fwup_supported ();
@ -753,15 +729,19 @@ fu_plugin_startup (FuPlugin *plugin, GError **error)
if (!fu_uefi_vars_supported (error)) if (!fu_uefi_vars_supported (error))
return FALSE; return FALSE;
/* load any overriden options */ /* load from file */
if (!fu_plugin_uefi_set_custom_mountpoint (plugin, error)) data->esp_path = fu_plugin_get_config_value (plugin, key);
return FALSE; if (data->esp_path != NULL) {
if (!g_file_test (data->esp_path, G_FILE_TEST_IS_DIR)) {
/* get the default compiled-in value for the ESP mountpoint */ g_set_error (error,
#ifdef HAVE_FWUP_GET_ESP_MOUNTPOINT FWUPD_ERROR,
if (data->esp_path == NULL) FWUPD_ERROR_INVALID_FILE,
data->esp_path = g_strdup (fwup_get_esp_mountpoint ()); "Invalid %s specified in %s config: %s",
#endif fu_plugin_get_name (plugin), key,
data->esp_path);
return FALSE;
}
}
/* try to guess from heuristics */ /* try to guess from heuristics */
if (data->esp_path == NULL) { if (data->esp_path == NULL) {
@ -771,8 +751,8 @@ fu_plugin_startup (FuPlugin *plugin, GError **error)
FWUPD_ERROR, FWUPD_ERROR,
FWUPD_ERROR_INVALID_FILE, FWUPD_ERROR_INVALID_FILE,
"Unable to determine EFI system partition " "Unable to determine EFI system partition "
"location, override in %s.conf", "location, override using %s in %s.conf",
fu_plugin_get_name (plugin)); key, fu_plugin_get_name (plugin));
return FALSE; return FALSE;
} }
} }