diff --git a/guh.pri b/guh.pri index 1c250e4c..a34adec5 100644 --- a/guh.pri +++ b/guh.pri @@ -1,13 +1,17 @@ # Parse and export GUH_VERSION_STRING GUH_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"') +# Install path for plugins +GUH_PLUGINS_PATH=/usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH')/guh/plugins/ + # define protocol versions JSON_PROTOCOL_VERSION=47 REST_API_VERSION=1 DEFINES += GUH_VERSION_STRING=\\\"$${GUH_VERSION_STRING}\\\" \ JSON_PROTOCOL_VERSION=\\\"$${JSON_PROTOCOL_VERSION}\\\" \ - REST_API_VERSION=\\\"$${REST_API_VERSION}\\\" + REST_API_VERSION=\\\"$${REST_API_VERSION}\\\" \ + GUH_PLUGINS_PATH=\\\"$${GUH_PLUGINS_PATH}\\\" QT *= network websockets bluetooth dbus diff --git a/guh.pro b/guh.pro index 1230c9ac..851477fe 100644 --- a/guh.pro +++ b/guh.pro @@ -41,6 +41,7 @@ message("Qt version:" $$[QT_VERSION]) message("Building guh version $${GUH_VERSION_STRING}") message("JSON-RPC API version $${JSON_PROTOCOL_VERSION}") message("REST API version $${REST_API_VERSION}") +message("Plugin path $${GUH_PLUGINS_PATH}") coverage { message("Building coverage.") diff --git a/libguh/devicemanager.cpp b/libguh/devicemanager.cpp index fd38737e..54a6b194 100644 --- a/libguh/devicemanager.cpp +++ b/libguh/devicemanager.cpp @@ -183,6 +183,7 @@ #include "plugin/deviceplugin.h" #include "typeutils.h" #include "guhsettings.h" +#include "unistd.h" #include #include @@ -258,6 +259,10 @@ QStringList DeviceManager::pluginSearchDirs() searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/"; searchDirs << QCoreApplication::applicationDirPath() + "/../plugins/deviceplugins"; searchDirs << QCoreApplication::applicationDirPath() + "/../../../plugins/deviceplugins"; + searchDirs << QString("%1").arg(GUH_PLUGINS_PATH); +#ifdef SNAPPY + searchDirs << QString("%1%2").arg(QString::fromUtf8(qgetenv("SNAP"))).arg(GUH_PLUGINS_PATH); +#endif return searchDirs; } diff --git a/plugins/plugins.pri b/plugins/plugins.pri index c11fdb23..f8cdff75 100644 --- a/plugins/plugins.pri +++ b/plugins/plugins.pri @@ -33,6 +33,6 @@ translations.path = /usr/share/guh/translations translations.files = $$[QT_SOURCE_TREE]/translations/*.qm # Install plugin -target.path = /usr/lib/$$system('dpkg-architecture -q DEB_HOST_MULTIARCH')/guh/plugins/ +target.path = $$GUH_PLUGINS_PATH INSTALLS += target translations diff --git a/server/main.cpp b/server/main.cpp index ab04c13b..3059498b 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -231,7 +231,7 @@ int main(int argc, char *argv[]) } #ifdef SNAPPY - // http://snapcraft.io/docs/reference/env + // Note: http://snapcraft.io/docs/reference/env qCDebug(dcApplication) << "Snap name :" << qgetenv("SNAP_NAME"); qCDebug(dcApplication) << "Snap version :" << qgetenv("SNAP_VERSION"); qCDebug(dcApplication) << "Snap directory :" << qgetenv("SNAP"); diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 93889da1..e274775c 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -69,13 +69,14 @@ parts: - avahi-daemon - libavahi-client3 - libavahi-common3 - after: [ guh-cli, guh-webinterface, qt5conf] + after: [ qt5conf ] guh-cli: plugin: python python-version: python2 source: https://github.com/guh/guh-cli.git source-type: git + after: [ guh ] build-packages: - python-dev - python-pip @@ -87,5 +88,6 @@ parts: plugin: dump source: https://jenkins.guh.io/view/guh-webinterface/job/guh-webinterface-all/lastBuild/artifact/guh-webinterface.tar.gz source-type: tar + after: [ guh-cli ] organize: '*': guh-webinterface/