2018-04-20 16:24:00 +02:00
|
|
|
diff --git a/src/akonadicontrol/agentmanager.cpp b/src/akonadicontrol/agentmanager.cpp
|
|
|
|
index 2e9f1acf4..ecc80afdc 100644
|
|
|
|
--- a/src/akonadicontrol/agentmanager.cpp
|
|
|
|
+++ b/src/akonadicontrol/agentmanager.cpp
|
|
|
|
@@ -84,12 +84,12 @@ AgentManager::AgentManager(bool verbose, QObject *parent)
|
|
|
|
mStorageController = new Akonadi::ProcessControl;
|
|
|
|
mStorageController->setShutdownTimeout(15 * 1000); // the server needs more time for shutdown if we are using an internal mysqld
|
|
|
|
connect(mStorageController, &Akonadi::ProcessControl::unableToStart, this, &AgentManager::serverFailure);
|
|
|
|
- mStorageController->start(QStringLiteral("akonadiserver"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
|
|
|
|
+ mStorageController->start(QLatin1String(NIX_OUT "/bin/akonadiserver"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
|
|
|
|
|
|
|
|
if (mAgentServerEnabled) {
|
|
|
|
mAgentServer = new Akonadi::ProcessControl;
|
|
|
|
connect(mAgentServer, &Akonadi::ProcessControl::unableToStart, this, &AgentManager::agentServerFailure);
|
|
|
|
- mAgentServer->start(QStringLiteral("akonadi_agent_server"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
|
|
|
|
+ mAgentServer->start(QLatin1String(NIX_OUT "/bin/akonadi_agent_server"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef QT_NO_DEBUG
|
|
|
|
diff --git a/src/akonadicontrol/agentprocessinstance.cpp b/src/akonadicontrol/agentprocessinstance.cpp
|
|
|
|
index be1cc4afb..6d0c1d7e5 100644
|
|
|
|
--- a/src/akonadicontrol/agentprocessinstance.cpp
|
|
|
|
+++ b/src/akonadicontrol/agentprocessinstance.cpp
|
|
|
|
@@ -62,7 +62,7 @@ bool AgentProcessInstance::start(const AgentType &agentInfo)
|
|
|
|
} 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;
|
|
|
|
diff --git a/src/server/storage/dbconfigmysql.cpp b/src/server/storage/dbconfigmysql.cpp
|
|
|
|
index a32e86602..48ea4e52e 100644
|
|
|
|
--- a/src/server/storage/dbconfigmysql.cpp
|
|
|
|
+++ b/src/server/storage/dbconfigmysql.cpp
|
|
|
|
@@ -63,7 +63,6 @@ bool DbConfigMysql::init(QSettings &settings)
|
2017-05-19 01:28:17 +02:00
|
|
|
// determine default settings depending on the driver
|
|
|
|
QString defaultHostName;
|
|
|
|
QString defaultOptions;
|
|
|
|
- QString defaultServerPath;
|
|
|
|
QString defaultCleanShutdownCommand;
|
|
|
|
|
|
|
|
#ifndef Q_OS_WIN
|
2018-04-20 16:24:00 +02:00
|
|
|
@@ -71,25 +70,7 @@ bool DbConfigMysql::init(QSettings &settings)
|
2017-05-10 01:24:46 +02:00
|
|
|
#endif
|
2017-05-19 01:28:17 +02:00
|
|
|
|
|
|
|
const bool defaultInternalServer = true;
|
|
|
|
-#ifdef MYSQLD_EXECUTABLE
|
|
|
|
- if (QFile::exists(QStringLiteral(MYSQLD_EXECUTABLE))) {
|
|
|
|
- defaultServerPath = QStringLiteral(MYSQLD_EXECUTABLE);
|
|
|
|
- }
|
|
|
|
-#endif
|
2017-05-10 01:24:46 +02:00
|
|
|
- const QStringList mysqldSearchPath = QStringList()
|
|
|
|
- << QStringLiteral("/usr/bin")
|
|
|
|
- << QStringLiteral("/usr/sbin")
|
|
|
|
- << QStringLiteral("/usr/local/sbin")
|
|
|
|
- << QStringLiteral("/usr/local/libexec")
|
|
|
|
- << QStringLiteral("/usr/libexec")
|
|
|
|
- << QStringLiteral("/opt/mysql/libexec")
|
|
|
|
- << QStringLiteral("/opt/local/lib/mysql5/bin")
|
|
|
|
- << QStringLiteral("/opt/mysql/sbin");
|
2017-05-19 01:28:17 +02:00
|
|
|
- if (defaultServerPath.isEmpty()) {
|
2018-04-20 16:24:00 +02:00
|
|
|
- defaultServerPath = QStandardPaths::findExecutable(QStringLiteral("mysqld"), mysqldSearchPath);
|
2017-05-19 01:28:17 +02:00
|
|
|
- }
|
2018-04-20 16:24:00 +02:00
|
|
|
-
|
|
|
|
- const QString mysqladminPath = QStandardPaths::findExecutable(QStringLiteral("mysqladmin"), mysqldSearchPath);
|
2017-05-23 13:55:36 +02:00
|
|
|
+ const QString mysqladminPath = QLatin1String(NIXPKGS_MYSQL_MYSQLADMIN);
|
2017-05-10 01:24:46 +02:00
|
|
|
if (!mysqladminPath.isEmpty()) {
|
|
|
|
#ifndef Q_OS_WIN
|
|
|
|
defaultCleanShutdownCommand = QStringLiteral("%1 --defaults-file=%2/mysql.conf --socket=%3/mysql.socket shutdown")
|
2018-04-20 16:24:00 +02:00
|
|
|
@@ -99,10 +80,10 @@ bool DbConfigMysql::init(QSettings &settings)
|
2017-05-10 01:24:46 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-04-20 16:24:00 +02:00
|
|
|
- mMysqlInstallDbPath = QStandardPaths::findExecutable(QStringLiteral("mysql_install_db"), mysqldSearchPath);
|
2017-05-23 13:55:36 +02:00
|
|
|
+ mMysqlInstallDbPath = QLatin1String(NIXPKGS_MYSQL_MYSQL_INSTALL_DB);
|
2017-05-10 01:24:46 +02:00
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found mysql_install_db: " << mMysqlInstallDbPath;
|
|
|
|
|
2018-04-20 16:24:00 +02:00
|
|
|
- mMysqlCheckPath = QStandardPaths::findExecutable(QStringLiteral("mysqlcheck"), mysqldSearchPath);
|
2017-05-23 13:55:36 +02:00
|
|
|
+ mMysqlCheckPath = QLatin1String(NIXPKGS_MYSQL_MYSQLCHECK);
|
2017-05-10 01:24:46 +02:00
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found mysqlcheck: " << mMysqlCheckPath;
|
|
|
|
|
|
|
|
mInternalServer = settings.value(QStringLiteral("QMYSQL/StartServer"), defaultInternalServer).toBool();
|
2018-04-20 16:24:00 +02:00
|
|
|
@@ -119,7 +100,7 @@ bool DbConfigMysql::init(QSettings &settings)
|
2017-05-10 01:24:46 +02: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 13:55:36 +02:00
|
|
|
+ mMysqldPath = QLatin1String(NIXPKGS_MYSQL_MYSQLD);
|
2017-05-10 01:24:46 +02:00
|
|
|
mCleanServerShutdownCommand = settings.value(QStringLiteral("CleanServerShutdownCommand"), defaultCleanShutdownCommand).toString();
|
|
|
|
settings.endGroup();
|
|
|
|
|
2018-04-20 16:24:00 +02:00
|
|
|
@@ -129,9 +110,6 @@ bool DbConfigMysql::init(QSettings &settings)
|
2017-05-19 01:28:17 +02: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;
|
|
|
|
|
2018-04-20 16:24:00 +02:00
|
|
|
@@ -140,9 +118,6 @@ bool DbConfigMysql::init(QSettings &settings)
|
2017-05-19 01:28:17 +02: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();
|
2018-04-20 16:24:00 +02:00
|
|
|
@@ -196,7 +171,7 @@ bool DbConfigMysql::startInternalServer()
|
2017-05-10 01:24:46 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// generate config file
|
2018-04-20 16:24:00 +02:00
|
|
|
- const QString globalConfig = StandardDirs::locateResourceFile("config", QStringLiteral("mysql-global.conf"));
|
2017-05-23 13:55:36 +02:00
|
|
|
+ const QString globalConfig = QLatin1String(NIX_OUT "/etc/xdg/akonadi/mysql-global.conf");
|
2018-04-20 16:24:00 +02:00
|
|
|
const QString localConfig = StandardDirs::locateResourceFile("config", QStringLiteral("mysql-local.conf"));
|
2017-05-10 01:24:46 +02:00
|
|
|
const QString actualConfig = StandardDirs::saveDir("data") + QLatin1String("/mysql.conf");
|
|
|
|
if (globalConfig.isEmpty()) {
|
2018-04-20 16:24:00 +02:00
|
|
|
diff --git a/src/server/storage/dbconfigpostgresql.cpp b/src/server/storage/dbconfigpostgresql.cpp
|
|
|
|
index 60e6272f2..ad7cefbfe 100644
|
|
|
|
--- a/src/server/storage/dbconfigpostgresql.cpp
|
|
|
|
+++ b/src/server/storage/dbconfigpostgresql.cpp
|
|
|
|
@@ -58,7 +58,6 @@ bool DbConfigPostgresql::init(QSettings &settings)
|
2017-05-19 01:30:35 +02:00
|
|
|
// determine default settings depending on the driver
|
|
|
|
QString defaultHostName;
|
|
|
|
QString defaultOptions;
|
|
|
|
- QString defaultServerPath;
|
|
|
|
QString defaultInitDbPath;
|
|
|
|
QString defaultPgData;
|
2017-05-10 01:24:46 +02:00
|
|
|
|
2018-04-20 16:24:00 +02:00
|
|
|
@@ -70,34 +69,7 @@ bool DbConfigPostgresql::init(QSettings &settings)
|
2017-05-19 01:30:35 +02:00
|
|
|
|
|
|
|
mInternalServer = settings.value(QStringLiteral("QPSQL/StartServer"), defaultInternalServer).toBool();
|
|
|
|
if (mInternalServer) {
|
|
|
|
- QStringList postgresSearchPath;
|
|
|
|
-
|
|
|
|
-#ifdef POSTGRES_PATH
|
|
|
|
- const QString dir(QStringLiteral(POSTGRES_PATH));
|
|
|
|
- if (QDir(dir).exists()) {
|
|
|
|
- postgresSearchPath << QStringLiteral(POSTGRES_PATH);
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
- postgresSearchPath << QStringLiteral("/usr/sbin")
|
|
|
|
- << QStringLiteral("/usr/local/sbin");
|
|
|
|
- // Locale all versions in /usr/lib/postgresql (i.e. /usr/lib/postgresql/X.Y) in reversed
|
|
|
|
- // sorted order, so we search from the newest one to the oldest.
|
|
|
|
- QStringList postgresVersionedSearchPaths;
|
|
|
|
- QDir versionedDir(QStringLiteral("/usr/lib/postgresql"));
|
|
|
|
- if (versionedDir.exists()) {
|
|
|
|
- const auto versionedDirs = versionedDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed);
|
|
|
|
- for (const auto &path : versionedDirs) {
|
|
|
|
- // Don't break once PostgreSQL 10 is released, but something more future-proof will be needed
|
|
|
|
- if (path.fileName().startsWith(QLatin1String("10."))) {
|
|
|
|
- postgresVersionedSearchPaths.prepend(path.absoluteFilePath() + QStringLiteral("/bin"));
|
|
|
|
- } else {
|
|
|
|
- postgresVersionedSearchPaths.append(path.absoluteFilePath() + QStringLiteral("/bin"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- postgresSearchPath.append(postgresVersionedSearchPaths);
|
2018-04-20 16:24:00 +02:00
|
|
|
- defaultServerPath = QStandardPaths::findExecutable(QStringLiteral("pg_ctl"), postgresSearchPath);
|
|
|
|
- defaultInitDbPath = QStandardPaths::findExecutable(QStringLiteral("initdb"), postgresSearchPath);
|
2017-05-23 13:55:36 +02:00
|
|
|
+ defaultInitDbPath = QLatin1String(NIXPKGS_POSTGRES_INITDB);
|
2017-05-10 01:24:46 +02:00
|
|
|
defaultHostName = Utils::preferredSocketDirectory(StandardDirs::saveDir("data", QStringLiteral("db_misc")));
|
|
|
|
defaultPgData = StandardDirs::saveDir("data", QStringLiteral("db_data"));
|
|
|
|
}
|
2018-04-20 16:24:00 +02:00
|
|
|
@@ -117,10 +89,7 @@ bool DbConfigPostgresql::init(QSettings &settings)
|
2017-05-19 01:30:35 +02: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 13:55:36 +02:00
|
|
|
+ mServerPath = QLatin1String(NIXPKGS_POSTGRES_PG_CTL);
|
2017-05-19 01:30:35 +02:00
|
|
|
qCDebug(AKONADISERVER_LOG) << "Found pg_ctl:" << mServerPath;
|
|
|
|
mInitDbPath = settings.value(QStringLiteral("InitDbPath"), defaultInitDbPath).toString();
|
|
|
|
if (mInternalServer && mInitDbPath.isEmpty()) {
|
2018-04-20 16:24:00 +02:00
|
|
|
@@ -141,7 +110,6 @@ bool DbConfigPostgresql::init(QSettings &settings)
|
2017-05-19 01:30:35 +02: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();
|