diff options
author | BlackNoxis <steven.darklight@gmail.com> | 2014-02-15 23:46:38 +0200 |
---|---|---|
committer | BlackNoxis <steven.darklight@gmail.com> | 2014-02-15 23:46:38 +0200 |
commit | 539ab2c329ef87cb855c5965a4e3995af9b1cad3 (patch) | |
tree | eb48abd2bb1152d7a5a6e8e048d20f76b0057c9e /gnome-base/gdm/files | |
parent | bf9f773fb3fcefed199cd8af38b65f77b347c80c (diff) |
Added gnome already splitted ebuilds. will split later if needed to improve deps heaven
Diffstat (limited to 'gnome-base/gdm/files')
11 files changed, 586 insertions, 0 deletions
diff --git a/gnome-base/gdm/files/49-keychain-r1 b/gnome-base/gdm/files/49-keychain-r1 new file mode 100644 index 00000000..51a1ca87 --- /dev/null +++ b/gnome-base/gdm/files/49-keychain-r1 @@ -0,0 +1,9 @@ +#!/bin/bash + +# source keychain variables + +keychain="`which keychain 2>/dev/null`" +if [ -n "$keychain" ] && [ -x "$keychain" ] && [ -f "$HOME/.bash_profile" ] +then + . "${HOME}/.bash_profile" +fi diff --git a/gnome-base/gdm/files/50-ssh-agent-r1 b/gnome-base/gdm/files/50-ssh-agent-r1 new file mode 100644 index 00000000..4d94fb04 --- /dev/null +++ b/gnome-base/gdm/files/50-ssh-agent-r1 @@ -0,0 +1,10 @@ +#!/bin/sh + +# add ssh-agent if found + +sshagent="`which ssh-agent 2>/dev/null`" +if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then + command="$sshagent -- $command" +elif [ -z "$sshagent" ] ; then + echo "$0: ssh-agent not found!" +fi diff --git a/gnome-base/gdm/files/gdm-2.32.0-xinitrc-ssh-agent.patch b/gnome-base/gdm/files/gdm-2.32.0-xinitrc-ssh-agent.patch new file mode 100644 index 00000000..b1cddf17 --- /dev/null +++ b/gnome-base/gdm/files/gdm-2.32.0-xinitrc-ssh-agent.patch @@ -0,0 +1,32 @@ +From 1cb1841da3a8fedc1671637e2828d5e361af21fa Mon Sep 17 00:00:00 2001 +From: Gilles Dartiguelongue <eva@gentoo.org> +Date: Tue, 2 Nov 2010 23:19:31 +0100 +Subject: [PATCH 5/6] ssh-agent handling must be done at xinitrc.d + +Gentoo bug: #220603 +--- + data/Xsession.in | 8 -------- + 1 files changed, 0 insertions(+), 8 deletions(-) + +diff --git a/data/Xsession.in b/data/Xsession.in +index 0da187d..aa49b90 100755 +--- a/data/Xsession.in ++++ b/data/Xsession.in +@@ -189,14 +189,6 @@ if [ -d /etc/X11/xinit/xinitrc.d ]; then + done + fi + +-# add ssh-agent if found +-sshagent="`gdmwhich ssh-agent`" +-if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then +- command="$sshagent -- $command" +-elif [ -z "$sshagent" ] ; then +- echo "$0: ssh-agent not found!" +-fi +- + echo "$0: Setup done, will execute: $command" + + eval exec $command +-- +1.7.3.1 + diff --git a/gnome-base/gdm/files/gdm-3.10.0.1-fix-systemd-unit-if-plymouth-disabled.patch b/gnome-base/gdm/files/gdm-3.10.0.1-fix-systemd-unit-if-plymouth-disabled.patch new file mode 100644 index 00000000..3fea17be --- /dev/null +++ b/gnome-base/gdm/files/gdm-3.10.0.1-fix-systemd-unit-if-plymouth-disabled.patch @@ -0,0 +1,12 @@ +--- a/data/gdm.service.in ++++ b/data/gdm.service.in +@@ -1,7 +1,7 @@ + [Unit] + Description=GNOME Display Manager +-Conflicts=getty@tty@GDM_INITIAL_VT@.service plymouth-quit.service +-After=systemd-user-sessions.service getty@tty@GDM_INITIAL_VT@.service plymouth-quit.service ++Conflicts=getty@tty@GDM_INITIAL_VT@.service ++After=systemd-user-sessions.service getty@tty@GDM_INITIAL_VT@.service plymouth-quit.service plymouth-quit-wait.service + + [Service] + ExecStart=@sbindir@/gdm diff --git a/gnome-base/gdm/files/gdm-3.2.1.1-custom-session.patch b/gnome-base/gdm/files/gdm-3.2.1.1-custom-session.patch new file mode 100644 index 00000000..0642f7c0 --- /dev/null +++ b/gnome-base/gdm/files/gdm-3.2.1.1-custom-session.patch @@ -0,0 +1,51 @@ +From b96c19976b6876648fd91949f78f06cf5d269b18 Mon Sep 17 00:00:00 2001 +From: Gilles Dartiguelongue <eva@gentoo.org> +Date: Tue, 2 Nov 2010 23:19:07 +0100 +Subject: [PATCH] make custom session work + +Gentoo bug: #216984 + +fix custom sessions not doing sourcing in the proper order. +--- + data/Xsession.in | 18 +++++++++--------- + 1 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/data/Xsession.in b/data/Xsession.in +index 118518c..201be92 100755 +--- a/data/Xsession.in ++++ b/data/Xsession.in +@@ -155,15 +155,6 @@ fi + + xhost +si:localuser:`id -un` || : + +-# run all system xinitrc shell scripts. +-if [ -d /etc/X11/xinit/xinitrc.d ]; then +- for i in /etc/X11/xinit/xinitrc.d/* ; do +- if [ -x "$i" -a ! -d "$i" ]; then +- . "$i" +- fi +- done +-fi +- + if [ "x$command" = "xcustom" ] ; then + if [ -x "$HOME/.xsession" ]; then + command="$HOME/.xsession" +@@ -191,6 +182,15 @@ if [ "x$command" = "xdefault" ] ; then + fi + fi + ++# run all system xinitrc shell scripts. ++if [ -d /etc/X11/xinit/xinitrc.d ]; then ++ for i in /etc/X11/xinit/xinitrc.d/* ; do ++ if [ -x "$i" -a ! -d "$i" ]; then ++ . "$i" ++ fi ++ done ++fi ++ + # add ssh-agent if found + sshagent="`gdmwhich ssh-agent`" + if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then +-- +1.7.7 + diff --git a/gnome-base/gdm/files/gdm-3.6.0-fix-daemonize-regression.patch b/gnome-base/gdm/files/gdm-3.6.0-fix-daemonize-regression.patch new file mode 100644 index 00000000..27f20797 --- /dev/null +++ b/gnome-base/gdm/files/gdm-3.6.0-fix-daemonize-regression.patch @@ -0,0 +1,192 @@ +From 722d31dc8823090b651b103f0194b6380f2d458e Mon Sep 17 00:00:00 2001 +From: Alexandre Rostovtsev <tetromino@gentoo.org> +Date: Tue, 25 Sep 2012 22:30:29 -0400 +Subject: [PATCH] daemonize so that the boot process can continue + +Gentoo bug: #236701 + +Based on original patch by Dan Nicholson <dbn.lists@gmail.com> and +Gilles Dartiguelongue <eva@gentoo.org>. + +Fork gdm-binary, except when -nodaemon is used + +Makes the gdm main binary fork and daemonize unless the -nodaemon or +--nodaemon options are used. Provides compatibility with xdm. Fixes +bug #550170. + +In daemonized mode, start a new process group, and kill it in our signal +handlers, so that killing gdm kills its spawned processes, and so that +"/etc/init.d/xdm stop" actually works. +--- + configure.ac | 4 ++++ + daemon/Makefile.am | 1 + + daemon/main.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 65 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 61a43d6..a851ba5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -99,6 +99,10 @@ PKG_CHECK_MODULES(DAEMON, + AC_SUBST(DAEMON_CFLAGS) + AC_SUBST(DAEMON_LIBS) + ++PKG_CHECK_MODULES(LIBDAEMON, libdaemon) ++AC_SUBST(LIBDAEMON_CFLAGS) ++AC_SUBST(LIBDAEMON_LIBS) ++ + GLIB_GSETTINGS + + PKG_CHECK_MODULES(NSS, +diff --git a/daemon/Makefile.am b/daemon/Makefile.am +index bb84765..cf89b47 100644 +--- a/daemon/Makefile.am ++++ b/daemon/Makefile.am +@@ -380,6 +380,7 @@ gdm_binary_LDADD = \ + $(top_builddir)/common/libgdmcommon.la \ + $(XLIB_LIBS) \ + $(DAEMON_LIBS) \ ++ $(LIBDAEMON_LIBS) \ + $(XDMCP_LIBS) \ + $(LIBWRAP_LIBS) \ + $(SYSTEMD_LIBS) \ +diff --git a/daemon/main.c b/daemon/main.c +index 3b8572c..c2fe4fe 100644 +--- a/daemon/main.c ++++ b/daemon/main.c +@@ -34,6 +34,8 @@ + #include <locale.h> + #include <signal.h> + ++#include <libdaemon/dfork.h> ++ + #include <glib.h> + #include <glib/gi18n.h> + #include <glib/gstdio.h> +@@ -336,16 +338,26 @@ signal_cb (int signo, + gpointer data) + { + int ret; ++ static gboolean ignore_signals = FALSE; + + g_debug ("Got callback for signal %d", signo); + + ret = TRUE; + ++ /* don't commit suicide before killing everyone in our process group */ ++ if (ignore_signals) ++ return ret; ++ + switch (signo) { + case SIGFPE: + case SIGPIPE: + /* let the fatal signals interrupt us */ + g_debug ("Caught signal %d, shutting down abnormally.", signo); ++ /* if we daemonized, kill all the processes we spawned */ ++ ignore_signals = TRUE; ++ kill (-getpid (), signo); ++ ignore_signals = FALSE; ++ + ret = FALSE; + + break; +@@ -354,6 +366,11 @@ signal_cb (int signo, + case SIGTERM: + /* let the fatal signals interrupt us */ + g_debug ("Caught signal %d, shutting down normally.", signo); ++ /* if we daemonized, kill all the processes we spawned */ ++ ignore_signals = TRUE; ++ kill (-getpid (), signo); ++ ignore_signals = FALSE; ++ + ret = FALSE; + + break; +@@ -418,13 +435,16 @@ main (int argc, + GOptionContext *context; + GError *error; + int ret; ++ int i; + gboolean res; + GdmSignalHandler *signal_handler; + static gboolean do_timed_exit = FALSE; + static gboolean print_version = FALSE; + static gboolean fatal_warnings = FALSE; ++ static gboolean no_daemon = FALSE; + static GOptionEntry entries [] = { + { "fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &fatal_warnings, N_("Make all warnings fatal"), NULL }, ++ { "nodaemon", 0, 0, G_OPTION_ARG_NONE, &no_daemon, N_("Do not fork into the background"), NULL }, + { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &print_version, N_("Print GDM version"), NULL }, + +@@ -439,6 +459,14 @@ main (int argc, + + g_type_init (); + ++ /* preprocess the arguments to support the xdm style ++ * -nodaemon option ++ */ ++ for (i = 0; i < argc; i++) { ++ if (strcmp (argv[i], "-nodaemon") == 0) ++ argv[i] = "--nodaemon"; ++ } ++ + context = g_option_context_new (_("GNOME Display Manager")); + g_option_context_add_main_entries (context, entries, NULL); + g_option_context_set_ignore_unknown_options (context, TRUE); +@@ -465,6 +493,33 @@ main (int argc, + g_log_set_always_fatal (fatal_mask); + } + ++ if (!no_daemon) { ++ pid_t pid; ++ if (daemon_retval_init () < 0) { ++ g_warning ("Failed to create pipe"); ++ exit (-1); ++ } ++ if ((pid = daemon_fork ()) < 0) { ++ /* Fork failed */ ++ daemon_retval_done (); ++ exit (1); ++ } else if (pid) { ++ /* Parent process: wait 20s for daemon_retval_send() in the daemon process */ ++ if ((ret = daemon_retval_wait (20)) < 0) { ++ g_warning ("Timed out waiting for daemon process: %s", strerror(errno)); ++ exit (255); ++ } else if (ret > 0) { ++ g_warning ("Daemon process returned error code %d", ret); ++ exit (ret); ++ } ++ exit (0); ++ } ++ /* Daemon process */ ++ daemon_close_all (-1); ++ /* Start a new process group so that killing the daemon will kill the processes that it spawned */ ++ setsid (); ++ } ++ + gdm_log_init (); + + settings = gdm_settings_new (); +@@ -519,6 +574,9 @@ main (int argc, + g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, main_loop); + } + ++ if (!no_daemon) ++ daemon_retval_send (0); ++ + g_main_loop_run (main_loop); + + g_debug ("GDM finished, cleaning up..."); +@@ -535,6 +593,8 @@ main (int argc, + ret = 0; + + out: ++ if (!no_daemon) ++ daemon_retval_send (ret); + + return ret; + } +-- +1.7.12 + diff --git a/gnome-base/gdm/files/gdm-3.6.0-selinux-automagic.patch b/gnome-base/gdm/files/gdm-3.6.0-selinux-automagic.patch new file mode 100644 index 00000000..035d0fa4 --- /dev/null +++ b/gnome-base/gdm/files/gdm-3.6.0-selinux-automagic.patch @@ -0,0 +1,31 @@ +From 8f9bf7b053fc7a6c2e5b33fc43c168ba7250cb98 Mon Sep 17 00:00:00 2001 +From: Alexandre Rostovtsev <tetromino@gentoo.org> +Date: Tue, 25 Sep 2012 17:38:37 -0400 +Subject: [PATCH] configure: Make selinux check non-automagic + +--- + configure.ac | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 80a1fd4..61a43d6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -142,9 +142,13 @@ AC_SUBST(UPOWER) + AC_SUBST(UPOWER_CFLAGS) + AC_SUBST(UPOWER_LIBS) + ++AC_ARG_WITH(selinux, ++ AS_HELP_STRING([--with-selinux], ++ [Add SELinux support])) ++ + PKG_CHECK_MODULES(LIBSELINUX, libselinux, have_selinux=yes, have_selinux=no) + +-if test "x$have_selinux" = "xyes" ; then ++if test "x$have_selinux" = "xyes" && test "x$with_selinux" != "xno" ; then + AC_DEFINE(HAVE_SELINUX, 1, [Define if have selinux]) + fi + AC_SUBST(LIBSELINUX_CFLAGS) +-- +1.7.12 + diff --git a/gnome-base/gdm/files/gdm-3.7.3.1-disable-accessibility.patch b/gnome-base/gdm/files/gdm-3.7.3.1-disable-accessibility.patch new file mode 100755 index 00000000..bf684640 --- /dev/null +++ b/gnome-base/gdm/files/gdm-3.7.3.1-disable-accessibility.patch @@ -0,0 +1,34 @@ +From 07fb1b31d818f308beb1c3800c4b90830b57d01b Mon Sep 17 00:00:00 2001 +From: Sobhan Mohammadpour <sobhanmohammadpour1@yahoo.fr> +Date: Fri, 25 Jan 2013 10:03:31 +0330 +Subject: [PATCH] don't load accessbility + +--- + data/00-upstream-settings | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/data/00-upstream-settings b/data/00-upstream-settings +index 660a295..3993786 100644 +--- a/data/00-upstream-settings ++++ b/data/00-upstream-settings +@@ -7,7 +7,7 @@ + # + + [org/gnome/desktop/a11y/keyboard] +-enable=true ++enable=false + + [org/gnome/desktop/background] + show-desktop-icons=false +@@ -16,7 +16,7 @@ show-desktop-icons=false + exec='/bin/true' + + [org/gnome/desktop/interface] +-toolkit-accessibility=true ++toolkit-accessibility=false + + [org/gnome/desktop/lockdown] + disable-application-handlers=true +-- +1.8.1 + diff --git a/gnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch b/gnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch new file mode 100755 index 00000000..810bd6e8 --- /dev/null +++ b/gnome-base/gdm/files/gdm-3.7.90-fix-daemonize-regression.patch @@ -0,0 +1,134 @@ +From bda248c1e184f92aedf9f8d932ebd20746910d52 Mon Sep 17 00:00:00 2001 +From: Sobhan Mohammadpour <sobhanmohammadpour1@yahoo.fr> +Date: Mon, 4 Mar 2013 21:23:45 +0330 +Subject: [PATCH] gdm-3.7.90 fix daemonize regression + +--- + configure.ac | 4 ++++ + daemon/Makefile.am | 1 + + daemon/main.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 50 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 0918060..d4ea271 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -99,6 +99,10 @@ PKG_CHECK_MODULES(DAEMON, + AC_SUBST(DAEMON_CFLAGS) + AC_SUBST(DAEMON_LIBS) + ++PKG_CHECK_MODULES(LIBDAEMON, libdaemon) ++AC_SUBST(LIBDAEMON_CFLAGS) ++AC_SUBST(LIBDAEMON_LIBS) ++ + GLIB_GSETTINGS + + PKG_CHECK_MODULES(NSS, +diff --git a/daemon/Makefile.am b/daemon/Makefile.am +index ead9096..b810089 100644 +--- a/daemon/Makefile.am ++++ b/daemon/Makefile.am +@@ -385,6 +385,7 @@ gdm_LDADD = \ + $(top_builddir)/common/libgdmcommon.la \ + $(XLIB_LIBS) \ + $(DAEMON_LIBS) \ ++ $(LIBDAEMON_LIBS) \ + $(XDMCP_LIBS) \ + $(LIBWRAP_LIBS) \ + $(SYSTEMD_LIBS) \ +diff --git a/daemon/main.c b/daemon/main.c +index 8176fe3..0151862 100644 +--- a/daemon/main.c ++++ b/daemon/main.c +@@ -34,6 +34,8 @@ + #include <locale.h> + #include <signal.h> + ++#include <libdaemon/dfork.h> ++ + #include <glib.h> + #include <glib/gi18n.h> + #include <glib/gstdio.h> +@@ -329,8 +331,10 @@ main (int argc, + static gboolean do_timed_exit = FALSE; + static gboolean print_version = FALSE; + static gboolean fatal_warnings = FALSE; ++ static gboolean no_daemon = FALSE; + static GOptionEntry entries [] = { + { "fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &fatal_warnings, N_("Make all warnings fatal"), NULL }, ++ { "nodaemon", 0, 0, G_OPTION_ARG_NONE, &no_daemon, N_("Do not fork into the background"), NULL }, + { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)"), NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &print_version, N_("Print GDM version"), NULL }, + +@@ -343,6 +347,15 @@ main (int argc, + + ret = 1; + ++ /* preprocess the arguments to support the xdm style ++ * -nodaemon option ++ */ ++ int i; ++ for ( i = 0; i < argc; i++) { ++ if (strcmp (argv[i], "-nodaemon") == 0) ++ argv[i] = "--nodaemon"; ++ } ++ + context = g_option_context_new (_("GNOME Display Manager")); + g_option_context_add_main_entries (context, entries, NULL); + g_option_context_set_ignore_unknown_options (context, TRUE); +@@ -369,6 +382,33 @@ main (int argc, + g_log_set_always_fatal (fatal_mask); + } + ++ if (!no_daemon) { ++ pid_t pid; ++ if (daemon_retval_init () < 0) { ++ g_warning ("Failed to create pipe"); ++ exit (-1); ++ } ++ if ((pid = daemon_fork ()) < 0) { ++ /* Fork failed */ ++ daemon_retval_done (); ++ exit (1); ++ } else if (pid) { ++ /* Parent process: wait 20s for daemon_retval_send() in the daemon process */ ++ if ((ret = daemon_retval_wait (20)) < 0) { ++ g_warning ("Timed out waiting for daemon process: %s", strerror(errno)); ++ exit (255); ++ } else if (ret > 0) { ++ g_warning ("Daemon process returned error code %d", ret); ++ exit (ret); ++ } ++ exit (0); ++ } ++ /* Daemon process */ ++ daemon_close_all (-1); ++ /* Start a new process group so that killing the daemon will kill the processes that it spawned */ ++ setsid (); ++ } ++ + gdm_log_init (); + + settings = gdm_settings_new (); +@@ -418,6 +458,9 @@ main (int argc, + g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, main_loop); + } + ++ if (!no_daemon) ++ daemon_retval_send (0); ++ + g_main_loop_run (main_loop); + + g_debug ("GDM finished, cleaning up..."); +@@ -433,6 +476,8 @@ main (int argc, + ret = 0; + + out: ++ if (!no_daemon) ++ daemon_retval_send (ret); + if (error) { + g_printerr ("%s\n", error->message); + g_clear_error (&error); +-- +1.8.1.2 + diff --git a/gnome-base/gdm/files/gdm-3.8.4-fingerprint-auth.patch b/gnome-base/gdm/files/gdm-3.8.4-fingerprint-auth.patch new file mode 100644 index 00000000..3b56daf2 --- /dev/null +++ b/gnome-base/gdm/files/gdm-3.8.4-fingerprint-auth.patch @@ -0,0 +1,29 @@ +From 6139570c977561549747d5200b33be9786e95529 Mon Sep 17 00:00:00 2001 +From: Alexandre Rostovtsev <tetromino@gentoo.org> +Date: Tue, 30 Jul 2013 22:56:30 -0400 +Subject: [PATCH] Gentoo does not have a fingerprint-auth pam stack + +--- + data/pam-exherbo/gdm-fingerprint.pam | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/data/pam-exherbo/gdm-fingerprint.pam b/data/pam-exherbo/gdm-fingerprint.pam +index 41639ec..d9633fb 100644 +--- a/data/pam-exherbo/gdm-fingerprint.pam ++++ b/data/pam-exherbo/gdm-fingerprint.pam +@@ -1,6 +1,11 @@ + account include system-login + +-auth substack fingerprint-auth ++auth optional pam_env.so ++auth required pam_tally2.so onerr=succeed ++auth required pam_shells.so ++auth required pam_nologin.so ++auth required pam_fprintd.so ++auth required pam_permit.so + auth optional pam_gnome_keyring.so + + password required pam_deny.so +-- +1.8.3.2 + diff --git a/gnome-base/gdm/files/gdm-set-session b/gnome-base/gdm/files/gdm-set-session new file mode 100755 index 00000000..491b9a67 --- /dev/null +++ b/gnome-base/gdm/files/gdm-set-session @@ -0,0 +1,52 @@ +#!/usr/bin/python +"""Simple script that updates the default session in AccountServices""" + +import sys +import time + +from gi.repository import GLib as glib + +import dbus +from dbus.mainloop.glib import DBusGMainLoop + +ACCOUNTS_DBUS_NAME = "org.freedesktop.Accounts" +ACCOUNTS_DBUS_PATH = "/org/freedesktop/Accounts" +ACCOUNTS_USER_DBUS_NAME = "org.freedesktop.Accounts.User" + +if __name__ == "__main__": + + try: + username = sys.argv[1] + session = sys.argv[2] + except IndexError: + sys.stderr.write("%s <username> <default session>\n") + raise SystemExit(1) + + dbus_loop = DBusGMainLoop(set_as_default = True) + loop = glib.MainLoop() + glib.threads_init() + + def setup(): + try: + system_bus = dbus.SystemBus(mainloop=dbus_loop) + dbus_object = system_bus.get_object( + ACCOUNTS_DBUS_NAME, ACCOUNTS_DBUS_PATH) + + iface = dbus.Interface( + dbus_object, dbus_interface=ACCOUNTS_DBUS_NAME) + + user_path = iface.FindUserByName(username) + + dbus_object = system_bus.get_object( + ACCOUNTS_DBUS_NAME, user_path) + + iface_usr = dbus.Interface( + dbus_object, dbus_interface=ACCOUNTS_USER_DBUS_NAME) + + iface_usr.SetXSession(session) + + finally: + loop.quit() + + glib.timeout_add(0, setup) + loop.run() |