summaryrefslogtreecommitdiff
path: root/community/lightdm
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-08-13 01:33:19 -0700
committerroot <root@rshg054.dnsready.net>2013-08-13 01:33:19 -0700
commit7a65a910b77ad191d69881098c47f9b0c852d92e (patch)
tree9564e611af1442f8952a8cbddb3b0ad25ed71aab /community/lightdm
parent60da6abff6c9577a783d72865f11de7a585e912e (diff)
Tue Aug 13 01:31:08 PDT 2013
Diffstat (limited to 'community/lightdm')
-rwxr-xr-xcommunity/lightdm/PKGBUILD121
-rwxr-xr-xcommunity/lightdm/lightdm-autologin.pam13
-rwxr-xr-xcommunity/lightdm/lightdm-default-config.patch43
-rwxr-xr-xcommunity/lightdm/lightdm-lock-screen-before-switch.patch55
-rwxr-xr-xcommunity/lightdm/lightdm-use-login1.patch514
-rwxr-xr-xcommunity/lightdm/lightdm.install18
-rwxr-xr-xcommunity/lightdm/lightdm.pam7
-rwxr-xr-xcommunity/lightdm/lightdm.rules15
-rwxr-xr-xcommunity/lightdm/lightdm.service14
-rwxr-xr-xcommunity/lightdm/lightdm.tmpfiles1
-rwxr-xr-xcommunity/lightdm/xsession73
11 files changed, 874 insertions, 0 deletions
diff --git a/community/lightdm/PKGBUILD b/community/lightdm/PKGBUILD
new file mode 100755
index 000000000..e86a8fccd
--- /dev/null
+++ b/community/lightdm/PKGBUILD
@@ -0,0 +1,121 @@
+# $Id: PKGBUILD 92709 2013-06-13 08:52:31Z alucryd $
+# Maintainer: Maxime Gauduin <alucryd@gmail.com>
+# Contributor: Morfeo <morfeo89@hotmail.it>
+
+pkgbase=lightdm
+pkgname=('lightdm' 'liblightdm-qt4' 'liblightdm-qt5')
+pkgver=1.6.0
+pkgrel=5
+epoch=1
+pkgdesc="A lightweight display manager"
+arch=('i686' 'x86_64')
+url="https://launchpad.net/lightdm"
+license=('GPL3' 'LGPL3')
+groups=('lightdm')
+makedepends=('gobject-introspection' 'gtk-doc' 'intltool' 'itstool' 'libxklavier' 'qt4' 'qt5-base' 'yelp-tools')
+options=('!emptydirs' '!libtool')
+source=("https://launchpad.net/lightdm/1.6/${pkgver}/+download/${pkgbase}-${pkgver}.tar.xz"
+ 'lightdm.service'
+ 'lightdm.tmpfiles'
+ 'lightdm.pam'
+ 'lightdm-autologin.pam'
+ 'lightdm.rules'
+ 'lightdm-default-config.patch'
+ 'lightdm-lock-screen-before-switch.patch'
+ 'lightdm-use-login1.patch'
+ 'xsession')
+sha256sums=('882ece568df0d81c0b6e399ff00b3f89eee6d50efc09ad1c52c61d8753efb419'
+ '3daf2f7e1b751415eab9b2aa92d78d8e00c3447a77fa31f7e75863136286a86f'
+ 'b29521fbd7a48a8f60b93ecca3b30c30bcb71560de8033c8d39b25c22c6f696f'
+ 'e8c4c5fd3b801a390d201166fd1fb9730e78a5c62928768103b870b6bd980ea0'
+ '33e3c3d6e16c8d30756754ea3f31f5457c5be0343686aad287692be34958984a'
+ 'a89566307e1c81c24f037d854cbd472d2f94f8a4b759877a01563a332319f7d6'
+ '6d5a754f41e9c7e52c51d2ff018b926ddaabb807e9a0b88c4a7bde1acffa3b1c'
+ '4793eaee5915f5c519f569a4cd9158822d4c57c8b6e405895d2eddf82fa00822'
+ '3247aa1e5e7c2c2f8653cfbb22e1f74252c556b6159ff4ec47c1c7d5ea6883ac'
+ '7fb85a1b54406032a922e8fd6f45d869fcfe5681df630e74e8e50c040b786ee4')
+
+prepare() {
+ cd "${srcdir}"/${pkgbase}-${pkgver}
+
+ patch -Np1 -i ../lightdm-default-config.patch
+ patch -Np1 -i ../lightdm-lock-screen-before-switch.patch
+ patch -Np0 -i ../lightdm-use-login1.patch
+ sed -i 's/MOC5 --qt=qt5/MOC5/' configure
+}
+
+build() {
+ cd "${srcdir}"/${pkgbase}-${pkgver}
+
+ ./configure --prefix=/usr --sbindir=/usr/bin --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib/${pkgbase} --with-greeter-user=lightdm --with-greeter-session=lightdm-gtk-greeter --disable-{static,tests}
+ make
+}
+
+package_lightdm() {
+depends=('libxklavier' 'systemd')
+optdepends=('xorg-server-xephyr: LightDM test mode'
+ 'accountsservice: limit visible accounts')
+backup=('etc/apparmor.d/lightdm-guest-session'
+ 'etc/lightdm/keys.conf'
+ 'etc/lightdm/lightdm.conf'
+ 'etc/lightdm/users.conf')
+install=${pkgbase}.install
+
+ cd "${srcdir}"/${pkgbase}-${pkgver}
+
+ make DESTDIR="${pkgdir}" install
+ make DESTDIR="${pkgdir}" -C liblightdm-qt uninstall
+ rm -rf "${pkgdir}"/etc/init
+
+# Persistent home
+ install -dm 770 "${pkgdir}"/var/lib/lightdm
+ chmod +t "${pkgdir}"/var/lib/lightdm
+ echo 'GDK_CORE_DEVICE_EVENTS=true' > "${pkgdir}"/var/lib/lightdm/.pam_environment
+ chmod 644 "${pkgdir}"/var/lib/lightdm/.pam_environment
+
+# Session wrapper
+ install -m 755 ../xsession "${pkgdir}"/etc/lightdm/xsession
+
+# PAM
+ install -m 644 ../lightdm.pam "${pkgdir}"/etc/pam.d/lightdm
+ install -m 644 ../lightdm-autologin.pam "${pkgdir}"/etc/pam.d/lightdm-autologin
+
+# PolicyKit
+ install -dm 700 "${pkgdir}"/usr/share/polkit-1/rules.d
+ install -m 644 ../lightdm.rules "${pkgdir}"/usr/share/polkit-1/rules.d/lightdm.rules
+
+# Systemd
+ install -dm 755 "${pkgdir}"/usr/lib/{systemd/system,tmpfiles.d}
+ install -m 644 ../lightdm.service "${pkgdir}"/usr/lib/systemd/system/lightdm.service
+ install -m 644 ../lightdm.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/lightdm.conf
+}
+
+package_liblightdm-qt4() {
+pkgdesc=('LightDM Qt client library')
+depends=('lightdm' 'qt4')
+
+ cd "${srcdir}"/${pkgbase}-${pkgver}
+
+ make DESTDIR="${pkgdir}" -C liblightdm-gobject install
+ make DESTDIR="${pkgdir}" -C liblightdm-qt install
+ make DESTDIR="${pkgdir}" -C liblightdm-gobject uninstall
+ find "${pkgdir}" -type d -name *qt5* -exec rm -rf {} +
+ find "${pkgdir}" -type f -name *qt5* -exec rm {} +
+ find "${pkgdir}" -type l -name *qt5* -exec rm {} +
+}
+
+package_liblightdm-qt5() {
+pkgdesc=('LightDM Qt client library')
+depends=('lightdm' 'qt5-base')
+
+ cd "${srcdir}"/${pkgbase}-${pkgver}
+
+ make DESTDIR="${pkgdir}" -C liblightdm-gobject install
+ make DESTDIR="${pkgdir}" -C liblightdm-qt install
+ make DESTDIR="${pkgdir}" -C liblightdm-gobject uninstall
+ find "${pkgdir}" -type d -name *qt[!5]* -exec rm -rf {} +
+ find "${pkgdir}" -type f -name *qt[!5]* -exec rm {} +
+ find "${pkgdir}" -type l -name *qt[!5]* -exec rm {} +
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/community/lightdm/lightdm-autologin.pam b/community/lightdm/lightdm-autologin.pam
new file mode 100755
index 000000000..0b1f79e3e
--- /dev/null
+++ b/community/lightdm/lightdm-autologin.pam
@@ -0,0 +1,13 @@
+#%PAM-1.0
+auth required pam_env.so
+auth required pam_tally.so file=/var/log/faillog onerr=succeed
+auth required pam_shells.so
+auth required pam_nologin.so
+auth [success=1 default=ignore] pam_succeed_if.so user ingroup autologin
+auth required pam_unix.so
+auth required pam_permit.so
+-auth optional pam_gnome_keyring.so
+account include system-local-login
+password include system-local-login
+session include system-local-login
+-session optional pam_gnome_keyring.so auto_start
diff --git a/community/lightdm/lightdm-default-config.patch b/community/lightdm/lightdm-default-config.patch
new file mode 100755
index 000000000..42d49536d
--- /dev/null
+++ b/community/lightdm/lightdm-default-config.patch
@@ -0,0 +1,43 @@
+diff -rupN lightdm-1.5.1.orig/data/lightdm.conf lightdm-1.5.1/data/lightdm.conf
+--- lightdm-1.5.1.orig/data/lightdm.conf 2013-03-06 03:40:10.000000000 +0100
++++ lightdm-1.5.1/data/lightdm.conf 2013-03-12 22:59:22.494743200 +0100
+@@ -24,7 +24,7 @@
+ #user-authority-in-system-dir=false
+ #guest-account-script=guest-account
+ #log-directory=/var/log/lightdm
+-#run-directory=/var/run/lightdm
++run-directory=/run/lightdm
+ #cache-directory=/var/cache/lightdm
+ #xsessions-directory=/usr/share/xsessions
+ #remote-sessions-directory=/usr/share/lightdm/remote-sessions
+@@ -77,7 +77,7 @@
+ #user-session=default
+ #allow-guest=true
+ #guest-session=UNIMPLEMENTED
+-#session-wrapper=lightdm-session
++session-wrapper=/etc/lightdm/xsession
+ #display-setup-script=
+ #greeter-setup-script=
+ #session-setup-script=
+@@ -86,6 +86,7 @@
+ #autologin-user=
+ #autologin-user-timeout=0
+ #autologin-session=UNIMPLEMENTED
++pam-service=lightdm-autologin
+ #exit-on-failure=false
+
+ #
+diff -rupN lightdm-1.5.1.orig/data/users.conf lightdm-1.5.1/data/users.conf
+--- lightdm-1.5.1.orig/data/users.conf 2013-03-06 03:40:10.000000000 +0100
++++ lightdm-1.5.1/data/users.conf 2013-03-12 22:54:29.398854700 +0100
+@@ -8,7 +8,7 @@
+ # hidden-users = Users that are not shown to the user
+ # hidden-shells = Shells that indicate a user cannot login
+ #
+-[UserAccounts]
+-minimum-uid=500
++[UserList]
++minimum-uid=1000
+ hidden-users=nobody nobody4 noaccess
+-hidden-shells=/bin/false /usr/sbin/nologin
++hidden-shells=/bin/false /sbin/nologin
diff --git a/community/lightdm/lightdm-lock-screen-before-switch.patch b/community/lightdm/lightdm-lock-screen-before-switch.patch
new file mode 100755
index 000000000..b8b1d559c
--- /dev/null
+++ b/community/lightdm/lightdm-lock-screen-before-switch.patch
@@ -0,0 +1,55 @@
+# HG changeset patch
+# Parent b329fa1badaa454239690c3feb93d53324134915
+try to lock the screen before switching users
+
+diff --git a/utils/gdmflexiserver b/utils/gdmflexiserver
+--- a/utils/gdmflexiserver
++++ b/utils/gdmflexiserver
+@@ -9,9 +9,47 @@
+ #
+ # See http://www.gnu.org/copyleft/gpl.html for the full text of the license.
+
++PATH=/usr/local/bin:/bin:/usr/bin
++export PATH
++
+ if [ -z "$XDG_SEAT_PATH" ]; then
+ # something went wrong
+ exit 1
+ fi
+
++find_command () {
++ cmd="$1"
++ oIFS="${IFS}"; IFS=:
++ set -- ${PATH}
++ IFS="${oIFS}"
++
++ for part; do
++ [ -x "${part}/${cmd}" ] && return 0
++ done
++ return 1
++}
++
++lock_screen () {
++ for lock_cmd in \
++ "xscreensaver-command -lock" \
++ "gnome-screensaver-command --lock" \
++ "dbus-send --session --dest=org.freedesktop.ScreenSaver --type=method_call /ScreenSaver org.freedesktop.ScreenSaver.Lock"
++ do
++ ${lock_cmd} >/dev/null 2>&1 && return
++ done
++
++ for lock_cmd in \
++ "slock" \
++ "xlock -mode blank"
++ do
++ set -- ${lock_cmd}
++ if find_command "$1"; then
++ ${lock_cmd} >/dev/null 2>&1 &
++ return
++ fi
++ done
++}
++
++lock_screen
++
+ dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.DisplayManager $XDG_SEAT_PATH org.freedesktop.DisplayManager.Seat.SwitchToGreeter
diff --git a/community/lightdm/lightdm-use-login1.patch b/community/lightdm/lightdm-use-login1.patch
new file mode 100755
index 000000000..89adbdbb7
--- /dev/null
+++ b/community/lightdm/lightdm-use-login1.patch
@@ -0,0 +1,514 @@
+=== modified file 'liblightdm-gobject/power.c'
+--- liblightdm-gobject/power.c 2013-01-31 20:56:09 +0000
++++ liblightdm-gobject/power.c 2013-04-15 02:21:06 +0000
+@@ -17,6 +17,7 @@
+
+ static GDBusProxy *upower_proxy = NULL;
+ static GDBusProxy *ck_proxy = NULL;
++static GDBusProxy *login1_proxy = NULL;
+
+ static gboolean
+ upower_call_function (const gchar *function, gboolean default_result, GError **error)
+@@ -109,11 +110,10 @@
+ return upower_call_function ("Hibernate", TRUE, error);
+ }
+
+-static gboolean
+-ck_call_function (const gchar *function, gboolean default_result, GError **error)
++static GVariant *
++ck_call_function (const gchar *function, GError **error)
+ {
+- GVariant *result;
+- gboolean function_result = FALSE;
++ GVariant *r;
+
+ if (!ck_proxy)
+ {
+@@ -129,22 +129,46 @@
+ return FALSE;
+ }
+
+- result = g_dbus_proxy_call_sync (ck_proxy,
+- function,
+- NULL,
+- G_DBUS_CALL_FLAGS_NONE,
+- -1,
+- NULL,
+- error);
+-
+- if (!result)
+- return default_result;
+-
+- if (g_variant_is_of_type (result, G_VARIANT_TYPE ("(b)")))
+- g_variant_get (result, "(b)", &function_result);
+-
+- g_variant_unref (result);
+- return function_result;
++ r = g_dbus_proxy_call_sync (ck_proxy,
++ function,
++ NULL,
++ G_DBUS_CALL_FLAGS_NONE,
++ -1,
++ NULL,
++ error);
++
++ return r;
++}
++
++static GVariant *
++login1_call_function (const gchar *function, GVariant *parameters, GError **error)
++{
++ GVariant *r;
++ gchar *str_result;
++
++ if (!login1_proxy)
++ {
++ login1_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
++ G_DBUS_PROXY_FLAGS_NONE,
++ NULL,
++ "org.freedesktop.login1",
++ "/org/freedesktop/login1",
++ "org.freedesktop.login1.Manager",
++ NULL,
++ error);
++ if (!login1_proxy)
++ return NULL;
++ }
++
++ r = g_dbus_proxy_call_sync (login1_proxy,
++ function,
++ parameters,
++ G_DBUS_CALL_FLAGS_NONE,
++ -1,
++ NULL,
++ error);
++
++ return r;
+ }
+
+ /**
+@@ -157,7 +181,29 @@
+ gboolean
+ lightdm_get_can_restart (void)
+ {
+- return ck_call_function ("CanRestart", FALSE, NULL);
++ gboolean can_restart = FALSE;
++ GVariant *r;
++
++ r = login1_call_function ("CanReboot", NULL, NULL);
++ if (r)
++ {
++ gchar *result;
++ if (g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
++ {
++ g_variant_get (r, "(&s)", &result);
++ can_restart = g_strcmp0 (result, "yes") == 0;
++ }
++ }
++ else
++ {
++ r = ck_call_function ("CanRestart", NULL);
++ if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
++ g_variant_get (r, "(b)", &can_restart);
++ }
++ if (r)
++ g_variant_unref (r);
++
++ return can_restart;
+ }
+
+ /**
+@@ -171,7 +217,20 @@
+ gboolean
+ lightdm_restart (GError **error)
+ {
+- return ck_call_function ("Restart", TRUE, error);
++ GVariant *r;
++ gboolean restarted;
++
++ r = login1_call_function ("Reboot", g_variant_new("(b)", FALSE), error);
++ if (!r)
++ {
++ g_clear_error (error);
++ r = ck_call_function ("Restart", error);
++ }
++ restarted = r != NULL;
++ if (r)
++ g_variant_unref (r);
++
++ return restarted;
+ }
+
+ /**
+@@ -184,7 +243,29 @@
+ gboolean
+ lightdm_get_can_shutdown (void)
+ {
+- return ck_call_function ("CanStop", FALSE, NULL);
++ gboolean can_shutdown = FALSE;
++ GVariant *r;
++
++ r = login1_call_function ("CanPowerOff", NULL, NULL);
++ if (r)
++ {
++ gchar *result;
++ if (g_variant_is_of_type (r, G_VARIANT_TYPE ("(s)")))
++ {
++ g_variant_get (r, "(&s)", &result);
++ can_shutdown = g_strcmp0 (result, "yes") == 0;
++ }
++ }
++ else
++ {
++ r = ck_call_function ("CanStop", NULL);
++ if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)")))
++ g_variant_get (r, "(b)", &can_shutdown);
++ }
++ if (r)
++ g_variant_unref (r);
++
++ return can_shutdown;
+ }
+
+ /**
+@@ -198,5 +279,18 @@
+ gboolean
+ lightdm_shutdown (GError **error)
+ {
+- return ck_call_function ("Stop", TRUE, error);
++ GVariant *r;
++ gboolean shutdown;
++
++ r = login1_call_function ("PowerOff", g_variant_new("(b)", FALSE), error);
++ if (!r)
++ {
++ g_clear_error (error);
++ r = ck_call_function ("Stop", error);
++ }
++ shutdown = r != NULL;
++ if (r)
++ g_variant_unref (r);
++
++ return shutdown;
+ }
+
+=== modified file 'liblightdm-qt/power.cpp'
+--- liblightdm-qt/power.cpp 2013-02-06 14:08:25 +0000
++++ liblightdm-qt/power.cpp 2013-04-14 23:00:34 +0000
+@@ -15,6 +15,7 @@
+ #include <QtCore/QVariant>
+ #include <QtDBus/QDBusInterface>
+ #include <QtDBus/QDBusReply>
++#include <QDebug>
+
+ #include "config.h"
+
+@@ -26,11 +27,13 @@
+ PowerInterfacePrivate();
+ QScopedPointer<QDBusInterface> powerManagementInterface;
+ QScopedPointer<QDBusInterface> consoleKitInterface;
++ QScopedPointer<QDBusInterface> login1Interface;
+ };
+
+ PowerInterface::PowerInterfacePrivate::PowerInterfacePrivate() :
+ powerManagementInterface(new QDBusInterface("org.freedesktop.UPower","/org/freedesktop/UPower", "org.freedesktop.UPower", QDBusConnection::systemBus())),
+- consoleKitInterface(new QDBusInterface("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", QDBusConnection::systemBus()))
++ consoleKitInterface(new QDBusInterface("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", QDBusConnection::systemBus())),
++ login1Interface(new QDBusInterface("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", QDBusConnection::systemBus()))
+ {
+ }
+
+@@ -80,34 +83,54 @@
+
+ bool PowerInterface::canShutdown()
+ {
++ if (d->login1Interface->isValid()) {
++ QDBusReply<QString> reply1 = d->login1Interface->call("CanPowerOff");
++ if (reply1.isValid()) {
++ return reply1.value() == "yes";
++ }
++ }
++ qWarning() << d->login1Interface->lastError();
++
+ QDBusReply<bool> reply = d->consoleKitInterface->call("CanStop");
+ if (reply.isValid()) {
+ return reply.value();
+ }
+- else {
+- return false;
+- }
++
++ return false;
+ }
+
+ void PowerInterface::shutdown()
+ {
+- d->consoleKitInterface->call("Stop");
++ if (d->login1Interface->isValid())
++ d->login1Interface->call("PowerOff", false);
++ else
++ d->consoleKitInterface->call("Stop");
+ }
+
+ bool PowerInterface::canRestart()
+ {
++ if (d->login1Interface->isValid()) {
++ QDBusReply<QString> reply1 = d->login1Interface->call("CanReboot");
++ if (reply1.isValid()) {
++ return reply1.value() == "yes";
++ }
++ }
++ qWarning() << d->login1Interface->lastError();
++
+ QDBusReply<bool> reply = d->consoleKitInterface->call("CanRestart");
+ if (reply.isValid()) {
+ return reply.value();
+ }
+- else {
+- return false;
+- }
++
++ return false;
+ }
+
+ void PowerInterface::restart()
+ {
+- d->consoleKitInterface->call("Restart");
++ if (d->login1Interface->isValid())
++ d->login1Interface->call("Reboot", false);
++ else
++ d->consoleKitInterface->call("Restart");
+ }
+
+ #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+
+=== modified file 'tests/Makefile.am'
+--- tests/Makefile.am 2013-04-12 03:46:06 +0000
++++ tests/Makefile.am 2013-04-14 22:54:54 +0000
+@@ -135,6 +135,8 @@
+ test-no-accounts-service \
+ test-console-kit \
+ test-no-console-kit \
++ test-no-login1 \
++ test-no-console-kit-or-login1 \
+ test-open-file-descriptors \
+ test-xdmcp-open-file-descriptors
+
+@@ -284,8 +286,10 @@
+ scripts/no-accounts-service.conf \
+ scripts/no-config.conf \
+ scripts/no-console-kit.conf \
++ scripts/no-console-kit-or-login1.conf \
+ scripts/no-keyboard-layout.conf \
+ scripts/no-language.conf \
++ scripts/no-login1.conf \
+ scripts/open-file-descriptors.conf \
+ scripts/pam.conf \
+ scripts/plymouth-active-vt.conf \
+
+=== added file 'tests/scripts/no-console-kit-or-login1.conf'
+--- tests/scripts/no-console-kit-or-login1.conf 1970-01-01 00:00:00 +0000
++++ tests/scripts/no-console-kit-or-login1.conf 2013-04-14 22:54:54 +0000
+@@ -0,0 +1,34 @@
++#
++# Check still works when neither ConsoleKit or login1 is available
++#
++
++[test-runner-config]
++disable-console-kit=true
++disable-login1=true
++
++[LightDM]
++minimum-display-number=50
++
++[SeatDefaults]
++autologin-user=have-password1
++
++#?RUNNER DAEMON-START
++
++# X server starts
++#?XSERVER :50 START
++#?XSERVER :50 INDICATE-READY
++
++# LightDM connects to X server
++#?XSERVER :50 ACCEPT-CONNECT
++
++# Session starts
++#?SESSION :50 START USER=have-password1
++#?XSERVER :50 ACCEPT-CONNECT
++#?SESSION :50 CONNECT-XSERVER
++
++# Cleanup
++#?*STOP-DAEMON
++# Don't know what order they will terminate
++#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
++#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
++#?RUNNER DAEMON-EXIT STATUS=0
+
+=== added file 'tests/scripts/no-login1.conf'
+--- tests/scripts/no-login1.conf 1970-01-01 00:00:00 +0000
++++ tests/scripts/no-login1.conf 2013-04-14 22:54:54 +0000
+@@ -0,0 +1,33 @@
++#
++# Check still works when login1 is not available
++#
++
++[test-runner-config]
++disable-login1=true
++
++[LightDM]
++minimum-display-number=50
++
++[SeatDefaults]
++autologin-user=have-password1
++
++#?RUNNER DAEMON-START
++
++# X server starts
++#?XSERVER :50 START
++#?XSERVER :50 INDICATE-READY
++
++# LightDM connects to X server
++#?XSERVER :50 ACCEPT-CONNECT
++
++# Session starts
++#?SESSION :50 START USER=have-password1
++#?XSERVER :50 ACCEPT-CONNECT
++#?SESSION :50 CONNECT-XSERVER
++
++# Cleanup
++#?*STOP-DAEMON
++# Don't know what order they will terminate
++#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
++#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
++#?RUNNER DAEMON-EXIT STATUS=0
+
+=== modified file 'tests/src/test-runner.c'
+--- tests/src/test-runner.c 2013-03-27 00:48:48 +0000
++++ tests/src/test-runner.c 2013-04-14 22:54:54 +0000
+@@ -838,6 +838,101 @@
+ }
+
+ static void
++handle_login1_call (GDBusConnection *connection,
++ const gchar *sender,
++ const gchar *object_path,
++ const gchar *interface_name,
++ const gchar *method_name,
++ GVariant *parameters,
++ GDBusMethodInvocation *invocation,
++ gpointer user_data)
++{
++ if (strcmp (method_name, "CanReboot") == 0)
++ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "yes"));
++ else if (strcmp (method_name, "Reboot") == 0)
++ {
++ gboolean interactive;
++ g_variant_get (parameters, "(b)", &interactive);
++ g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
++ }
++ if (strcmp (method_name, "CanPowerOff") == 0)
++ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "yes"));
++ else if (strcmp (method_name, "PowerOff") == 0)
++ {
++ gboolean interactive;
++ g_variant_get (parameters, "(b)", &interactive);
++ g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
++ }
++ else
++ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name);
++}
++
++static void
++login1_name_acquired_cb (GDBusConnection *connection,
++ const gchar *name,
++ gpointer user_data)
++{
++ const gchar *login1_interface =
++ "<node>"
++ " <interface name='org.freedesktop.login1.Manager'>"
++ " <method name='CanReboot'>"
++ " <arg name='result' direction='out' type='s'/>"
++ " </method>"
++ " <method name='Reboot'>"
++ " <arg name='interactive' direction='in' type='b'/>"
++ " </method>"
++ " <method name='CanPowerOff'>"
++ " <arg name='result' direction='out' type='s'/>"
++ " </method>"
++ " <method name='PowerOff'>"
++ " <arg name='interactive' direction='in' type='b'/>"
++ " </method>"
++ " </interface>"
++ "</node>";
++ static const GDBusInterfaceVTable login1_vtable =
++ {
++ handle_login1_call,
++ };
++ GDBusNodeInfo *login1_info;
++ GError *error = NULL;
++
++ login1_info = g_dbus_node_info_new_for_xml (login1_interface, &error);
++ if (error)
++ g_warning ("Failed to parse D-Bus interface: %s", error->message);
++ g_clear_error (&error);
++ if (!login1_info)
++ return;
++ g_dbus_connection_register_object (connection,
++ "/org/freedesktop/login1",
++ login1_info->interfaces[0],
++ &login1_vtable,
++ NULL, NULL,
++ &error);
++ if (error)
++ g_warning ("Failed to register login1 service: %s", error->message);
++ g_clear_error (&error);
++ g_dbus_node_info_unref (login1_info);
++
++ service_count--;
++ if (service_count == 0)
++ run_lightdm ();
++}
++
++static void
++start_login1_daemon ()
++{
++ service_count++;
++ g_bus_own_name (G_BUS_TYPE_SYSTEM,
++ "org.freedesktop.login1",
++ G_BUS_NAME_OWNER_FLAGS_NONE,
++ login1_name_acquired_cb,
++ NULL,
++ NULL,
++ NULL,
++ NULL);
++}
++
++static void
+ load_passwd_file ()
+ {
+ gchar *path, *data, **lines;
+@@ -1474,6 +1569,8 @@
+ /* Start D-Bus services */
+ if (!g_key_file_get_boolean (config, "test-runner-config", "disable-console-kit", NULL))
+ start_console_kit_daemon ();
++ if (!g_key_file_get_boolean (config, "test-runner-config", "disable-login1", NULL))
++ start_login1_daemon ();
+ if (!g_key_file_get_boolean (config, "test-runner-config", "disable-accounts-service", NULL))
+ start_accounts_service_daemon ();
+
+
+=== added file 'tests/test-no-console-kit-or-login1'
+--- tests/test-no-console-kit-or-login1 1970-01-01 00:00:00 +0000
++++ tests/test-no-console-kit-or-login1 2013-04-14 22:54:54 +0000
+@@ -0,0 +1,2 @@
++#!/bin/sh
++./src/dbus-env ./src/test-runner no-console-kit-or-login1 test-gobject-greeter
+
+=== added file 'tests/test-no-login1'
+--- tests/test-no-login1 1970-01-01 00:00:00 +0000
++++ tests/test-no-login1 2013-04-14 22:54:54 +0000
+@@ -0,0 +1,2 @@
++#!/bin/sh
++./src/dbus-env ./src/test-runner no-login1 test-gobject-greeter
+
diff --git a/community/lightdm/lightdm.install b/community/lightdm/lightdm.install
new file mode 100755
index 000000000..7d9d99a26
--- /dev/null
+++ b/community/lightdm/lightdm.install
@@ -0,0 +1,18 @@
+post_install() {
+ getent group lightdm > /dev/null 2>&1 || groupadd -g 620 lightdm
+ getent passwd lightdm > /dev/null 2>&1 || useradd -c 'Light Display Manager' -u 620 -g lightdm -d /var/lib/lightdm -s /sbin/nologin lightdm
+ passwd -l lightdm > /dev/null
+ chown -R lightdm:lightdm /var/lib/lightdm > /dev/null
+ systemd-tmpfiles --create lightdm.conf
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ getent passwd lightdm > /dev/null 2>&1 && userdel lightdm
+ getent group lightdm > /dev/null 2>&1 && groupdel lightdm
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/community/lightdm/lightdm.pam b/community/lightdm/lightdm.pam
new file mode 100755
index 000000000..76b8869a2
--- /dev/null
+++ b/community/lightdm/lightdm.pam
@@ -0,0 +1,7 @@
+#%PAM-1.0
+auth include system-login
+-auth optional pam_gnome_keyring.so
+account include system-login
+password include system-login
+session include system-login
+-session optional pam_gnome_keyring.so auto_start
diff --git a/community/lightdm/lightdm.rules b/community/lightdm/lightdm.rules
new file mode 100755
index 000000000..eda155bf3
--- /dev/null
+++ b/community/lightdm/lightdm.rules
@@ -0,0 +1,15 @@
+polkit.addRule(function(action, subject) {
+ if (subject.user == "lightdm") {
+ polkit.log("action=" + action);
+ polkit.log("subject=" + subject);
+ if (action.id.indexOf("org.freedesktop.login1.") == 0) {
+ return polkit.Result.YES;
+ }
+ if (action.id.indexOf("org.freedesktop.consolekit.system.") == 0) {
+ return polkit.Result.YES;
+ }
+ if (action.id.indexOf("org.freedesktop.upower.") == 0) {
+ return polkit.Result.YES;
+ }
+ }
+});
diff --git a/community/lightdm/lightdm.service b/community/lightdm/lightdm.service
new file mode 100755
index 000000000..a5556c7ca
--- /dev/null
+++ b/community/lightdm/lightdm.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Light Display Manager
+Documentation=man:lightdm(1)
+After=systemd-user-sessions.service
+
+[Service]
+ExecStart=/usr/bin/lightdm
+StandardOutput=syslog
+Restart=always
+IgnoreSIGPIPE=no
+BusName=org.freedesktop.DisplayManager
+
+[Install]
+Alias=display-manager.service
diff --git a/community/lightdm/lightdm.tmpfiles b/community/lightdm/lightdm.tmpfiles
new file mode 100755
index 000000000..d8ef132d3
--- /dev/null
+++ b/community/lightdm/lightdm.tmpfiles
@@ -0,0 +1 @@
+d /run/lightdm 0711 lightdm lightdm
diff --git a/community/lightdm/xsession b/community/lightdm/xsession
new file mode 100755
index 000000000..589205342
--- /dev/null
+++ b/community/lightdm/xsession
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# LightDM wrapper to run around X sessions.
+
+echo "Running X session wrapper"
+
+# Load profile
+for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
+ if [ -f "$file" ]; then
+ echo "Loading profile from $file";
+ . "$file"
+ fi
+done
+
+# Load resources
+for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
+ if [ -f "$file" ]; then
+ echo "Loading resource: $file"
+ xrdb -nocpp -merge "$file"
+ fi
+done
+
+# Load keymaps
+for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
+ if [ -f "$file" ]; then
+ echo "Loading keymap: $file"
+ setxkbmap `cat "$file"`
+ XKB_IN_USE=yes
+ fi
+done
+
+# Load xmodmap if not using XKB
+if [ -z "$XKB_IN_USE" ]; then
+ for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
+ if [ -f "$file" ]; then
+ echo "Loading modmap: $file"
+ xmodmap "$file"
+ fi
+ done
+fi
+
+unset XKB_IN_USE
+
+# Run all system xinitrc shell scripts.
+xinitdir="/etc/X11/xinit/xinitrc.d"
+if [ -d "$xinitdir" ]; then
+ for script in $xinitdir/*; do
+ echo "Loading xinit script $script"
+ if [ -x "$script" -a ! -d "$script" ]; then
+ . "$script"
+ fi
+ done
+fi
+
+# Load xsession scripts
+xsessionddir="/etc/X11/xsession.d"
+if [ -d "$xsessionddir" ]; then
+ for i in `ls $xsessionddir`; do
+ script="$xsessionddir/$i"
+ echo "Loading X session script $script"
+ if [ -r "$script" -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
+ . "$script"
+ fi
+ done
+fi
+if [ -x "$HOME/.xsession" -a -f "$HOME/.xsession" ]; then
+ echo "Loading user X session script"
+ . "$HOME/.xsession"
+fi
+
+echo "X session wrapper complete, running session $@"
+
+exec $@