[PC-BSD Commits] r18862 - pcbsd-projects/PCDM
svn at pcbsd.org
svn at pcbsd.org
Wed Sep 5 11:50:33 PDT 2012
Author: kenmoore
Date: 2012-09-05 18:50:33 +0000 (Wed, 05 Sep 2012)
New Revision: 18862
Modified:
pcbsd-projects/PCDM/pcdm-backend.cpp
Log:
Finish up the DE startup process settings. It appears to work and be setup properly now.
Modified: pcbsd-projects/PCDM/pcdm-backend.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-backend.cpp 2012-09-05 17:42:53 UTC (rev 18861)
+++ pcbsd-projects/PCDM/pcdm-backend.cpp 2012-09-05 18:50:33 UTC (rev 18862)
@@ -90,30 +90,35 @@
}
//Use the saved information and clear it
QString username = saveUsername;
- QString cmd = "su -m "+username+" "+saveX; //change user keeping the current environment variables
+ QString cmd = "su "+username+" -c "+saveX; //switch user command to start the DE
saveUsername.clear();
saveX.clear();
// Get the user's home directory
QString homeDir = getUserHomeDir(username);
+ // Get the current locale code
+ QLocale mylocale;
+ QString langCode = mylocale.name();
// Create the external process
QProcess* p = new QProcess(0);
// Setup the process environment
QProcessEnvironment environ = QProcessEnvironment::systemEnvironment(); //current environment
Backend::log("System Environment: " + environ.toStringList().join(" ") );
// Setup any specialized environment variables
- //environ.insert("LOGNAME",username); //Login name
- //environ.insert("USERNAME",username); //
- //environ.insert("USER",username); //Set the user properly
- //environ.insert("HOME",homeDir); // set the proper home directory
- //environ.insert("PATH",environ.value("PATH")+":"+homeDir+"/bin"); // Append the user's home dir to the path
+ // USER, HOME, and SHELL are set by the "su" login
+ environ.insert("LOGNAME",username); //Login name
+ environ.insert("USERNAME",username); // Username
+ environ.insert("PWD",homeDir); //set the current directory to the user's home directory
+ environ.insert("PATH",environ.value("PATH")+":"+homeDir+"/bin"); // Append the user's home dir to the path
+ environ.insert("LANG",langCode+"."+environ.value("MM_CHARSET")); //Set the proper localized language
+ environ.insert("MAIL","/var/mail/"+username); //Set the mail variable
+ environ.insert("GROUP",username); //Set the proper group id
p->setProcessEnvironment(environ);
// Startup the process
- Backend::log("Modified Environment: " + environ.toStringList().join(" ") );
- Backend::log("Debug Mode: not starting DE");
p->start(cmd);
// Wait for the process to start before continuing
p->waitForStarted();
+ Backend::log("Startup Environment: " + p->processEnvironment().toStringList().join(" ") );
// Now Wait for the process to finish
p->waitForFinished(-1); //do not time-out
}
More information about the Commits
mailing list