Commit d9f6b106 authored by Richard Hughes's avatar Richard Hughes
Browse files

Add a config option to allow runtime disabling plugins by name

See https://github.com/hughsie/fwupd/issues/110
parent 3b88f1c8
......@@ -11,3 +11,6 @@ EnableOptionROM=true
# Allow blacklisting specific devices by their GUID
BlacklistDevices=
# Allow blacklisting specific plugins
BlacklistPlugins=
......@@ -2625,6 +2625,14 @@ fu_main_load_plugins (FuMainPrivate *priv, GError **error)
const gchar *fn;
g_autofree gchar *plugin_dir = NULL;
g_autoptr(GDir) dir = NULL;
g_auto(GStrv) blacklist = NULL;
/* get plugin blacklist */
blacklist = g_key_file_get_string_list (priv->config,
"fwupd",
"BlacklistPlugins",
NULL, /* length */
NULL);
/* search */
plugin_dir = g_build_filename (LIBDIR, "fwupd-plugins-2", NULL);
......@@ -2650,6 +2658,18 @@ fu_main_load_plugins (FuMainPrivate *priv, GError **error)
filename, error_local->message);
continue;
}
/* is blacklisted */
if (blacklist != NULL &&
g_strv_contains ((const gchar * const *) blacklist,
fu_plugin_get_name (plugin))) {
fu_plugin_set_enabled (plugin, FALSE);
g_debug ("%s blacklisted by config",
fu_plugin_get_name (plugin));
continue;
}
/* watch for changes */
g_signal_connect (plugin, "device-added",
G_CALLBACK (fu_main_plugin_device_added_cb),
priv);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment