- Index: server/src/akonadi.cpp
- ===================================================================
- --- server/src/akonadi.cpp
- +++ server/src/akonadi.cpp 2010-03-22 10:15:12.000000000 +0100
- @@ -368,11 +368,15 @@
- void AkonadiServer::startMysqlDatabaseProcess()
- {
- const QString mysqldPath = DbConfig::serverPath();
- + const QStringList mysqldSearchPath = DbConfig::mysqldSearchPath();
- const QString dataDir = XdgBaseDirs::saveDir( "data", QLatin1String( "akonadi/db_data" ) );
- const QString akDir = XdgBaseDirs::saveDir( "data", QLatin1String( "akonadi/" ) );
- const QString miscDir = XdgBaseDirs::saveDir( "data", QLatin1String( "akonadi/db_misc" ) );
- const QString fileDataDir = XdgBaseDirs::saveDir( "data", QLatin1String( "akonadi/file_db_data" ) );
- + const QString mMysqlInstallDbPath = XdgBaseDirs::findExecutableFile( QLatin1String( "mysql_install_db" ), mysqldSearchPath );
- + akDebug() << "Found mysql_install_db: " << mMysqlInstallDbPath;
- +
- // generate config file
- const QString globalConfig = XdgBaseDirs::findResourceFile( "config", QLatin1String( "akonadi/mysql-global.conf" ) );
- @@ -443,6 +447,12 @@
- }
- }
- + // first run, some MySQL versions need a mysql_install_db run for that
- + if ( QDir( dataDir ).entryList( QDir::NoDotAndDotDot | QDir::AllEntries ).isEmpty() && !mMysqlInstallDbPath.isEmpty() ) {
- + const QStringList arguments = QStringList() << QString::fromLatin1( "--datadir=%1/" ).arg( dataDir );
- + QProcess::execute( mMysqlInstallDbPath, arguments );
- + }
- +
- // clear mysql ib_logfile's in case innodb_log_file_size option changed in last confUpdate
- if ( confUpdate ) {
- QFile(dataDir + QDir::separator() + QString::fromLatin1( "ib_logfile0" )).remove();
- Index: server/src/storage/dbconfig.cpp
- ===================================================================
- --- server/src/storage/dbconfig.cpp
- +++ server/src/storage/dbconfig.cpp 2010-03-22 10:13:08.000000000 +0100
- @@ -299,3 +299,15 @@
- return sInstance()->mCleanServerShutdownCommand;
- }
- +QStringList DbConfig::mysqldSearchPath()
- +{
- +const QStringList mysqldSearchPath = QStringList()
- + << QLatin1String("/usr/sbin")
- + << QLatin1String("/usr/local/sbin")
- + << QLatin1String("/usr/local/libexec")
- + << QLatin1String("/usr/libexec")
- + << QLatin1String("/opt/mysql/libexec")
- + << QLatin1String("/opt/local/lib/mysql5/bin");
- +
- + return mysqldSearchPath ;
- +}
- Index: server/src/storage/dbconfig.h
- ===================================================================
- --- server/src/storage/dbconfig.h
- +++ server/src/storage/dbconfig.h 2010-03-22 10:14:28.000000000 +0100
- @@ -76,6 +76,11 @@
- * exists.
- */
- QString cleanServerShutdownCommand();
- +
- + /**
- + * Returns the path where mysql binaries are searched
- + */
- + QStringList mysqldSearchPath() ;
- }
- #endif
