From 8f133f190c4602dbdefacbf4e697b288b160888c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= Date: Sat, 20 Apr 2019 08:18:23 -0300 Subject: [PATCH] deepin.dde-polkit-agent: set plugins dir from environment variable --- .../dde-polkit-agent.plugins-dir.patch | 42 +++++++++++++++++++ .../deepin/dde-polkit-agent/default.nix | 4 ++ 2 files changed, 46 insertions(+) create mode 100644 pkgs/desktops/deepin/dde-polkit-agent/dde-polkit-agent.plugins-dir.patch diff --git a/pkgs/desktops/deepin/dde-polkit-agent/dde-polkit-agent.plugins-dir.patch b/pkgs/desktops/deepin/dde-polkit-agent/dde-polkit-agent.plugins-dir.patch new file mode 100644 index 000000000000..a6941e975eb4 --- /dev/null +++ b/pkgs/desktops/deepin/dde-polkit-agent/dde-polkit-agent.plugins-dir.patch @@ -0,0 +1,42 @@ +From 4f457d38e9e75bc97ee7dba633bf0cdd61b8cd5b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= +Date: Fri, 19 Apr 2019 22:01:16 -0300 +Subject: [PATCH] Use an environment variable to find plugins + +--- + pluginmanager.cpp | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/pluginmanager.cpp b/pluginmanager.cpp +index 0c03237..79bdf86 100644 +--- a/pluginmanager.cpp ++++ b/pluginmanager.cpp +@@ -34,13 +34,19 @@ QList PluginManager::reduceGetOptions(const QString &actionID) + void PluginManager::load() + { + +- QDir dir("/usr/lib/polkit-1-dde/plugins/"); +- QFileInfoList pluginFiles = dir.entryInfoList((QStringList("*.so"))); ++ QStringList pluginsDirs = QProcessEnvironment::systemEnvironment().value("DDE_POLKIT_PLUGINS_DIRS").split(QDir::listSeparator(), QString::SkipEmptyParts); ++ pluginsDirs.append("/usr/lib/polkit-1-dde/plugins/"); + +- for (const QFileInfo &pluginFile : pluginFiles) { +- AgentExtension *plugin = loadFile(pluginFile.absoluteFilePath()); +- if (plugin) +- m_plugins << plugin; ++ for (const QString &dirName : pluginsDirs) { ++ QDir dir(dirName); ++ ++ QFileInfoList pluginFiles = dir.entryInfoList((QStringList("*.so"))); ++ ++ for (const QFileInfo &pluginFile : pluginFiles) { ++ AgentExtension *plugin = loadFile(pluginFile.absoluteFilePath()); ++ if (plugin) ++ m_plugins << plugin; ++ } + } + } + +-- +2.21.0 + diff --git a/pkgs/desktops/deepin/dde-polkit-agent/default.nix b/pkgs/desktops/deepin/dde-polkit-agent/default.nix index 2c5dfa33053b..da54fcdb64d8 100644 --- a/pkgs/desktops/deepin/dde-polkit-agent/default.nix +++ b/pkgs/desktops/deepin/dde-polkit-agent/default.nix @@ -27,6 +27,10 @@ stdenv.mkDerivation rec { polkit-qt ]; + patches = [ + ./dde-polkit-agent.plugins-dir.patch + ]; + postPatch = '' searchHardCodedPaths patchShebangs translate_generation.sh