fix snappy paths
This commit is contained in:
parent
c45a5a994c
commit
9389c1759d
15
guh.pro
15
guh.pro
@ -108,19 +108,28 @@ contains(DEFINES, SNAPPY){
|
||||
/usr/lib/arm-linux-gnueabihf/libpng12.so.0 \
|
||||
/usr/lib/arm-linux-gnueabihf/libharfbuzz.so.0 \
|
||||
/usr/lib/arm-linux-gnueabihf/libicudata.so.52 \
|
||||
/usr/lib/arm-linux-gnueabihf/mesa-egl/libGLESv2.so \
|
||||
/usr/lib/arm-linux-gnueabihf/libz.so \
|
||||
/usr/lib/arm-linux-gnueabihf/libicuuc.so.52 \
|
||||
/usr/lib/arm-linux-gnueabihf/libicui18n.so.52 \
|
||||
/usr/lib/arm-linux-gnueabihf/libstdc++.so.6 \
|
||||
/usr/lib/arm-linux-gnueabihf/libsqlite3.so.0 \
|
||||
/usr/lib/arm-linux-gnueabihf/mesa-egl/libGLESv2.so.2.0.0 \
|
||||
/usr/lib/arm-linux-gnueabihf/mesa-egl/libGLESv2.so.2 \
|
||||
/usr/lib/arm-linux-gnueabihf/mesa-egl/libGLESv2.so \
|
||||
/usr/lib/arm-linux-gnueabihf/libfreetype.so.6 \
|
||||
/usr/lib/arm-linux-gnueabihf/libgraphite2.so.3 \
|
||||
/usr/lib/arm-linux-gnueabihf/libglapi.so.0
|
||||
/usr/lib/arm-linux-gnueabihf/libglapi.so.0 \
|
||||
/usr/lib/arm-linux-gnueabihf/libpthread.so \
|
||||
/usr/lib/arm-linux-gnueabihf/libdl.so \
|
||||
/usr/lib/arm-linux-gnueabihf/librt.so \
|
||||
/usr/lib/arm-linux-gnueabihf/libm.so
|
||||
qtlibs.path = /usr/lib/
|
||||
|
||||
# install guhd.conf
|
||||
guhdconf.files = data/config/guhd.conf
|
||||
guhdconf.path = $$INSTALLDIR/config/
|
||||
|
||||
INSTALLS += meta wrapper guhdconf qtlibs sqlplugin
|
||||
INSTALLS += wrapper qtlibs sqlplugin
|
||||
|
||||
# command to pack libs for snappy package
|
||||
packlibs.depends = libguh server
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
|
||||
#include "guhsettings.h"
|
||||
#include "unistd.h"
|
||||
#include "loggingcategories.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QCoreApplication>
|
||||
@ -63,29 +64,30 @@ GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent):
|
||||
{
|
||||
|
||||
#ifdef SNAPPY
|
||||
QString settingsFilePath = qgetenv("SNAP_APP_DATA_PATH");
|
||||
QString settingsFile;
|
||||
switch (role) {
|
||||
case SettingsRoleNone:
|
||||
break;
|
||||
case SettingsRoleDevices:
|
||||
settingsFile = "config/devices.conf";
|
||||
settingsFile = settingsFilePath + "/devices.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::IniFormat, this);
|
||||
qDebug() << "Created device settings" << m_settings->fileName();
|
||||
//qCDebug(dcApplication) << "Created device settings" << m_settings->fileName();
|
||||
break;
|
||||
case SettingsRoleRules:
|
||||
settingsFile = "config/rules.conf";
|
||||
settingsFile = settingsFilePath + "/rules.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::IniFormat, this);
|
||||
qDebug() << "Created rule settings" << m_settings->fileName();
|
||||
//qCDebug(dcApplication) << "Created rule settings" << m_settings->fileName();
|
||||
break;
|
||||
case SettingsRolePlugins:
|
||||
settingsFile = "config/plugins.conf";
|
||||
settingsFile = settingsFilePath + "/plugins.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::IniFormat, this);
|
||||
qDebug() << "Created plugin settings" << m_settings->fileName();
|
||||
//qCDebug(dcApplication) << "Created plugin settings" << m_settings->fileName();
|
||||
break;
|
||||
case SettingsRoleGlobal:
|
||||
settingsFile = "config/guhd.conf";
|
||||
settingsFile = settingsFilePath + "/guhd.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::IniFormat, this);
|
||||
qDebug() << "Created guhd settings" << m_settings->fileName();
|
||||
//qCDebug(dcApplication) << "Created guhd settings" << m_settings->fileName();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -103,12 +105,15 @@ GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent):
|
||||
if (settingsPrefix == "guh-test") {
|
||||
settingsFile = "/tmp/" + settingsPrefix + "/test-devices.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::NativeFormat, this);
|
||||
//qCDebug(dcApplication) << "Created test-devices settings" << m_settings->fileName();
|
||||
} else if (rootPrivilege) {
|
||||
settingsFile = "/etc/" + settingsPrefix + "/devices.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::IniFormat, this);
|
||||
//qCDebug(dcApplication) << "Created device settings" << m_settings->fileName();
|
||||
} else {
|
||||
settingsFile = QDir::homePath() + "/.config/" + settingsPrefix + "/devices.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::NativeFormat, this);
|
||||
//qCDebug(dcApplication) << "Created device settings" << m_settings->fileName();
|
||||
}
|
||||
break;
|
||||
case SettingsRoleRules:
|
||||
@ -116,12 +121,15 @@ GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent):
|
||||
if (settingsPrefix == "guh-test") {
|
||||
settingsFile = "/tmp/" + settingsPrefix + "/test-rules.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::NativeFormat, this);
|
||||
//qCDebug(dcApplication) << "Created test-rules settings" << m_settings->fileName();
|
||||
} else if (rootPrivilege) {
|
||||
settingsFile = "/etc/" + settingsPrefix + "/rules.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::IniFormat, this);
|
||||
//qCDebug(dcApplication) << "Created rule settings" << m_settings->fileName();
|
||||
} else {
|
||||
settingsFile = QDir::homePath() + "/.config/" + settingsPrefix + "/rules.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::NativeFormat, this);
|
||||
//qCDebug(dcApplication) << "Created rule settings" << m_settings->fileName();
|
||||
}
|
||||
break;
|
||||
case SettingsRolePlugins:
|
||||
@ -129,18 +137,22 @@ GuhSettings::GuhSettings(const SettingsRole &role, QObject *parent):
|
||||
if (settingsPrefix == "guh-test") {
|
||||
settingsFile = "/tmp/" + settingsPrefix + "/test-plugins.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::NativeFormat, this);
|
||||
//qCDebug(dcApplication) << "Created test-plugins settings" << m_settings->fileName();
|
||||
} else if (rootPrivilege) {
|
||||
settingsFile = "/etc/" + settingsPrefix + "/plugins.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::IniFormat, this);
|
||||
//qCDebug(dcApplication) << "Created plugin settings" << m_settings->fileName();
|
||||
} else {
|
||||
settingsFile = QDir::homePath() + "/.config/" + settingsPrefix + "/plugins.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::NativeFormat, this);
|
||||
//qCDebug(dcApplication) << "Created plugin settings" << m_settings->fileName();
|
||||
}
|
||||
break;
|
||||
case SettingsRoleGlobal:
|
||||
// this file schould always be readable and should never be written
|
||||
settingsFile = "/etc/guh/guhd.conf";
|
||||
m_settings = new QSettings(settingsFile, QSettings::IniFormat, this);
|
||||
qCDebug(dcApplication) << "Created test guhd settings" << m_settings->fileName();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -178,7 +190,7 @@ QString GuhSettings::logPath()
|
||||
{
|
||||
QString logPath;
|
||||
#ifdef SNAPPY
|
||||
logPath = "/var/log/guhd.log";
|
||||
logPath = qgetenv("SNAP_APP_DATA_PATH") + "/guhd.log";
|
||||
#else
|
||||
QString organisationName = QCoreApplication::instance()->organizationName();
|
||||
|
||||
@ -281,7 +293,7 @@ void GuhSettings::remove(const QString &key)
|
||||
/*! Sets the \a value of setting \a key to value. If the \a key already exists, the previous value is overwritten. */
|
||||
void GuhSettings::setValue(const QString &key, const QVariant &value)
|
||||
{
|
||||
//Q_ASSERT_X(m_role != GuhSettings::SettingsRoleGlobal, "GuhSettings", "Bad settings usage. The global settings file should be read only.");
|
||||
Q_ASSERT_X(m_role != GuhSettings::SettingsRoleGlobal, "GuhSettings", "Bad settings usage. The global settings file should be read only.");
|
||||
m_settings->setValue(key, value);
|
||||
}
|
||||
|
||||
|
||||
@ -114,32 +114,32 @@ HEADERS += devicemanager.h \
|
||||
types/statedescriptor.h \
|
||||
|
||||
# install files for libguh-dev
|
||||
!snappy {
|
||||
# install guh-generateplugininfo precompiler
|
||||
isEmpty(PREFIX) {
|
||||
INSTALLDIR = /usr/bin
|
||||
} else {
|
||||
INSTALLDIR = $$PREFIX/usr/bin
|
||||
}
|
||||
generateplugininfo.files = $$top_srcdir/plugins/guh-generateplugininfo
|
||||
generateplugininfo.path = $$INSTALLDIR
|
||||
|
||||
# install guh-generateplugininfo precompiler
|
||||
isEmpty(PREFIX) {
|
||||
INSTALLDIR = /usr/bin
|
||||
} else {
|
||||
INSTALLDIR = $$PREFIX/usr/bin
|
||||
}
|
||||
generateplugininfo.files = $$top_srcdir/plugins/guh-generateplugininfo
|
||||
generateplugininfo.path = $$INSTALLDIR
|
||||
INSTALLS += generateplugininfo
|
||||
|
||||
INSTALLS += generateplugininfo
|
||||
# install header file with relative subdirectory
|
||||
isEmpty(PREFIX) {
|
||||
INSTALLDIR = /usr/include
|
||||
} else {
|
||||
INSTALLDIR = $$PREFIX/usr/include
|
||||
}
|
||||
|
||||
# install header file with relative subdirectory
|
||||
isEmpty(PREFIX) {
|
||||
INSTALLDIR = /usr/include
|
||||
} else {
|
||||
INSTALLDIR = $$PREFIX/usr/include
|
||||
}
|
||||
|
||||
for(header, HEADERS) {
|
||||
path = $$INSTALLDIR/guh/$${dirname(header)}
|
||||
eval(headers_$${path}.files += $${header})
|
||||
eval(headers_$${path}.path = $${path})
|
||||
eval(INSTALLS *= headers_$${path})
|
||||
for(header, HEADERS) {
|
||||
path = $$INSTALLDIR/guh/$${dirname(header)}
|
||||
eval(headers_$${path}.files += $${header})
|
||||
eval(headers_$${path}.path = $${path})
|
||||
eval(INSTALLS *= headers_$${path})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
export QT_PLUGIN_PATH=/apps/guh.sideload/current/usr/lib/qt5/plugins
|
||||
export LD_LIBRARY_PATH=/apps/guh.sideload/current/usr/lib:$LD_LIBRARY_PATH
|
||||
/apps/guh.sideload/current/usr/bin/guhd -n
|
||||
export QT_PLUGIN_PATH=$SNAP_APP_PATH/usr/lib/qt5/plugins
|
||||
export LD_LIBRARY_PATH=$SNAP_APP_PATH/usr/lib:$LD_LIBRARY_PATH
|
||||
$SNAP_APP_PATH/usr/bin/guhd -n -d LogEngine
|
||||
|
||||
@ -133,17 +133,19 @@ LogEngine::LogEngine(QObject *parent):
|
||||
qCDebug(dcLogEngine) << "Set logging dab max size to" << m_dbMaxSize << "for testing.";
|
||||
}
|
||||
|
||||
qCDebug(dcLogEngine) << "Opening logging database" << m_db.databaseName();
|
||||
|
||||
if (!m_db.isValid()) {
|
||||
qCWarning(dcLogEngine) << "Database not valid:" << m_db.lastError().driverText() << m_db.lastError().databaseText();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_db.open()) {
|
||||
qCWarning(dcLogEngine) << "Error opening log database:" << m_db.lastError().driverText() << m_db.lastError().databaseText();
|
||||
return;
|
||||
}
|
||||
|
||||
qCDebug(dcLogEngine) << "Opening logging database" << m_db.databaseName();
|
||||
|
||||
initDB();
|
||||
}
|
||||
|
||||
@ -349,10 +351,11 @@ void LogEngine::initDB()
|
||||
m_db.open();
|
||||
|
||||
QSqlQuery query;
|
||||
|
||||
if (!m_db.tables().contains("metadata")) {
|
||||
qCDebug(dcLogEngine) << "Creating database table...";
|
||||
query.exec("CREATE TABLE metadata (key varchar(10), data varchar(40));");
|
||||
query.exec(QString("INSERT INTO metadata (key, data) VALUES('version', '%1');").arg(DB_SCHEMA_VERSION));
|
||||
qCDebug(dcLogEngine) << "Database table created";
|
||||
}
|
||||
|
||||
query.exec("SELECT data FROM metadata WHERE key = 'version';");
|
||||
|
||||
@ -195,6 +195,13 @@ int main(int argc, char *argv[])
|
||||
qCDebug(dcApplication) << "=====================================";
|
||||
}
|
||||
|
||||
#ifdef SNAPPY
|
||||
qCDebug(dcApplication) << "Snappy name :" << qgetenv("SNAP_FULLNAME");
|
||||
qCDebug(dcApplication) << "Snappy version :" << qgetenv("SNAP_VERSION");
|
||||
qCDebug(dcApplication) << "Snappy directory:" << qgetenv("SNAP_APP_PATH");
|
||||
qCDebug(dcApplication) << "Snappy user data:" << qgetenv("SNAP_APP_USER_DATA_PATH");
|
||||
qCDebug(dcApplication) << "Snappy app data:" << qgetenv("SNAP_APP_DATA_PATH");
|
||||
#endif
|
||||
// create core instance
|
||||
GuhCore::instance();
|
||||
return application.exec();
|
||||
|
||||
@ -113,7 +113,7 @@ WebServer::WebServer(const QSslConfiguration &sslConfiguration, QObject *parent)
|
||||
settings.endGroup();
|
||||
|
||||
#ifdef SNAPPY
|
||||
m_webinterfaceDir = QDir("/apps/guh.sideload/current/public/");
|
||||
m_webinterfaceDir = QDir(qgetenv("SNAP_APP_PATH") + "/public/");
|
||||
#endif
|
||||
|
||||
// check public directory
|
||||
|
||||
Reference in New Issue
Block a user