2021-03-09 03:18:52 +00:00
|
|
|
From f4d718502ecd8242500078a7783e27caba72871e Mon Sep 17 00:00:00 2001
|
2020-07-18 16:06:22 +00:00
|
|
|
From: Thomas Tuegel <ttuegel@mailbox.org>
|
2021-03-09 03:18:52 +00:00
|
|
|
Date: Sun, 31 Jan 2021 11:00:03 -0600
|
2020-07-18 16:06:22 +00:00
|
|
|
Subject: [PATCH 1/3] akonadi paths
|
|
|
|
|
|
|
|
---
|
|
|
|
src/akonadicontrol/agentmanager.cpp | 4 ++--
|
|
|
|
src/akonadicontrol/agentprocessinstance.cpp | 2 +-
|
|
|
|
src/server/storage/dbconfigmysql.cpp | 26 ++++-----------------
|
|
|
|
src/server/storage/dbconfigpostgresql.cpp | 19 +++------------
|
|
|
|
4 files changed, 11 insertions(+), 40 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/src/akonadicontrol/agentmanager.cpp b/src/akonadicontrol/agentmanager.cpp
|
2021-03-09 03:18:52 +00:00
|
|
|
index 31e0cf2..6436e87 100644
|
2020-07-18 16:06:22 +00:00
|
|
|
--- a/src/akonadicontrol/agentmanager.cpp
|
|
|
|
+++ b/src/akonadicontrol/agentmanager.cpp
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -48,7 +48,7 @@ public:
|
2020-07-18 16:06:22 +00:00
|
|
|
[]() {
|
|
|
|
QCoreApplication::instance()->exit(255);
|
|
|
|
});
|
|
|
|
- start(QStringLiteral("akonadiserver"), args, RestartOnCrash);
|
|
|
|
+ start(QLatin1String(NIX_OUT "/bin/akonadiserver"), args, RestartOnCrash);
|
|
|
|
}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
~StorageProcessControl() override
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -70,7 +70,7 @@ public:
|
2020-07-18 16:06:22 +00:00
|
|
|
[]() {
|
|
|
|
qCCritical(AKONADICONTROL_LOG) << "Failed to start AgentServer!";
|
|
|
|
});
|
|
|
|
- start(QStringLiteral("akonadi_agent_server"), args, RestartOnCrash);
|
|
|
|
+ start(QLatin1String(NIX_OUT "/bin/akonadi_agent_server"), args, RestartOnCrash);
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
~AgentServerProcessControl() override
|
|
|
|
diff --git a/src/akonadicontrol/agentprocessinstance.cpp b/src/akonadicontrol/agentprocessinstance.cpp
|
2021-03-09 03:18:52 +00:00
|
|
|
index c98946c..aa307ca 100644
|
2020-07-18 16:06:22 +00:00
|
|
|
--- a/src/akonadicontrol/agentprocessinstance.cpp
|
|
|
|
+++ b/src/akonadicontrol/agentprocessinstance.cpp
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -49,7 +49,7 @@ bool AgentProcessInstance::start(const AgentType &agentInfo)
|
2020-04-24 23:36:52 +00:00
|
|
|
} else {
|
|
|
|
Q_ASSERT(agentInfo.launchMethod == AgentType::Launcher);
|
|
|
|
const QStringList arguments = QStringList() << executable << identifier();
|
|
|
|
- const QString agentLauncherExec = Akonadi::StandardDirs::findExecutable(QStringLiteral("akonadi_agent_launcher"));
|
|
|
|
+ const QString agentLauncherExec = QLatin1String(NIX_OUT "/bin/akonadi_agent_launcher");
|
|
|
|
mController->start(agentLauncherExec, arguments);
|
|
|
|
}
|
|
|
|
return true;
|
2020-07-18 16:06:22 +00:00
|
|
|
diff --git a/src/server/storage/dbconfigmysql.cpp b/src/server/storage/dbconfigmysql.cpp
|
2021-03-09 03:18:52 +00:00
|
|
|
index d595a3a..99324f6 100644
|
2020-07-18 16:06:22 +00:00
|
|
|
--- a/src/server/storage/dbconfigmysql.cpp
|
|
|
|
+++ b/src/server/storage/dbconfigmysql.cpp
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -69,7 +69,6 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2020-04-24 23:36:52 +00:00
|
|
|
// determine default settings depending on the driver
|
|
|
|
QString defaultHostName;
|
|
|
|
QString defaultOptions;
|
|
|
|
- QString defaultServerPath;
|
|
|
|
QString defaultCleanShutdownCommand;
|
|
|
|
|
|
|
|
#ifndef Q_OS_WIN
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -78,16 +77,7 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2020-04-24 23:36:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
const bool defaultInternalServer = true;
|
|
|
|
-#ifdef MYSQLD_EXECUTABLE
|
|
|
|
- if (QFile::exists(QStringLiteral(MYSQLD_EXECUTABLE))) {
|
|
|
|
- defaultServerPath = QStringLiteral(MYSQLD_EXECUTABLE);
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
- if (defaultServerPath.isEmpty()) {
|
|
|
|
- defaultServerPath = findExecutable(QStringLiteral("mysqld"));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const QString mysqladminPath = findExecutable(QStringLiteral("mysqladmin"));
|
|
|
|
+ const QString mysqladminPath = QLatin1String(NIXPKGS_MYSQL_MYSQLADMIN);
|
|
|
|
if (!mysqladminPath.isEmpty()) {
|
|
|
|
#ifndef Q_OS_WIN
|
|
|
|
defaultCleanShutdownCommand = QStringLiteral("%1 --defaults-file=%2/mysql.conf --socket=%3/%4 shutdown")
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -97,10 +87,10 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2020-04-24 23:36:52 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
- mMysqlInstallDbPath = findExecutable(QStringLiteral("mysql_install_db"));
|
|
|
|
+ mMysqlInstallDbPath = QLatin1String(NIXPKGS_MYSQL_MYSQL_INSTALL_DB);
|
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found mysql_install_db: " << mMysqlInstallDbPath;
|
|
|
|
|
|
|
|
- mMysqlCheckPath = findExecutable(QStringLiteral("mysqlcheck"));
|
|
|
|
+ mMysqlCheckPath = QLatin1String(NIXPKGS_MYSQL_MYSQLCHECK);
|
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found mysqlcheck: " << mMysqlCheckPath;
|
|
|
|
|
|
|
|
mInternalServer = settings.value(QStringLiteral("QMYSQL/StartServer"), defaultInternalServer).toBool();
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -117,7 +107,7 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2020-04-24 23:36:52 +00:00
|
|
|
mUserName = settings.value(QStringLiteral("User")).toString();
|
|
|
|
mPassword = settings.value(QStringLiteral("Password")).toString();
|
|
|
|
mConnectionOptions = settings.value(QStringLiteral("Options"), defaultOptions).toString();
|
|
|
|
- mMysqldPath = settings.value(QStringLiteral("ServerPath"), defaultServerPath).toString();
|
|
|
|
+ mMysqldPath = QLatin1String(NIXPKGS_MYSQL_MYSQLD);
|
|
|
|
mCleanServerShutdownCommand = settings.value(QStringLiteral("CleanServerShutdownCommand"), defaultCleanShutdownCommand).toString();
|
|
|
|
settings.endGroup();
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -127,9 +117,6 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2020-04-24 23:36:52 +00:00
|
|
|
// intentionally not namespaced as we are the only one in this db instance when using internal mode
|
|
|
|
mDatabaseName = QStringLiteral("akonadi");
|
|
|
|
}
|
|
|
|
- if (mInternalServer && (mMysqldPath.isEmpty() || !QFile::exists(mMysqldPath))) {
|
|
|
|
- mMysqldPath = defaultServerPath;
|
|
|
|
- }
|
|
|
|
|
|
|
|
qCDebug(AKONADISERVER_LOG) << "Using mysqld:" << mMysqldPath;
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -139,9 +126,6 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
|
|
|
settings.setValue(QStringLiteral("Name"), mDatabaseName);
|
|
|
|
settings.setValue(QStringLiteral("Host"), mHostName);
|
|
|
|
settings.setValue(QStringLiteral("Options"), mConnectionOptions);
|
|
|
|
- if (!mMysqldPath.isEmpty()) {
|
|
|
|
- settings.setValue(QStringLiteral("ServerPath"), mMysqldPath);
|
|
|
|
- }
|
|
|
|
settings.setValue(QStringLiteral("StartServer"), mInternalServer);
|
|
|
|
settings.endGroup();
|
|
|
|
settings.sync();
|
|
|
|
@@ -214,7 +198,7 @@ bool DbConfigMysql::startInternalServer()
|
2020-04-24 23:36:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// generate config file
|
|
|
|
- const QString globalConfig = StandardDirs::locateResourceFile("config", QStringLiteral("mysql-global.conf"));
|
|
|
|
+ const QString globalConfig = QLatin1String(NIX_OUT "/etc/xdg/akonadi/mysql-global.conf");
|
|
|
|
const QString localConfig = StandardDirs::locateResourceFile("config", QStringLiteral("mysql-local.conf"));
|
|
|
|
const QString actualConfig = StandardDirs::saveDir("data") + QLatin1String("/mysql.conf");
|
|
|
|
if (globalConfig.isEmpty()) {
|
2020-07-18 16:06:22 +00:00
|
|
|
diff --git a/src/server/storage/dbconfigpostgresql.cpp b/src/server/storage/dbconfigpostgresql.cpp
|
2021-03-09 03:18:52 +00:00
|
|
|
index dd273fc..05288d9 100644
|
2020-07-18 16:06:22 +00:00
|
|
|
--- a/src/server/storage/dbconfigpostgresql.cpp
|
|
|
|
+++ b/src/server/storage/dbconfigpostgresql.cpp
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -127,9 +127,7 @@ bool DbConfigPostgresql::init(QSettings &settings, bool storeSettings)
|
2020-04-24 23:36:52 +00:00
|
|
|
// determine default settings depending on the driver
|
|
|
|
QString defaultHostName;
|
|
|
|
QString defaultOptions;
|
|
|
|
- QString defaultServerPath;
|
|
|
|
QString defaultInitDbPath;
|
|
|
|
- QString defaultPgUpgradePath;
|
|
|
|
QString defaultPgData;
|
|
|
|
|
|
|
|
#ifndef Q_WS_WIN // We assume that PostgreSQL is running as service on Windows
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -140,12 +138,8 @@ bool DbConfigPostgresql::init(QSettings &settings, bool storeSettings)
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
mInternalServer = settings.value(QStringLiteral("QPSQL/StartServer"), defaultInternalServer).toBool();
|
|
|
|
if (mInternalServer) {
|
|
|
|
- const auto paths = postgresSearchPaths(QStringLiteral("/usr/lib/postgresql"));
|
|
|
|
-
|
|
|
|
- defaultServerPath = QStandardPaths::findExecutable(QStringLiteral("pg_ctl"), paths);
|
|
|
|
- defaultInitDbPath = QStandardPaths::findExecutable(QStringLiteral("initdb"), paths);
|
|
|
|
+ defaultInitDbPath = QLatin1String(NIXPKGS_POSTGRES_INITDB);
|
|
|
|
defaultHostName = Utils::preferredSocketDirectory(StandardDirs::saveDir("data", QStringLiteral("db_misc")));
|
|
|
|
- defaultPgUpgradePath = QStandardPaths::findExecutable(QStringLiteral("pg_upgrade"), paths);
|
|
|
|
defaultPgData = StandardDirs::saveDir("data", QStringLiteral("db_data"));
|
|
|
|
}
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -164,20 +158,14 @@ bool DbConfigPostgresql::init(QSettings &settings, bool storeSettings)
|
2020-04-24 23:36:52 +00:00
|
|
|
mUserName = settings.value(QStringLiteral("User")).toString();
|
|
|
|
mPassword = settings.value(QStringLiteral("Password")).toString();
|
|
|
|
mConnectionOptions = settings.value(QStringLiteral("Options"), defaultOptions).toString();
|
|
|
|
- mServerPath = settings.value(QStringLiteral("ServerPath"), defaultServerPath).toString();
|
|
|
|
- if (mInternalServer && mServerPath.isEmpty()) {
|
|
|
|
- mServerPath = defaultServerPath;
|
|
|
|
- }
|
|
|
|
+ mServerPath = QLatin1String(NIXPKGS_POSTGRES_PG_CTL);
|
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found pg_ctl:" << mServerPath;
|
|
|
|
mInitDbPath = settings.value(QStringLiteral("InitDbPath"), defaultInitDbPath).toString();
|
|
|
|
if (mInternalServer && mInitDbPath.isEmpty()) {
|
|
|
|
mInitDbPath = defaultInitDbPath;
|
|
|
|
}
|
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found initdb:" << mServerPath;
|
|
|
|
- mPgUpgradePath = settings.value(QStringLiteral("UpgradePath"), defaultPgUpgradePath).toString();
|
|
|
|
- if (mInternalServer && mPgUpgradePath.isEmpty()) {
|
|
|
|
- mPgUpgradePath = defaultPgUpgradePath;
|
|
|
|
- }
|
|
|
|
+ mPgUpgradePath = QLatin1String(NIXPKGS_POSTGRES_PG_UPGRADE);
|
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found pg_upgrade:" << mPgUpgradePath;
|
|
|
|
mPgData = settings.value(QStringLiteral("PgData"), defaultPgData).toString();
|
|
|
|
if (mPgData.isEmpty()) {
|
2021-03-09 03:18:52 +00:00
|
|
|
@@ -194,7 +182,6 @@ bool DbConfigPostgresql::init(QSettings &settings, bool storeSettings)
|
|
|
|
settings.setValue(QStringLiteral("Port"), mHostPort);
|
|
|
|
}
|
|
|
|
settings.setValue(QStringLiteral("Options"), mConnectionOptions);
|
|
|
|
- settings.setValue(QStringLiteral("ServerPath"), mServerPath);
|
|
|
|
settings.setValue(QStringLiteral("InitDbPath"), mInitDbPath);
|
|
|
|
settings.setValue(QStringLiteral("StartServer"), mInternalServer);
|
|
|
|
settings.endGroup();
|
2020-07-18 16:06:22 +00:00
|
|
|
--
|
2021-03-09 03:18:52 +00:00
|
|
|
2.29.2
|
2020-07-18 16:06:22 +00:00
|
|
|
|