2021-04-25 14:05:06 +01:00
|
|
|
From ca8ff6e6d527ee968300cce5e8cd148f6a4d256b Mon Sep 17 00:00:00 2001
|
2020-07-13 17:48:47 +01:00
|
|
|
From: Thomas Tuegel <ttuegel@mailbox.org>
|
2021-04-25 14:05:06 +01:00
|
|
|
Date: Sun, 25 Apr 2021 08:00:10 -0500
|
2020-07-13 17:48:47 +01: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-04-25 14:05:06 +01:00
|
|
|
index 44ceec5..eb5fa50 100644
|
2020-07-13 17:48:47 +01:00
|
|
|
--- a/src/akonadicontrol/agentmanager.cpp
|
|
|
|
+++ b/src/akonadicontrol/agentmanager.cpp
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -47,7 +47,7 @@ public:
|
|
|
|
connect(this, &Akonadi::ProcessControl::unableToStart, this, []() {
|
|
|
|
QCoreApplication::instance()->exit(255);
|
|
|
|
});
|
2020-07-13 17:48:47 +01:00
|
|
|
- start(QStringLiteral("akonadiserver"), args, RestartOnCrash);
|
2021-04-27 22:36:43 +01:00
|
|
|
+ start(QStringLiteral(NIX_OUT "/bin/akonadiserver"), args, RestartOnCrash);
|
2020-07-13 17:48:47 +01:00
|
|
|
}
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2020-07-13 17:48:47 +01:00
|
|
|
~StorageProcessControl() override
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -69,7 +69,7 @@ public:
|
|
|
|
connect(this, &Akonadi::ProcessControl::unableToStart, this, []() {
|
|
|
|
qCCritical(AKONADICONTROL_LOG) << "Failed to start AgentServer!";
|
|
|
|
});
|
2020-07-13 17:48:47 +01:00
|
|
|
- start(QStringLiteral("akonadi_agent_server"), args, RestartOnCrash);
|
2021-04-27 22:36:43 +01:00
|
|
|
+ start(QStringLiteral(NIX_OUT "/bin/akonadi_agent_server"), args, RestartOnCrash);
|
2018-04-20 15:24:00 +01:00
|
|
|
}
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2020-07-13 17:48:47 +01:00
|
|
|
~AgentServerProcessControl() override
|
|
|
|
diff --git a/src/akonadicontrol/agentprocessinstance.cpp b/src/akonadicontrol/agentprocessinstance.cpp
|
2021-04-25 14:05:06 +01:00
|
|
|
index 8e92e08..f98dfd8 100644
|
2020-07-13 17:48:47 +01:00
|
|
|
--- a/src/akonadicontrol/agentprocessinstance.cpp
|
|
|
|
+++ b/src/akonadicontrol/agentprocessinstance.cpp
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -47,7 +47,7 @@ bool AgentProcessInstance::start(const AgentType &agentInfo)
|
2018-04-20 15:24:00 +01:00
|
|
|
} else {
|
|
|
|
Q_ASSERT(agentInfo.launchMethod == AgentType::Launcher);
|
|
|
|
const QStringList arguments = QStringList() << executable << identifier();
|
|
|
|
- const QString agentLauncherExec = Akonadi::StandardDirs::findExecutable(QStringLiteral("akonadi_agent_launcher"));
|
2021-04-27 22:36:43 +01:00
|
|
|
+ const QString agentLauncherExec = QLatin1String(NIX_OUT "/bin/akonadi_agent_launcher");
|
2018-04-20 15:24:00 +01:00
|
|
|
mController->start(agentLauncherExec, arguments);
|
|
|
|
}
|
|
|
|
return true;
|
2020-07-13 17:48:47 +01:00
|
|
|
diff --git a/src/server/storage/dbconfigmysql.cpp b/src/server/storage/dbconfigmysql.cpp
|
2021-04-25 14:05:06 +01:00
|
|
|
index 1a437ac..3550f9d 100644
|
2020-07-13 17:48:47 +01:00
|
|
|
--- a/src/server/storage/dbconfigmysql.cpp
|
|
|
|
+++ b/src/server/storage/dbconfigmysql.cpp
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -72,7 +72,6 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2017-05-19 00:28:17 +01:00
|
|
|
// determine default settings depending on the driver
|
|
|
|
QString defaultHostName;
|
|
|
|
QString defaultOptions;
|
|
|
|
- QString defaultServerPath;
|
|
|
|
QString defaultCleanShutdownCommand;
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2017-05-19 00:28:17 +01:00
|
|
|
#ifndef Q_OS_WIN
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -80,16 +79,7 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2017-05-10 00:24:46 +01:00
|
|
|
#endif
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2017-05-19 00:28:17 +01:00
|
|
|
const bool defaultInternalServer = true;
|
|
|
|
-#ifdef MYSQLD_EXECUTABLE
|
|
|
|
- if (QFile::exists(QStringLiteral(MYSQLD_EXECUTABLE))) {
|
|
|
|
- defaultServerPath = QStringLiteral(MYSQLD_EXECUTABLE);
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
- if (defaultServerPath.isEmpty()) {
|
2019-02-21 15:29:04 +00:00
|
|
|
- defaultServerPath = findExecutable(QStringLiteral("mysqld"));
|
2017-05-19 00:28:17 +01:00
|
|
|
- }
|
2018-04-20 15:24:00 +01:00
|
|
|
-
|
2019-02-21 15:29:04 +00:00
|
|
|
- const QString mysqladminPath = findExecutable(QStringLiteral("mysqladmin"));
|
2017-05-23 12:55:36 +01:00
|
|
|
+ const QString mysqladminPath = QLatin1String(NIXPKGS_MYSQL_MYSQLADMIN);
|
2017-05-10 00:24:46 +01:00
|
|
|
if (!mysqladminPath.isEmpty()) {
|
|
|
|
#ifndef Q_OS_WIN
|
2019-08-16 12:52:03 +01:00
|
|
|
defaultCleanShutdownCommand = QStringLiteral("%1 --defaults-file=%2/mysql.conf --socket=%3/%4 shutdown")
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -99,10 +89,10 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2017-05-10 00:24:46 +01:00
|
|
|
#endif
|
|
|
|
}
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2019-02-21 15:29:04 +00:00
|
|
|
- mMysqlInstallDbPath = findExecutable(QStringLiteral("mysql_install_db"));
|
2017-05-23 12:55:36 +01:00
|
|
|
+ mMysqlInstallDbPath = QLatin1String(NIXPKGS_MYSQL_MYSQL_INSTALL_DB);
|
2017-05-10 00:24:46 +01:00
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found mysql_install_db: " << mMysqlInstallDbPath;
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2019-02-21 15:29:04 +00:00
|
|
|
- mMysqlCheckPath = findExecutable(QStringLiteral("mysqlcheck"));
|
2017-05-23 12:55:36 +01:00
|
|
|
+ mMysqlCheckPath = QLatin1String(NIXPKGS_MYSQL_MYSQLCHECK);
|
2017-05-10 00:24:46 +01:00
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found mysqlcheck: " << mMysqlCheckPath;
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2017-05-10 00:24:46 +01:00
|
|
|
mInternalServer = settings.value(QStringLiteral("QMYSQL/StartServer"), defaultInternalServer).toBool();
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -119,7 +109,7 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2017-05-10 00:24:46 +01: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();
|
2017-05-23 12:55:36 +01:00
|
|
|
+ mMysqldPath = QLatin1String(NIXPKGS_MYSQL_MYSQLD);
|
2017-05-10 00:24:46 +01:00
|
|
|
mCleanServerShutdownCommand = settings.value(QStringLiteral("CleanServerShutdownCommand"), defaultCleanShutdownCommand).toString();
|
|
|
|
settings.endGroup();
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -129,9 +119,6 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2017-05-19 00:28:17 +01: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;
|
|
|
|
- }
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2017-05-19 00:28:17 +01:00
|
|
|
qCDebug(AKONADISERVER_LOG) << "Using mysqld:" << mMysqldPath;
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -141,9 +128,6 @@ bool DbConfigMysql::init(QSettings &settings, bool storeSettings)
|
2021-01-31 17:01:57 +00:00
|
|
|
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();
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -215,7 +199,7 @@ bool DbConfigMysql::startInternalServer()
|
2017-05-10 00:24:46 +01:00
|
|
|
#endif
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2017-05-10 00:24:46 +01:00
|
|
|
// generate config file
|
2018-04-20 15:24:00 +01:00
|
|
|
- const QString globalConfig = StandardDirs::locateResourceFile("config", QStringLiteral("mysql-global.conf"));
|
2021-04-27 22:36:43 +01:00
|
|
|
+ const QString globalConfig = QLatin1String(NIX_OUT "/etc/xdg/akonadi/mysql-global.conf");
|
2021-04-25 14:05:06 +01:00
|
|
|
const QString localConfig = StandardDirs::locateResourceFile("config", QStringLiteral("mysql-local.conf"));
|
2017-05-10 00:24:46 +01:00
|
|
|
const QString actualConfig = StandardDirs::saveDir("data") + QLatin1String("/mysql.conf");
|
|
|
|
if (globalConfig.isEmpty()) {
|
2020-07-13 17:48:47 +01:00
|
|
|
diff --git a/src/server/storage/dbconfigpostgresql.cpp b/src/server/storage/dbconfigpostgresql.cpp
|
2021-04-25 14:05:06 +01:00
|
|
|
index 4df61da..e3469c4 100644
|
2020-07-13 17:48:47 +01:00
|
|
|
--- a/src/server/storage/dbconfigpostgresql.cpp
|
|
|
|
+++ b/src/server/storage/dbconfigpostgresql.cpp
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -125,9 +125,7 @@ bool DbConfigPostgresql::init(QSettings &settings, bool storeSettings)
|
2017-05-19 00:30:35 +01:00
|
|
|
// determine default settings depending on the driver
|
|
|
|
QString defaultHostName;
|
|
|
|
QString defaultOptions;
|
|
|
|
- QString defaultServerPath;
|
|
|
|
QString defaultInitDbPath;
|
2019-08-16 12:52:03 +01:00
|
|
|
- QString defaultPgUpgradePath;
|
2017-05-19 00:30:35 +01:00
|
|
|
QString defaultPgData;
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2019-08-16 12:52:03 +01:00
|
|
|
#ifndef Q_WS_WIN // We assume that PostgreSQL is running as service on Windows
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -138,12 +136,8 @@ bool DbConfigPostgresql::init(QSettings &settings, bool storeSettings)
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2017-05-19 00:30:35 +01:00
|
|
|
mInternalServer = settings.value(QStringLiteral("QPSQL/StartServer"), defaultInternalServer).toBool();
|
|
|
|
if (mInternalServer) {
|
2019-08-16 12:52:03 +01:00
|
|
|
- const auto paths = postgresSearchPaths(QStringLiteral("/usr/lib/postgresql"));
|
2017-05-19 00:30:35 +01:00
|
|
|
-
|
2019-08-16 12:52:03 +01:00
|
|
|
- defaultServerPath = QStandardPaths::findExecutable(QStringLiteral("pg_ctl"), paths);
|
|
|
|
- defaultInitDbPath = QStandardPaths::findExecutable(QStringLiteral("initdb"), paths);
|
2017-05-23 12:55:36 +01:00
|
|
|
+ defaultInitDbPath = QLatin1String(NIXPKGS_POSTGRES_INITDB);
|
2017-05-10 00:24:46 +01:00
|
|
|
defaultHostName = Utils::preferredSocketDirectory(StandardDirs::saveDir("data", QStringLiteral("db_misc")));
|
2019-08-16 12:52:03 +01:00
|
|
|
- defaultPgUpgradePath = QStandardPaths::findExecutable(QStringLiteral("pg_upgrade"), paths);
|
2017-05-10 00:24:46 +01:00
|
|
|
defaultPgData = StandardDirs::saveDir("data", QStringLiteral("db_data"));
|
|
|
|
}
|
2021-04-27 22:36:43 +01:00
|
|
|
|
2021-04-25 14:05:06 +01:00
|
|
|
@@ -162,20 +156,14 @@ bool DbConfigPostgresql::init(QSettings &settings, bool storeSettings)
|
2017-05-19 00:30:35 +01: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;
|
|
|
|
- }
|
2017-05-23 12:55:36 +01:00
|
|
|
+ mServerPath = QLatin1String(NIXPKGS_POSTGRES_PG_CTL);
|
2017-05-19 00:30:35 +01:00
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found pg_ctl:" << mServerPath;
|
|
|
|
mInitDbPath = settings.value(QStringLiteral("InitDbPath"), defaultInitDbPath).toString();
|
|
|
|
if (mInternalServer && mInitDbPath.isEmpty()) {
|
2019-08-16 12:52:03 +01:00
|
|
|
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-04-25 14:05:06 +01:00
|
|
|
@@ -192,7 +180,6 @@ bool DbConfigPostgresql::init(QSettings &settings, bool storeSettings)
|
2021-01-31 17:01:57 +00:00
|
|
|
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();
|
2021-04-27 22:36:43 +01:00
|
|
|
--
|
2021-04-25 14:05:06 +01:00
|
|
|
2.31.1
|
2020-07-13 17:48:47 +01:00
|
|
|
|