Maemo: source all relevant profiles and ignore non-existing ones.

Reviewed-by: kh1
This commit is contained in:
Christian Kandeler
2010-09-13 16:50:30 +02:00
parent 8194d2287d
commit 947f0f3a30
4 changed files with 18 additions and 5 deletions

View File

@@ -34,6 +34,7 @@
#include "maemodeviceenvreader.h" #include "maemodeviceenvreader.h"
#include "maemoglobal.h"
#include "maemorunconfiguration.h" #include "maemorunconfiguration.h"
#include <coreplugin/ssh/sshconnection.h> #include <coreplugin/ssh/sshconnection.h>
@@ -101,8 +102,7 @@ void MaemoDeviceEnvReader::executeRemoteCall()
if (m_stop) if (m_stop)
return; return;
const QByteArray remoteCall("test -f /etc/profile && source /etc/profile; " const QByteArray remoteCall = MaemoGlobal::remoteSourceProfilesCommand().toUtf8() + "; env";
"test -f ~/.profile && source ~/.profile; env");
m_remoteProcess = m_connection->createRemoteProcess(remoteCall); m_remoteProcess = m_connection->createRemoteProcess(remoteCall);
connect(m_remoteProcess.data(), SIGNAL(closed(int)), this, connect(m_remoteProcess.data(), SIGNAL(closed(int)), this,

View File

@@ -48,8 +48,18 @@ QString MaemoGlobal::remoteSudo()
QString MaemoGlobal::remoteCommandPrefix(const QString &commandFilePath) QString MaemoGlobal::remoteCommandPrefix(const QString &commandFilePath)
{ {
return QString::fromLocal8Bit("%1 chmod a+x %2 && source /etc/profile; " return QString::fromLocal8Bit("%1 chmod a+x %2; %3; ")
"source /home/user/.profile; ").arg(remoteSudo(), commandFilePath); .arg(remoteSudo(), commandFilePath, remoteSourceProfilesCommand());
}
QString MaemoGlobal::remoteSourceProfilesCommand()
{
const QList<QByteArray> profiles = QList<QByteArray>() << "/etc/profile"
<< "/home/user/.profile" << "~/.profile";
QByteArray remoteCall(":");
foreach (const QByteArray &profile, profiles)
remoteCall += "; test -f " + profile + " && source " + profile;
return QString::fromAscii(remoteCall);
} }
QString MaemoGlobal::remoteEnvironment(const QList<ProjectExplorer::EnvironmentItem> &list) QString MaemoGlobal::remoteEnvironment(const QList<ProjectExplorer::EnvironmentItem> &list)

View File

@@ -52,6 +52,7 @@ public:
static QString remoteCommandPrefix(const QString &commandFilePath); static QString remoteCommandPrefix(const QString &commandFilePath);
static QString remoteEnvironment(const QList<ProjectExplorer::EnvironmentItem> &list); static QString remoteEnvironment(const QList<ProjectExplorer::EnvironmentItem> &list);
static QString remoteProjectSourcesMountPoint(); static QString remoteProjectSourcesMountPoint();
static QString remoteSourceProfilesCommand();
template<class T> static T *buildStep(const ProjectExplorer::DeployConfiguration *dc) template<class T> static T *buildStep(const ProjectExplorer::DeployConfiguration *dc)
{ {

View File

@@ -240,7 +240,9 @@ void MaemoRemoteMounter::startUtfsClients()
.arg(mountSpec.remoteMountPoint); .arg(mountSpec.remoteMountPoint);
if (mountInfo.mountAsRoot) if (mountInfo.mountAsRoot)
utfsClient.prepend(MaemoGlobal::remoteSudo() + QLatin1Char(' ')); utfsClient.prepend(MaemoGlobal::remoteSudo() + QLatin1Char(' '));
remoteCall += andOp + mkdir + andOp + chmod + andOp + utfsClient; QLatin1String seqOp("; ");
remoteCall += seqOp + MaemoGlobal::remoteSourceProfilesCommand()
+ seqOp + mkdir + andOp + chmod + andOp + utfsClient;
} }
emit reportProgress(tr("Starting remote UTFS clients...")); emit reportProgress(tr("Starting remote UTFS clients..."));