forked from qt-creator/qt-creator
Maemo: Use devrootsh only when not connected as root.
This commit is contained in:
@@ -54,9 +54,9 @@ RunControl *MaemoAnalyzerSupport::createAnalyzerRunControl(MaemoRunConfiguration
|
|||||||
const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig();
|
const MaemoDeviceConfig::ConstPtr &devConf = runConfig->deviceConfig();
|
||||||
params.debuggee = runConfig->remoteExecutableFilePath();
|
params.debuggee = runConfig->remoteExecutableFilePath();
|
||||||
params.debuggeeArgs = runConfig->arguments();
|
params.debuggeeArgs = runConfig->arguments();
|
||||||
params.analyzerCmdPrefix
|
params.analyzerCmdPrefix = MaemoGlobal::remoteCommandPrefix(devConf->osVersion(),
|
||||||
= MaemoGlobal::remoteCommandPrefix(runConfig->remoteExecutableFilePath())
|
devConf->sshParameters().userName, runConfig->remoteExecutableFilePath())
|
||||||
+ MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges());
|
+ MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges());
|
||||||
params.startMode = StartRemote;
|
params.startMode = StartRemote;
|
||||||
params.connParams = devConf->sshParameters();
|
params.connParams = devConf->sshParameters();
|
||||||
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
|
params.localMountDir = runConfig->localDirToMountForRemoteGdb();
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ void MaemoConfigTestDialog::handleGeneralTestResult(int exitStatus)
|
|||||||
disconnect(m_testProcessRunner.data(),
|
disconnect(m_testProcessRunner.data(),
|
||||||
SIGNAL(processOutputAvailable(QByteArray)), this,
|
SIGNAL(processOutputAvailable(QByteArray)), this,
|
||||||
SLOT(processSshOutput(QByteArray)));
|
SLOT(processSshOutput(QByteArray)));
|
||||||
const QByteArray command = "test -x " + MaemoGlobal::remoteSudo().toUtf8();
|
const QByteArray command = "test -x " + MaemoGlobal::devrootshPath().toUtf8();
|
||||||
m_testProcessRunner->run(command);
|
m_testProcessRunner->run(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ RunControl *MaemoDebugSupport::createDebugRunControl(MaemoRunConfiguration *runC
|
|||||||
params.startMode = StartRemoteGdb;
|
params.startMode = StartRemoteGdb;
|
||||||
params.executable = runConfig->remoteExecutableFilePath();
|
params.executable = runConfig->remoteExecutableFilePath();
|
||||||
params.debuggerCommand = MaemoGlobal::remoteCommandPrefix(runConfig->deviceConfig()->osVersion(),
|
params.debuggerCommand = MaemoGlobal::remoteCommandPrefix(runConfig->deviceConfig()->osVersion(),
|
||||||
|
runConfig->deviceConfig()->sshParameters().userName,
|
||||||
runConfig->remoteExecutableFilePath())
|
runConfig->remoteExecutableFilePath())
|
||||||
+ MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges())
|
+ MaemoGlobal::remoteEnvironment(runConfig->userEnvironmentChanges())
|
||||||
+ QLatin1String(" /usr/bin/gdb");
|
+ QLatin1String(" /usr/bin/gdb");
|
||||||
@@ -290,7 +291,7 @@ void MaemoDebugSupport::startDebugging()
|
|||||||
}
|
}
|
||||||
const QString &remoteExe = m_runner->remoteExecutable();
|
const QString &remoteExe = m_runner->remoteExecutable();
|
||||||
const QString cmdPrefix = MaemoGlobal::remoteCommandPrefix(m_deviceConfig->osVersion(),
|
const QString cmdPrefix = MaemoGlobal::remoteCommandPrefix(m_deviceConfig->osVersion(),
|
||||||
remoteExe);
|
m_deviceConfig->sshParameters().userName, remoteExe);
|
||||||
const QString env = MaemoGlobal::remoteEnvironment(m_userEnvChanges);
|
const QString env = MaemoGlobal::remoteEnvironment(m_userEnvChanges);
|
||||||
QString args = m_runner->arguments();
|
QString args = m_runner->arguments();
|
||||||
if (m_debuggingType != MaemoRunConfiguration::DebugCppOnly) {
|
if (m_debuggingType != MaemoRunConfiguration::DebugCppOnly) {
|
||||||
|
|||||||
@@ -124,17 +124,22 @@ QString MaemoGlobal::homeDirOnDevice(const QString &uname)
|
|||||||
: QLatin1String("/home/") + uname;
|
: QLatin1String("/home/") + uname;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoGlobal::remoteSudo()
|
QString MaemoGlobal::devrootshPath()
|
||||||
{
|
{
|
||||||
return QLatin1String("/usr/lib/mad-developer/devrootsh");
|
return QLatin1String("/usr/lib/mad-developer/devrootsh");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MaemoGlobal::remoteCommandPrefix(MaemoVersion maemoVersion,
|
QString MaemoGlobal::remoteSudo(const QString &uname)
|
||||||
const QString &commandFilePath)
|
{
|
||||||
|
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; ")
|
QString prefix = QString::fromLocal8Bit("%1 chmod a+x %2; %3; ")
|
||||||
.arg(remoteSudo(), commandFilePath, remoteSourceProfilesCommand());
|
.arg(remoteSudo(userName), commandFilePath, remoteSourceProfilesCommand());
|
||||||
if (maemoVersion != Maemo5 && maemoVersion != Maemo6)
|
if (osVersion != Maemo5 && osVersion != Maemo6)
|
||||||
prefix += QLatin1String("DISPLAY=:0.0 ");
|
prefix += QLatin1String("DISPLAY=:0.0 ");
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
@@ -207,9 +212,9 @@ QString MaemoGlobal::madCommand(const QtVersion *qtVersion)
|
|||||||
return maddeRoot(qtVersion) + QLatin1String("/bin/mad");
|
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");
|
? tr("SDK Connectivity") : tr("Mad Developer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,9 +83,10 @@ public:
|
|||||||
static bool isValidMeegoQtVersion(const Qt4ProjectManager::QtVersion *version);
|
static bool isValidMeegoQtVersion(const Qt4ProjectManager::QtVersion *version);
|
||||||
|
|
||||||
static QString homeDirOnDevice(const QString &uname);
|
static QString homeDirOnDevice(const QString &uname);
|
||||||
static QString remoteSudo();
|
static QString devrootshPath();
|
||||||
static QString remoteCommandPrefix(MaemoVersion maemoVersion,
|
static QString remoteSudo(const QString &uname);
|
||||||
const QString &commandFilePath);
|
static QString remoteCommandPrefix(OsVersion osVersion,
|
||||||
|
const QString &userName, const QString &commandFilePath);
|
||||||
static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list);
|
static QString remoteEnvironment(const QList<Utils::EnvironmentItem> &list);
|
||||||
static QString remoteSourceProfilesCommand();
|
static QString remoteSourceProfilesCommand();
|
||||||
static QString failedToConnectToServerMessage(const QSharedPointer<Utils::SshConnection> &connection,
|
static QString failedToConnectToServerMessage(const QSharedPointer<Utils::SshConnection> &connection,
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ void AbstractMaemoPackageInstaller::installPackage(const SshConnection::Ptr &con
|
|||||||
SLOT(handleInstallationFinished(int)));
|
SLOT(handleInstallationFinished(int)));
|
||||||
|
|
||||||
const QString space = QLatin1String(" ");
|
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
|
+ space + installCommandArguments().join(space) + space
|
||||||
+ packageFilePath;
|
+ packageFilePath;
|
||||||
if (removePackageFile) {
|
if (removePackageFile) {
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ void MaemoRemoteCopyFacility::copyNextFile()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString command = QString::fromLatin1("%1 cp -r %2 %3")
|
QString command = QString::fromLatin1("%1 cp -r %2 %3")
|
||||||
.arg(MaemoGlobal::remoteSudo(), sourceFilePath,
|
.arg(MaemoGlobal::remoteSudo(m_copyRunner->connection()->connectionParameters().userName),
|
||||||
d.remoteDir + QLatin1Char('/'));
|
sourceFilePath, d.remoteDir + QLatin1Char('/'));
|
||||||
emit progress(tr("Copying file '%1' to directory '%2' on the device...")
|
emit progress(tr("Copying file '%1' to directory '%2' on the device...")
|
||||||
.arg(d.localFilePath, d.remoteDir));
|
.arg(d.localFilePath, d.remoteDir));
|
||||||
m_copyRunner->run(command.toUtf8());
|
m_copyRunner->run(command.toUtf8());
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ void MaemoRemoteMounter::unmount()
|
|||||||
QString remoteCall;
|
QString remoteCall;
|
||||||
for (int i = 0; i < m_mountSpecs.count(); ++i) {
|
for (int i = 0; i < m_mountSpecs.count(); ++i) {
|
||||||
remoteCall += QString::fromLocal8Bit("%1 umount %2 && %1 rmdir %2;")
|
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);
|
m_mountSpecs.at(i).mountSpec.remoteMountPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,8 +183,9 @@ void MaemoRemoteMounter::stop()
|
|||||||
|
|
||||||
void MaemoRemoteMounter::startUtfsClients()
|
void MaemoRemoteMounter::startUtfsClients()
|
||||||
{
|
{
|
||||||
const QString chmodFuse
|
const QString userName = m_connection->connectionParameters().userName;
|
||||||
= MaemoGlobal::remoteSudo() + QLatin1String(" chmod a+r+w /dev/fuse");
|
const QString chmodFuse = MaemoGlobal::remoteSudo(userName)
|
||||||
|
+ QLatin1String(" chmod a+r+w /dev/fuse");
|
||||||
const QString chmodUtfsClient
|
const QString chmodUtfsClient
|
||||||
= QLatin1String("chmod a+x ") + utfsClientOnDevice();
|
= QLatin1String("chmod a+x ") + utfsClientOnDevice();
|
||||||
const QLatin1String andOp(" && ");
|
const QLatin1String andOp(" && ");
|
||||||
@@ -201,15 +202,15 @@ void MaemoRemoteMounter::startUtfsClients()
|
|||||||
|
|
||||||
const MaemoMountSpecification &mountSpec = mountInfo.mountSpec;
|
const MaemoMountSpecification &mountSpec = mountInfo.mountSpec;
|
||||||
const QString mkdir = QString::fromLocal8Bit("%1 mkdir -p %2")
|
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")
|
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 utfsClient
|
||||||
= QString::fromLocal8Bit("%1 -l %2 -r %2 -b %2 %4 -o nonempty")
|
= QString::fromLocal8Bit("%1 -l %2 -r %2 -b %2 %4 -o nonempty")
|
||||||
.arg(utfsClientOnDevice()).arg(mountInfo.remotePort)
|
.arg(utfsClientOnDevice()).arg(mountInfo.remotePort)
|
||||||
.arg(mountSpec.remoteMountPoint);
|
.arg(mountSpec.remoteMountPoint);
|
||||||
if (mountInfo.mountAsRoot)
|
if (mountInfo.mountAsRoot)
|
||||||
utfsClient.prepend(MaemoGlobal::remoteSudo() + QLatin1Char(' '));
|
utfsClient.prepend(MaemoGlobal::remoteSudo(userName) + QLatin1Char(' '));
|
||||||
QLatin1String seqOp("; ");
|
QLatin1String seqOp("; ");
|
||||||
remoteCall += seqOp + MaemoGlobal::remoteSourceProfilesCommand()
|
remoteCall += seqOp + MaemoGlobal::remoteSourceProfilesCommand()
|
||||||
+ seqOp + mkdir + andOp + chmod + andOp + utfsClient;
|
+ seqOp + mkdir + andOp + chmod + andOp + utfsClient;
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ void MaemoRunControl::startExecution()
|
|||||||
appendMessage(tr("Starting remote process ...\n"), NormalMessageFormat);
|
appendMessage(tr("Starting remote process ...\n"), NormalMessageFormat);
|
||||||
m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4")
|
m_runner->startExecution(QString::fromLocal8Bit("%1 %2 %3 %4")
|
||||||
.arg(MaemoGlobal::remoteCommandPrefix(m_runner->devConfig()->osVersion(),
|
.arg(MaemoGlobal::remoteCommandPrefix(m_runner->devConfig()->osVersion(),
|
||||||
|
m_runner->connection()->connectionParameters().userName,
|
||||||
m_runner->remoteExecutable()))
|
m_runner->remoteExecutable()))
|
||||||
.arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges()))
|
.arg(MaemoGlobal::remoteEnvironment(m_runner->userEnvChanges()))
|
||||||
.arg(m_runner->remoteExecutable())
|
.arg(m_runner->remoteExecutable())
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void MaemoUsedPortsGatherer::start(const Utils::SshConnection::Ptr &connection,
|
|||||||
SLOT(handleRemoteStdOut(QByteArray)));
|
SLOT(handleRemoteStdOut(QByteArray)));
|
||||||
connect(m_procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
|
connect(m_procRunner.data(), SIGNAL(processErrorOutputAvailable(QByteArray)),
|
||||||
SLOT(handleRemoteStdErr(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(" lsof -nPi4tcp:") + portList.toString()
|
||||||
+ QLatin1String(" -F n |grep '^n' |sed -r 's/[^:]*:([[:digit:]]+).*/\\1/g' |sort -n |uniq");
|
+ QLatin1String(" -F n |grep '^n' |sed -r 's/[^:]*:([[:digit:]]+).*/\\1/g' |sort -n |uniq");
|
||||||
m_procRunner->run(command.toUtf8());
|
m_procRunner->run(command.toUtf8());
|
||||||
|
|||||||
Reference in New Issue
Block a user