summaryrefslogtreecommitdiff
path: root/community/lightdm
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-03-14 00:05:24 -0700
committerroot <root@rshg054.dnsready.net>2013-03-14 00:05:24 -0700
commit3ff20dedff636571ad0faa4736af5b23e4623ffe (patch)
treeab4a70fe4e4a9113ff3483d8635eb46f8994c12a /community/lightdm
parent3efd178c050d911cfdff7e8d2ed4886b98b08b98 (diff)
Thu Mar 14 00:05:23 PDT 2013
Diffstat (limited to 'community/lightdm')
-rwxr-xr-xcommunity/lightdm/PKGBUILD111
-rwxr-xr-xcommunity/lightdm/lightdm-1.5.1-systemd_login1_power.patch211
-rwxr-xr-xcommunity/lightdm/lightdm-autologin.pam11
-rwxr-xr-xcommunity/lightdm/lightdm-default-config.patch35
-rwxr-xr-xcommunity/lightdm/lightdm-lock-screen-before-switch.patch55
-rwxr-xr-xcommunity/lightdm/lightdm.install15
-rwxr-xr-xcommunity/lightdm/lightdm.pam7
-rwxr-xr-xcommunity/lightdm/lightdm.rules15
-rwxr-xr-xcommunity/lightdm/lightdm.service14
-rwxr-xr-xcommunity/lightdm/lightdm.tmpfiles2
-rwxr-xr-xcommunity/lightdm/xsession73
11 files changed, 549 insertions, 0 deletions
diff --git a/community/lightdm/PKGBUILD b/community/lightdm/PKGBUILD
new file mode 100755
index 000000000..c195eea24
--- /dev/null
+++ b/community/lightdm/PKGBUILD
@@ -0,0 +1,111 @@
+# $Id: PKGBUILD 86229 2013-03-13 18:51:51Z alucryd $
+# Maintainer: Maxime Gauduin <alucryd@gmail.com>
+# Contributor: Morfeo <morfeo89@hotmail.it>
+
+pkgbase=lightdm
+pkgname=('lightdm' 'liblightdm-qt4' 'liblightdm-qt5')
+pkgver=1.5.1
+pkgrel=6
+pkgdesc="A lightweight display manager"
+arch=('i686' 'x86_64')
+url="https://launchpad.net/lightdm"
+license=('GPL3' 'LGPL3')
+makedepends=('gobject-introspection' 'gtk-doc' 'intltool' 'itstool' 'libxklavier' 'qt4' 'qt5-base')
+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-1.5.1-systemd_login1_power.patch'
+ 'lightdm-lock-screen-before-switch.patch'
+ 'xsession')
+sha256sums=('645db2d763cc514d6aecb1838f4a9c33c3dcf0c94567a7ef36c6b23d8aa56c86'
+ '2e03423cbe88c9fdc3a9684d6d14221aa6e92d105f9d1d53b08747d966c45125'
+ 'ec10378992907f06a6960c4644aba2f81744fbcaf38f6bdc7c364979be3207e4'
+ 'e8c4c5fd3b801a390d201166fd1fb9730e78a5c62928768103b870b6bd980ea0'
+ 'cd0a9591b61118c6de1b07e1cd9a1b74cd74e9e95288f8b41eba32e26fd22023'
+ 'a89566307e1c81c24f037d854cbd472d2f94f8a4b759877a01563a332319f7d6'
+ '51ec7eb1c50c0ba0b96b846662707533ebc1d6558cea75cb7424afddf0d064f0'
+ '8c8432294d361475293852f45673bc042eb252dbc58a17445fd10e5e874dc608'
+ '4793eaee5915f5c519f569a4cd9158822d4c57c8b6e405895d2eddf82fa00822'
+ '7fb85a1b54406032a922e8fd6f45d869fcfe5681df630e74e8e50c040b786ee4')
+
+build() {
+ cd "${srcdir}"/${pkgbase}-${pkgver}
+
+# Patch
+ patch -Np1 -i ../lightdm-default-config.patch
+ patch -Np1 -i ../lightdm-1.5.1-systemd_login1_power.patch
+ patch -Np1 -i ../lightdm-lock-screen-before-switch.patch
+
+# Build
+ ./configure --prefix=/usr --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=('libgcrypt' 'libxklavier' 'pam')
+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}
+
+# Install
+ make DESTDIR="${pkgdir}" install
+ make DESTDIR="${pkgdir}" -C liblightdm-qt uninstall
+ install -m 755 ../xsession "${pkgdir}"/etc/lightdm/xsession
+ rm -rf "${pkgdir}"/etc/init
+
+# 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}
+
+# Install
+ 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}
+
+# Install
+ 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-1.5.1-systemd_login1_power.patch b/community/lightdm/lightdm-1.5.1-systemd_login1_power.patch
new file mode 100755
index 000000000..0bcb24589
--- /dev/null
+++ b/community/lightdm/lightdm-1.5.1-systemd_login1_power.patch
@@ -0,0 +1,211 @@
+diff -up lightdm-1.5.1/liblightdm-gobject/power.c.systemd_login1_power lightdm-1.5.1/liblightdm-gobject/power.c
+--- lightdm-1.5.1/liblightdm-gobject/power.c.systemd_login1_power 2013-03-05 20:40:10.000000000 -0600
++++ lightdm-1.5.1/liblightdm-gobject/power.c 2013-03-09 11:31:00.169897568 -0600
+@@ -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)
+@@ -147,6 +148,59 @@ ck_call_function (const gchar *function,
+ return function_result;
+ }
+
++static gboolean
++login1_call_function (const gchar *function, GVariant *parameters, gboolean default_result, GError **error)
++{
++ GVariant *result;
++ gboolean function_result = FALSE;
++ const gchar *true_result = "yes";
++ 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 FALSE;
++ }
++
++ result = g_dbus_proxy_call_sync (login1_proxy,
++ function,
++ parameters,
++ 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, "(s)", &function_result);
++
++ /**
++ * CanReboot, CanPowerOff returns a string "yes", "no", or "challenge", not a boolean as ConsoleKit
++ **/
++ if (g_variant_is_of_type (result, G_VARIANT_TYPE ("(s)"))) {
++ g_variant_get (result, "(b)", str_result);
++ if(g_strcmp0(str_result,true_result) == 0) {
++ function_result = TRUE;
++ }
++ else {
++ function_result = default_result;
++ }
++ }
++
++ g_variant_unref (result);
++ return function_result;
++}
++
+ /**
+ * lightdm_get_can_restart:
+ *
+@@ -157,7 +211,11 @@ ck_call_function (const gchar *function,
+ gboolean
+ lightdm_get_can_restart (void)
+ {
+- return ck_call_function ("CanRestart", FALSE, NULL);
++ gboolean function_result = FALSE;
++ function_result = login1_call_function ("CanReboot", NULL, FALSE, NULL);
++ if (!function_result)
++ function_result = ck_call_function ("CanRestart", FALSE, NULL);
++ return function_result;
+ }
+
+ /**
+@@ -171,7 +229,11 @@ lightdm_get_can_restart (void)
+ gboolean
+ lightdm_restart (GError **error)
+ {
+- return ck_call_function ("Restart", TRUE, error);
++ gboolean function_result = FALSE;
++ function_result = login1_call_function ("Reboot", g_variant_new("(b)",0), TRUE, error);
++ if (!function_result)
++ function_result = ck_call_function ("Restart", TRUE, error);
++ return function_result;
+ }
+
+ /**
+@@ -184,7 +246,11 @@ lightdm_restart (GError **error)
+ gboolean
+ lightdm_get_can_shutdown (void)
+ {
+- return ck_call_function ("CanStop", FALSE, NULL);
++ gboolean function_result = FALSE;
++ function_result = login1_call_function ("CanPowerOff", NULL, FALSE, NULL);
++ if (!function_result)
++ function_result = ck_call_function ("CanStop", FALSE, NULL);
++ return function_result;
+ }
+
+ /**
+@@ -198,5 +264,9 @@ lightdm_get_can_shutdown (void)
+ gboolean
+ lightdm_shutdown (GError **error)
+ {
+- return ck_call_function ("Stop", TRUE, error);
++ gboolean function_result = FALSE;
++ function_result = login1_call_function ("PowerOff", g_variant_new("(b)",0), TRUE, error);
++ if (!function_result)
++ function_result = ck_call_function ("Stop", TRUE, error);
++ return function_result;
+ }
+diff -up lightdm-1.5.1/liblightdm-qt/power.cpp.systemd_login1_power lightdm-1.5.1/liblightdm-qt/power.cpp
+--- lightdm-1.5.1/liblightdm-qt/power.cpp.systemd_login1_power 2013-03-05 20:40:10.000000000 -0600
++++ lightdm-1.5.1/liblightdm-qt/power.cpp 2013-03-09 11:36:47.140559838 -0600
+@@ -15,6 +15,7 @@
+ #include <QtCore/QVariant>
+ #include <QtDBus/QDBusInterface>
+ #include <QtDBus/QDBusReply>
++#include <QDebug>
+
+ #include "config.h"
+
+@@ -26,11 +27,13 @@ public:
+ 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,55 @@ void PowerInterface::hibernate()
+
+ 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)
diff --git a/community/lightdm/lightdm-autologin.pam b/community/lightdm/lightdm-autologin.pam
new file mode 100755
index 000000000..4cd3626cd
--- /dev/null
+++ b/community/lightdm/lightdm-autologin.pam
@@ -0,0 +1,11 @@
+#%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 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..8b106dd91
--- /dev/null
+++ b/community/lightdm/lightdm-default-config.patch
@@ -0,0 +1,35 @@
+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=
+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.install b/community/lightdm/lightdm.install
new file mode 100755
index 000000000..154d93e10
--- /dev/null
+++ b/community/lightdm/lightdm.install
@@ -0,0 +1,15 @@
+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 /run/lightdm -s /sbin/nologin lightdm
+ passwd -l lightdm > /dev/null
+ systemd-tmpfiles --create /usr/lib/tmpfiles.d/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
+}
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..7eb46ceba
--- /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/sbin/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..5199f5327
--- /dev/null
+++ b/community/lightdm/lightdm.tmpfiles
@@ -0,0 +1,2 @@
+d /run/lightdm 0775 lightdm lightdm
+f /run/lightdm/.pam_environment 0644 lightdm lightdm - GDK_CORE_DEVICE_EVENTS=true
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 $@