diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.cpp index 0596a95bf7c..2136168f4d5 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoanalyzersupport.cpp @@ -54,9 +54,9 @@ RunControl *MaemoAnalyzerSupport::createAnalyzerRunControl(MaemoRunConfiguration const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig(); params.debuggee = runConfig->remoteExecutableFilePath(); params.debuggeeArgs = runConfig->arguments(); - params.analyzerCmdPrefix - = MaemoGlobal::remoteCommandPrefix(runConfig->remoteExecutableFilePath()) - + MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges()); + params.analyzerCmdPrefix = MaemoGlobal::remoteCommandPrefix(devConf->osVersion(), + devConf->sshParameters().userName, runConfig->remoteExecutableFilePath()) + + MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges()); params.startMode = StartRemote; params.connParams = devConf->sshParameters(); params.localMountDir = runConfig->localDirToMountForRemoteGdb(); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp index 771d5edf80b..cf97033428a 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoconfigtestdialog.cpp @@ -163,7 +163,7 @@ void MaemoConfigTestDialog::handleGeneralTestResult(int exitStatus) disconnect(m_testProcessRunner.data(), SIGNAL(processOutputAvailable(QByteArray)), this, SLOT(processSshOutput(QByteArray))); - const QByteArray command = "test -x " + MaemoGlobal::remoteSudo().toUtf8(); + const QByteArray command = "test -x " + MaemoGlobal::devrootshPath().toUtf8(); m_testProcessRunner->run(command); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp index bc29fe66fa4..dbf6bd31eab 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodebugsupport.cpp @@ -82,6 +82,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC params.startMode = StartRemoteGdb; params.executable = runConfig->remoteExecutableFilePath(); params.debuggerCommand = MaemoGlobal::remoteCommandPrefix(runConfig->deviceConfig()->osVersion(), + runConfig->deviceConfig()->sshParameters().userName, runConfig->remoteExecutableFilePath()) + MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges()) + QLatin1String(" /usr/bin/gdb"); @@ -290,7 +291,7 @@ void MaemoDebugSupport::startDebugging() } const QString &remoteExe = m_runner->remoteExecutable(); const QString cmdPrefix = MaemoGlobal::remoteCommandPrefix(m_deviceConfig->osVersion(), - remoteExe); + m_deviceConfig->sshParameters().userName, remoteExe); const QString env = MaemoGlobal::remoteEnvironment(m_userEnvChanges); QString args = m_runner->arguments(); if (m_debuggingType != MaemoRunConfiguration::DebugCppOnly) { diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp index 4027cbb3b4e..4e11571d1eb 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.cpp @@ -124,17 +124,22 @@ QString MaemoGlobal::homeDirOnDevice(const QString &uname) : QLatin1String("/home/") + uname; } -QString MaemoGlobal::remoteSudo() +QString MaemoGlobal::devrootshPath() { return QLatin1String("/usr/lib/mad-developer/devrootsh"); } -QString MaemoGlobal::remoteCommandPrefix(MaemoVersion maemoVersion, - const QString &commandFilePath) +QString MaemoGlobal::remoteSudo(const QString &uname) +{ + return uname == QLatin1String("root") ? QString() : devrootshPath(); +} + +QString MaemoGlobal::remoteCommandPrefix(OsVersion osVersion, + const QString &userName, const QString &commandFilePath) { QString prefix = QString::fromLocal8Bit("%1 chmod a+x %2; %3; ") - .arg(remoteSudo(), commandFilePath, remoteSourceProfilesCommand()); - if (maemoVersion != Maemo5 && maemoVersion != Maemo6) + .arg(remoteSudo(userName), commandFilePath, remoteSourceProfilesCommand()); + if (osVersion != Maemo5 && osVersion != Maemo6) prefix += QLatin1String("DISPLAY=:0.0 "); return prefix; } @@ -207,9 +212,9 @@ QString MaemoGlobal::madCommand(const QtVersion *qtVersion) return maddeRoot(qtVersion) + QLatin1String("/bin/mad"); } -QString MaemoGlobal::madDeveloperUiName(OsVersion maemoVersion) +QString MaemoGlobal::madDeveloperUiName(OsVersion osVersion) { - return maemoVersion == Maemo6 + return osVersion == Maemo6 ? tr("SDK Connectivity") : tr("Mad Developer"); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h index 8f29cfe92d8..006c75ccd56 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoglobal.h @@ -83,9 +83,10 @@ public: static bool isValidMeegoQtVersion(const Qt4ProjectManager::QtVersion *version); static QString homeDirOnDevice(const QString &uname); - static QString remoteSudo(); - static QString remoteCommandPrefix(MaemoVersion maemoVersion, - const QString &commandFilePath); + static QString devrootshPath(); + static QString remoteSudo(const QString &uname); + static QString remoteCommandPrefix(OsVersion osVersion, + const QString &userName, const QString &commandFilePath); static QString remoteEnvironment(const QList &list); static QString remoteSourceProfilesCommand(); static QString failedToConnectToServerMessage(const QSharedPointer &connection, diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.cpp index 761c1e5faaa..aefb2d1213f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackageinstaller.cpp @@ -67,7 +67,8 @@ void AbstractMaemoPackageInstaller::installPackage(const SshConnection::Ptr &con SLOT(handleInstallationFinished(int))); const QString space = QLatin1String(" "); - QString cmdLine = MaemoGlobal::remoteSudo() + space + installCommand() + QString cmdLine = MaemoGlobal::remoteSudo(m_installer->connection()->connectionParameters().userName) + + space + installCommand() + space + installCommandArguments().join(space) + space + packageFilePath; if (removePackageFile) { diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.cpp index eaac7590ce2..d272f8b7edf 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoremotecopyfacility.cpp @@ -137,8 +137,8 @@ void MaemoRemoteCopyFacility::copyNextFile() #endif QString command = QString::fromLatin1("%1 cp -r %2 %3") - .arg(MaemoGlobal::remoteSudo(), sourceFilePath, - d.remoteDir + QLatin1Char('/')); + .arg(MaemoGlobal::remoteSudo(m_copyRunner->connection()->connectionParameters().userName), + sourceFilePath, d.remoteDir + QLatin1Char('/')); emit progress(tr("Copying file '%1' to directory '%2' on the device...") .arg(d.localFilePath, d.remoteDir)); m_copyRunner->run(command.toUtf8()); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp index e18cc00c828..f94a14cd8f1 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemounter.cpp @@ -124,7 +124,7 @@ void MaemoRemoteMounter::unmount() QString remoteCall; for (int i = 0; i < m_mountSpecs.count(); ++i) { remoteCall += QString::fromLocal8Bit("%1 umount %2 && %1 rmdir %2;") - .arg(MaemoGlobal::remoteSudo(), + .arg(MaemoGlobal::remoteSudo(m_connection->connectionParameters().userName), m_mountSpecs.at(i).mountSpec.remoteMountPoint); } @@ -183,8 +183,9 @@ void MaemoRemoteMounter::stop() void MaemoRemoteMounter::startUtfsClients() { - const QString chmodFuse - = MaemoGlobal::remoteSudo() + QLatin1String(" chmod a+r+w /dev/fuse"); + const QString userName = m_connection->connectionParameters().userName; + const QString chmodFuse = MaemoGlobal::remoteSudo(userName) + + QLatin1String(" chmod a+r+w /dev/fuse"); const QString chmodUtfsClient = QLatin1String("chmod a+x ") + utfsClientOnDevice(); const QLatin1String andOp(" && "); @@ -201,15 +202,15 @@ void MaemoRemoteMounter::startUtfsClients() const MaemoMountSpecification &mountSpec = mountInfo.mountSpec; const QString mkdir = QString::fromLocal8Bit("%1 mkdir -p %2") - .arg(MaemoGlobal::remoteSudo(), mountSpec.remoteMountPoint); + .arg(MaemoGlobal::remoteSudo(userName), mountSpec.remoteMountPoint); const QString chmod = QString::fromLocal8Bit("%1 chmod a+r+w+x %2") - .arg(MaemoGlobal::remoteSudo(), mountSpec.remoteMountPoint); + .arg(MaemoGlobal::remoteSudo(userName), mountSpec.remoteMountPoint); QString utfsClient = QString::fromLocal8Bit("%1 -l %2 -r %2 -b %2 %4 -o nonempty") .arg(utfsClientOnDevice()).arg(mountInfo.remotePort) .arg(mountSpec.remoteMountPoint); if (mountInfo.mountAsRoot) - utfsClient.prepend(MaemoGlobal::remoteSudo() + QLatin1Char(' ')); + utfsClient.prepend(MaemoGlobal::remoteSudo(userName) + QLatin1Char(' ')); QLatin1String seqOp("; "); remoteCall += seqOp + MaemoGlobal::remoteSourceProfilesCommand() + seqOp + mkdir + andOp + chmod + andOp + utfsClient; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp index d9c2cccd33f..0866ff49f08 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp @@ -101,6 +101,7 @@ void MaemoRunControl::startExecution() appendMessage(tr("Starting remote process ...\n"), NormalMessageFormat); m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4") .arg(MaemoGlobal::remoteCommandPrefix(m_runner->devConfig()->osVersion(), + m_runner->connection()->connectionParameters().userName, m_runner->remoteExecutable())) .arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges())) .arg(m_runner->remoteExecutable()) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.cpp index 3cb2eaee174..edf21416e7c 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemousedportsgatherer.cpp @@ -66,7 +66,7 @@ void MaemoUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection, SLOT(handleRemoteStdOut(QByteArray))); connect(m_procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)), SLOT(handleRemoteStdErr(QByteArray))); - const QString command = MaemoGlobal::remoteSudo() + const QString command = MaemoGlobal::remoteSudo(m_procRunner->connection()->connectionParameters().userName) + QLatin1String(" lsof -nPi4tcp:") + portList.toString() + QLatin1String(" -F n |grep '^n' |sed -r 's/[^:]*:([[:digit:]]+).*/\\1/g' |sort -n |uniq"); m_procRunner->run(command.toUtf8());