[gnome-continuous/wip/wayland: 1/2] testbase: Add some code to set an autologin session
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous/wip/wayland: 1/2] testbase: Add some code to set an autologin session
- Date: Thu, 24 Apr 2014 21:09:03 +0000 (UTC)
commit 3d167fba6f4e820770a083c0e32a860320eb16ee
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Apr 24 15:14:30 2014 -0400
testbase: Add some code to set an autologin session
src/js/libqa.js | 12 ++++++++++++
src/js/tasks/testbase.js | 3 +++
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/js/libqa.js b/src/js/libqa.js
index 97040c2..c2d43dd 100644
--- a/src/js/libqa.js
+++ b/src/js/libqa.js
@@ -248,6 +248,18 @@ function enableAutologin(currentDir, currentEtcDir, username, cancellable) {
gdmCustomPath.replace_contents(keyfile.to_data()[0], null, false,
Gio.FileCreateFlags.REPLACE_DESTINATION, cancellable);
}
+function setAutologinSession(currentDir, username, session, cancellable) {
+ let usersDir = currentDir.resolve_relative_path('var/lib/AccountsService/users');
+ GSystem.file_ensure_directory(usersDir, true, cancellable);
+ let userFile = usersDir.resolve_relative_path(username);
+ let userFileContents = '[User]\n\
+Language=\n\
+XSession=%s\n\
+SystemAccount=false\n';
+ userFileContents = Format.vprintf(userFileContents, [session]);
+ userFile.replace_contents(userFileContents, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION,
cancellable);
+}
+
function _findFirstFileMatching(dir, prefix, cancellable) {
let d = dir.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, cancellable);
let finfo;
diff --git a/src/js/tasks/testbase.js b/src/js/tasks/testbase.js
index 675b9d2..8dbfa35 100644
--- a/src/js/tasks/testbase.js
+++ b/src/js/tasks/testbase.js
@@ -453,6 +453,9 @@ const TestOneDisk = new Lang.Class({
LibQA.injectTestUserCreation(currentDir, currentEtcDir, username, {}, cancellable);
LibQA.enableAutologin(currentDir, currentEtcDir, username, cancellable);
+ if (this.GdmSession)
+ LibQA.setAutologinSession(currentDir, username, this.GdmSession, cancellable);
+
this._parentTask._prepareDisk(mntdir, this._diskArch, cancellable);
} finally {
gfmnt.umount(cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]