summaryrefslogtreecommitdiff
path: root/kde-base/kdm
diff options
context:
space:
mode:
Diffstat (limited to 'kde-base/kdm')
-rw-r--r--kde-base/kdm/Manifest2
-rw-r--r--kde-base/kdm/files/kde-workspace-4.10.2-kdm-logind-multiseat.patch331
-rw-r--r--kde-base/kdm/files/kde-workspace-4.10.90-kdm-logind-multiseat.patch405
-rw-r--r--kde-base/kdm/files/kde-workspace-4.8.0-bug796969.patch37
-rw-r--r--kde-base/kdm/files/kdebase-workspace-4.4.92-kdm_plymouth081.patch165
-rw-r--r--kde-base/kdm/files/kdm-4-gentoo-xinitrc.d.patch19
-rw-r--r--kde-base/kdm/files/kdm-logrotate8
-rw-r--r--kde-base/kdm/files/kdm.service9
-rw-r--r--kde-base/kdm/kdm-4.11.5.ebuild164
-rw-r--r--kde-base/kdm/kdm-4.11.6.ebuild164
10 files changed, 1304 insertions, 0 deletions
diff --git a/kde-base/kdm/Manifest b/kde-base/kdm/Manifest
new file mode 100644
index 00000000..63fa99dc
--- /dev/null
+++ b/kde-base/kdm/Manifest
@@ -0,0 +1,2 @@
+DIST kde-workspace-4.11.5.tar.xz 13714748 SHA256 3b99a3991d6d8b1aa4158da67ead30cabb815c07a6c8ee10751307f97d8613cf SHA512 311ef4f13a35f5e5d4b2eb60491d76aa8a47a25c7a565d7378c653b4d01d0d21d867deef9c658dff9bd14a02f1834d4781fed80129b5dc05d1490d34c656a281 WHIRLPOOL 3a853bc77e4beed8e1524a34061ba518b3ebe429e7873d58b30705516b743bcabc79124d01e59a2b9e1dc83cfd5128e8fc2d9fa5f2addb362a44ee53b4685c2d
+DIST kde-workspace-4.11.6.tar.xz 13531288 SHA256 e1b3cb78dc94f3fab61c588ee610f143a1fd8a70f5f08b5ba19174427f9a6352 SHA512 059877a8f5bb6df47bf043a9f89be6a827b56a0fc11104b189041eb4e08e40d6f9375c1268afcfcee329735d2c62e3959589751b5281603ff1bcc637cec38cd6 WHIRLPOOL ba5f0e277f6abbb502088ac9bdb420a221e570b140dd4a2dd6dccb1dfcf93efd2fceecb075f5a66fbe6c61346a2dfd7290124036f2e0f58091119a00ce7b8346
diff --git a/kde-base/kdm/files/kde-workspace-4.10.2-kdm-logind-multiseat.patch b/kde-base/kdm/files/kde-workspace-4.10.2-kdm-logind-multiseat.patch
new file mode 100644
index 00000000..e4b33d5c
--- /dev/null
+++ b/kde-base/kdm/files/kde-workspace-4.10.2-kdm-logind-multiseat.patch
@@ -0,0 +1,331 @@
+--- kde-workspace-4.10.2/CMakeLists.txt.kdm_logind 2013-03-29 09:35:09.542235739 +0100
++++ kde-workspace-4.10.2/CMakeLists.txt 2013-04-10 15:17:35.941332970 +0200
+@@ -76,6 +76,9 @@ if(Q_WS_X11)
+ endif(NOT X11_Xcursor_FOUND)
+ endif(Q_WS_X11)
+
++macro_optional_find_package(Systemd)
++macro_log_feature(SYSTEMD_FOUND "systemd" "Init and service manager for Linux" "http://www.freedesktop.org/wiki/Software/systemd" FALSE "" "Provides automatic multi-seat, session and power management features")
++
+ macro_optional_find_package(GLIB2)
+ macro_log_feature(GLIB2_FOUND "glib2" "Low-level core library for data structure handling, portability wrappers, etc." "http://www.gtk.org" FALSE "2.x" "Needed to build the kxkb keyboard map control program and provide XMMS support in the Now Playing Plasma data engine")
+
+--- kde-workspace-4.10.2/cmake/modules/CMakeLists.txt.kdm_logind 2013-03-01 07:32:23.652864293 +0100
++++ kde-workspace-4.10.2/cmake/modules/CMakeLists.txt 2013-04-10 15:17:35.941332970 +0200
+@@ -9,6 +9,7 @@ set(cmakeFiles FindCkConnector.cmake
+ FindOpenGLES.cmake
+ FindPAM.cmake
+ FindSensors.cmake
++ FindSystemd.cmake
+ PkgConfigGetVar.cmake
+ UnixAuth.cmake )
+
+--- kde-workspace-4.10.2/cmake/modules/FindSystemd.cmake.kdm_logind 2013-04-10 15:17:35.941332970 +0200
++++ kde-workspace-4.10.2/cmake/modules/FindSystemd.cmake 2013-04-10 16:20:41.270790058 +0200
+@@ -0,0 +1,39 @@
++# Finds systemd and its libraries
++# Not a huge module but sufficient for now
++# Uses the same semantics as pkg_check_modules, i.e. ${LIB}{_FOUND,_INCLUDE_DIR,_LIBRARIES}
++# where ${LIB} can be one of the following:
++# LIBSYSTEMD_JOURNAL, SYSTEMD, LIBSYSTEMD_DAEMON, LIBSYSTEMD_LOGIN, LIBSYSTEMD_ID128
++#
++# Copyright: Red Hat, Inc. 2013
++# Author: Martin Briza <mbriza@redhat.com>
++#
++# Distributed under the BSD license. See COPYING-CMAKE-SCRIPTS for details.
++
++#defining any of these disables systemd support
++if (NOT LIBSYSTEMD_JOURNAL_FOUND AND
++ NOT SYSTEMD_FOUND AND
++ NOT LIBSYSTEMD_DAEMON_FOUND AND
++ NOT LIBSYSTEMD_LOGIN_FOUND AND
++ NOT LIBSYSTEMD_ID128_FOUND)
++find_package(PkgConfig)
++if (PKG_CONFIG_FOUND)
++ pkg_check_modules(LIBSYSTEMD_JOURNAL QUIET "libsystemd-journal")
++ pkg_check_modules(SYSTEMD QUIET "systemd")
++ pkg_check_modules(LIBSYSTEMD_DAEMON QUIET "libsystemd-daemon")
++ pkg_check_modules(LIBSYSTEMD_LOGIN QUIET "libsystemd-login")
++ pkg_check_modules(LIBSYSTEMD_ID128 QUIET "libsystemd-id128")
++endif (PKG_CONFIG_FOUND)
++
++if (SYSTEMD_FOUND)
++ message(STATUS "Found systemd")
++endif(SYSTEMD_FOUND)
++
++mark_as_advanced(LIBSYSTEMD_JOURNAL_FOUND SYSTEMD_FOUND LIBSYSTEMD_DAEMON_FOUND LIBSYSTEMD_LOGIN_FOUND LIBSYSTEMD_ID128_FOUND)
++mark_as_advanced(LIBSYSTEMD_JOURNAL_INCLUDE_DIR SYSTEMD_INCLUDE_DIR LIBSYSTEMD_DAEMON_INCLUDE_DIR LIBSYSTEMD_LOGIN_INCLUDE_DIR LIBSYSTEMD_ID128_INCLUDE_DIR)
++mark_as_advanced(LIBSYSTEMD_JOURNAL_LIBRARIES SYSTEMD_LIBRARIES LIBSYSTEMD_DAEMON_LIBRARIES LIBSYSTEMD_LOGIN_LIBRARIES LIBSYSTEMD_ID128_LIBRARIES)
++
++endif (NOT LIBSYSTEMD_JOURNAL_FOUND AND
++ NOT SYSTEMD_FOUND AND
++ NOT LIBSYSTEMD_DAEMON_FOUND AND
++ NOT LIBSYSTEMD_LOGIN_FOUND AND
++ NOT LIBSYSTEMD_ID128_FOUND)
+--- kde-workspace-4.10.2/kdm/backend/dm.c.kdm_logind 2013-04-10 15:17:35.916333005 +0200
++++ kde-workspace-4.10.2/kdm/backend/dm.c 2013-04-10 15:17:35.942332969 +0200
+@@ -50,6 +50,23 @@ from the copyright holder.
+ # include <sys/vt.h>
+ #endif
+
++#ifdef WITH_SYSTEMD
++# include <systemd/sd-login.h>
++# include <systemd/sd-daemon.h>
++
++#define SYSTEMD_FAILURE_LIMIT 25
++
++ static int systemdMonitorInit(void);
++ static void systemdMonitorDeinit();
++ static int systemdStartDisplay(char *);
++ static void systemdCheckAdded(char **);
++ static void systemdCheckRemoved(char **);
++ static void systemdHandleChange();
++
++ sd_login_monitor *systemd_monitor = NULL;
++ int systemd_monitor_fd = -1;
++#endif
++
+ static void sigHandler(int n);
+ static int scanConfigs(int force);
+ static void startDisplay(struct display *d);
+@@ -308,7 +325,16 @@ main(int argc, char **argv)
+ #ifdef XDMCP
+ updateListenSockets();
+ #endif
++
++#ifdef WITH_SYSTEMD
++ if (systemdMonitorInit())
++ systemdHandleChange();
++#endif
++
+ mainLoop();
++#ifdef WITH_SYSTEMD
++ systemdMonitorDeinit();
++#endif
+ closeCtrl(0);
+ if (sdRec.how) {
+ int pid;
+@@ -1280,6 +1306,14 @@ mainLoop(void)
+ }
+ continue;
+ }
++ logError("STARTING");
++#ifdef WITH_SYSTEMD
++ if (systemd_monitor_fd >= 0 && FD_ISSET(systemd_monitor_fd, &reads)) {
++ systemdHandleChange();
++ sd_login_monitor_flush(systemd_monitor);
++ continue;
++ }
++#endif
+ #ifdef XDMCP
+ if (processListenSockets(&reads))
+ continue;
+@@ -1304,6 +1338,151 @@ mainLoop(void)
+ }
+ }
+
++#ifdef WITH_SYSTEMD
++static int
++systemdMonitorInit(void)
++{
++ if (access("/run/systemd/seats/", F_OK) < 0) {
++ logError("Doesn't use logind, automatic multiseat won't be enabled\n");
++ return False;
++ }
++
++ int check = sd_login_monitor_new("seat", &systemd_monitor);
++ if (check < 0) {
++ logError("Can't get systemd monitor: %d, automatic multiseat won't be enabled\n", check);
++ return False;
++ }
++
++ systemd_monitor_fd = sd_login_monitor_get_fd(systemd_monitor);
++ if (systemd_monitor_fd < 0) {
++ logError("Can't retrieve file descriptor from the systemd monitor: %d, automatic multiseat won't be enabled\n", systemd_monitor_fd);
++ sd_login_monitor_unref(systemd_monitor);
++ systemd_monitor_fd = -1;
++ return False;
++ }
++
++ registerInput(systemd_monitor_fd);
++ return True;
++}
++
++static void
++systemdMonitorDeinit(void)
++{
++ if (systemd_monitor) {
++ sd_login_monitor_unref(systemd_monitor);
++ }
++ systemd_monitor_fd = -1;
++}
++
++static int
++systemdStartDisplay(char *seat)
++{
++ struct display *link = NULL;
++ for (link = displays; link; link = link-> next) {
++ if (link->status == reserve)
++ break;
++ }
++ if (!link) {
++ logError("There's not enough reserve displays for all your seats/sessions");
++ return False;
++ }
++ if (!strDup((&link->systemd_seat), seat)) {
++ return False;
++ }
++#ifdef HAVE_VTS
++ link->serverVT = 0;
++#endif
++ link->status = notRunning;
++ link->stillThere = True;
++ link->authorize = True;
++ link->displayType = dLocal | dPermanent;
++ link->reqSrvVT = -1;
++ link->serverPid = -1;
++ return True;
++}
++
++static void
++systemdCheckAdded(char **seat_names)
++{
++ char **iter_name;
++ struct display *link;
++ for (iter_name = seat_names; *iter_name; iter_name++) {
++ if (strcmp(*iter_name, "seat0") == 0)
++ continue; /* ignore the main seat */
++ int can_graphical = sd_seat_can_graphical(*iter_name);
++ for (link = displays; link; link = link->next) {
++ if (!link->systemd_seat)
++ continue;
++ /* see if the can_graphical property didn't change */
++ if (strcmp(*iter_name, link->systemd_seat)) {
++ if (!can_graphical) {
++ free(link->systemd_seat);
++ link->systemd_seat = NULL;
++ rStopDisplay(link, DS_RESERVE);
++ }
++ break;
++ }
++ }
++ /* the display wasn't found */
++ if (!link) {
++ if (can_graphical) {
++ /* if starting the display failed, skip this round until the next change */
++ if (!systemdStartDisplay(*iter_name))
++ break;
++ }
++ }
++ }
++}
++
++static void
++systemdCheckRemoved(char **seat_names)
++{
++ char **iter_name;
++ struct display *link;
++ for (link = displays; link; link = link->next) {
++ for (iter_name = seat_names; *iter_name; iter_name++) {
++ if (strcmp(*iter_name, "seat0") == 0)
++ continue; /* ignore the main seat */
++ if (link->systemd_seat && strcmp(*iter_name, link->systemd_seat) == 0)
++ break;
++ }
++ if (!(*iter_name) && link->systemd_seat) { /* was not found, stop this one */
++ free(link->systemd_seat);
++ link->systemd_seat = NULL;
++ rStopDisplay(link, DS_RESERVE);
++ }
++ }
++}
++
++static void
++systemdHandleChange(void)
++{
++ static int failures = 0;
++ char **seat_names;
++ char **iter_name;
++ int check;
++ if ((check = sd_get_seats(&seat_names)) < 0) {
++ logError("Can't obtain systemd seats, error %d\n", -check);
++ failures++;
++ if (failures >= SYSTEMD_FAILURE_LIMIT) {
++ logError("%u failed calls to sd_get_seats, disabling systemd multi-seat support\n", SYSTEMD_FAILURE_LIMIT);
++ systemdMonitorDeinit();
++ }
++ return;
++ }
++
++ if (!check)
++ return;
++
++ systemdCheckAdded(seat_names);
++ systemdCheckRemoved(seat_names);
++
++ for (iter_name = seat_names; *iter_name; iter_name++)
++ free(*iter_name);
++ free(seat_names);
++}
++#endif
++
+ static void
+ checkDisplayStatus(struct display *d)
+ {
+--- kde-workspace-4.10.2/kdm/backend/dm.h.kdm_logind 2013-04-10 15:17:35.917333004 +0200
++++ kde-workspace-4.10.2/kdm/backend/dm.h 2013-04-10 15:17:35.942332969 +0200
+@@ -306,6 +306,9 @@ struct display {
+ char *greeterAuthFile; /* file to store authorization for greeter in */
+
+ int plymouth_is_running; /* Plymouth's status */
++#ifdef WITH_SYSTEMD
++ char *systemd_seat;
++#endif
+ };
+
+ #define d_location 1
+--- kde-workspace-4.10.2/kdm/backend/CMakeLists.txt.kdm_logind 2013-03-01 07:32:24.152858104 +0100
++++ kde-workspace-4.10.2/kdm/backend/CMakeLists.txt 2013-04-10 15:17:35.942332969 +0200
+@@ -45,6 +45,10 @@ if (SECURE_RPC)
+ rpcauth.c
+ )
+ endif (SECURE_RPC)
++if(LIBSYSTEMD_LOGIN_FOUND AND LIBSYSTEMD_DAEMON_FOUND)
++ add_definitions( -DWITH_SYSTEMD=1 )
++ set(KDM_SYSTEMD_LIBRARIES ${LIBSYSTEMD_DAEMON_LIBRARIES} ${LIBSYSTEMD_LOGIN_LIBRARIES} )
++endif(LIBSYSTEMD_LOGIN_FOUND AND LIBSYSTEMD_DAEMON_FOUND)
+ macro_add_file_dependencies(dm.h ${confci})
+ macro_add_file_dependencies(error.c ${CMAKE_CURRENT_SOURCE_DIR}/printf.c)
+ kde4_add_executable(kdm NOGUI ${kdm_SRCS})
+@@ -60,6 +64,7 @@ target_link_libraries( kdm
+ ${NSL_LIBRARIES}
+ ${RESOLV_LIBRARIES}
+ ${SOCKET_LIBRARIES}
++ ${KDM_SYSTEMD_LIBRARIES}
+ )
+ if (CKCONNECTOR_FOUND)
+ include_directories(${CKCONNECTOR_INCLUDE_DIR} ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
+--- kde-workspace-4.10.2/kdm/backend/server.c.kdm_logind 2013-04-10 15:17:35.917333004 +0200
++++ kde-workspace-4.10.2/kdm/backend/server.c 2013-04-10 15:17:35.942332969 +0200
+@@ -70,6 +70,21 @@ prepareServerArgv(struct display *d, con
+ if (!changeUser(d->serverUID, d->authFile))
+ exit(47);
+
++#ifdef WITH_SYSTEMD
++ if (d->systemd_seat) {
++ if (!(argv = parseArgs(argv, "-seat")))
++ exit(47);
++ if (!(argv = parseArgs(argv, d->systemd_seat)))
++ exit(47);
++ }
++ else {
++ if (!(argv = parseArgs(argv, "-seat")))
++ exit(47);
++ if (!(argv = parseArgs(argv, "seat0")))
++ exit(47);
++ }
++#endif
++
+ return argv;
+ }
+
diff --git a/kde-base/kdm/files/kde-workspace-4.10.90-kdm-logind-multiseat.patch b/kde-base/kdm/files/kde-workspace-4.10.90-kdm-logind-multiseat.patch
new file mode 100644
index 00000000..10ae2560
--- /dev/null
+++ b/kde-base/kdm/files/kde-workspace-4.10.90-kdm-logind-multiseat.patch
@@ -0,0 +1,405 @@
+diff -up kde-workspace-4.10.90/CMakeLists.txt.kdm_logind kde-workspace-4.10.90/CMakeLists.txt
+--- kde-workspace-4.10.90/CMakeLists.txt.kdm_logind 2013-06-27 16:27:30.199895076 -0500
++++ kde-workspace-4.10.90/CMakeLists.txt 2013-06-27 16:30:25.167008304 -0500
+@@ -128,6 +128,13 @@ if(Q_WS_X11)
+ endif()
+ endif(Q_WS_X11)
+
++macro_optional_find_package(Systemd)
++set_package_properties(Systemd PROPERTIES DESCRIPTION "Init and service manager for Linux"
++ URL "http://www.freedesktop.org/wiki/Software/systemd"
++ TYPE OPTIONAL
++ PURPOSE "Provides automatic multi-seat, session and power management features"
++ )
++
+ macro_optional_find_package(GLIB2 2.0)
+ set_package_properties(GLIB2 PROPERTIES DESCRIPTION "Low-level core library for data structure handling, portability wrappers, etc."
+ URL "http://www.gtk.org"
+diff -up kde-workspace-4.10.90/cmake/modules/CMakeLists.txt.kdm_logind kde-workspace-4.10.90/cmake/modules/CMakeLists.txt
+--- kde-workspace-4.10.90/cmake/modules/CMakeLists.txt.kdm_logind 2013-06-10 13:51:11.000000000 -0500
++++ kde-workspace-4.10.90/cmake/modules/CMakeLists.txt 2013-06-27 16:27:30.199895076 -0500
+@@ -8,6 +8,7 @@ set(cmakeFiles FindCkConnector.cmake
+ FindOpenGLES.cmake
+ FindPAM.cmake
+ FindSensors.cmake
++ FindSystemd.cmake
+ PkgConfigGetVar.cmake
+ UnixAuth.cmake )
+
+diff -up kde-workspace-4.10.90/cmake/modules/FindSystemd.cmake.kdm_logind kde-workspace-4.10.90/cmake/modules/FindSystemd.cmake
+--- kde-workspace-4.10.90/cmake/modules/FindSystemd.cmake.kdm_logind 2013-06-27 16:27:30.200895065 -0500
++++ kde-workspace-4.10.90/cmake/modules/FindSystemd.cmake 2013-06-27 16:27:30.200895065 -0500
+@@ -0,0 +1,39 @@
++# Finds systemd and its libraries
++# Not a huge module but sufficient for now
++# Uses the same semantics as pkg_check_modules, i.e. ${LIB}{_FOUND,_INCLUDE_DIR,_LIBRARIES}
++# where ${LIB} can be one of the following:
++# LIBSYSTEMD_JOURNAL, SYSTEMD, LIBSYSTEMD_DAEMON, LIBSYSTEMD_LOGIN, LIBSYSTEMD_ID128
++#
++# Copyright: Red Hat, Inc. 2013
++# Author: Martin Briza <mbriza@redhat.com>
++#
++# Distributed under the BSD license. See COPYING-CMAKE-SCRIPTS for details.
++
++#defining any of these disables systemd support
++if (NOT LIBSYSTEMD_JOURNAL_FOUND AND
++ NOT SYSTEMD_FOUND AND
++ NOT LIBSYSTEMD_DAEMON_FOUND AND
++ NOT LIBSYSTEMD_LOGIN_FOUND AND
++ NOT LIBSYSTEMD_ID128_FOUND)
++find_package(PkgConfig)
++if (PKG_CONFIG_FOUND)
++ pkg_check_modules(LIBSYSTEMD_JOURNAL QUIET "libsystemd-journal")
++ pkg_check_modules(SYSTEMD QUIET "systemd")
++ pkg_check_modules(LIBSYSTEMD_DAEMON QUIET "libsystemd-daemon")
++ pkg_check_modules(LIBSYSTEMD_LOGIN QUIET "libsystemd-login")
++ pkg_check_modules(LIBSYSTEMD_ID128 QUIET "libsystemd-id128")
++endif (PKG_CONFIG_FOUND)
++
++if (SYSTEMD_FOUND)
++ message(STATUS "Found systemd")
++endif(SYSTEMD_FOUND)
++
++mark_as_advanced(LIBSYSTEMD_JOURNAL_FOUND SYSTEMD_FOUND LIBSYSTEMD_DAEMON_FOUND LIBSYSTEMD_LOGIN_FOUND LIBSYSTEMD_ID128_FOUND)
++mark_as_advanced(LIBSYSTEMD_JOURNAL_INCLUDE_DIR SYSTEMD_INCLUDE_DIR LIBSYSTEMD_DAEMON_INCLUDE_DIR LIBSYSTEMD_LOGIN_INCLUDE_DIR LIBSYSTEMD_ID128_INCLUDE_DIR)
++mark_as_advanced(LIBSYSTEMD_JOURNAL_LIBRARIES SYSTEMD_LIBRARIES LIBSYSTEMD_DAEMON_LIBRARIES LIBSYSTEMD_LOGIN_LIBRARIES LIBSYSTEMD_ID128_LIBRARIES)
++
++endif (NOT LIBSYSTEMD_JOURNAL_FOUND AND
++ NOT SYSTEMD_FOUND AND
++ NOT LIBSYSTEMD_DAEMON_FOUND AND
++ NOT LIBSYSTEMD_LOGIN_FOUND AND
++ NOT LIBSYSTEMD_ID128_FOUND)
+diff -up kde-workspace-4.10.90/kdm/backend/CMakeLists.txt.kdm_logind kde-workspace-4.10.90/kdm/backend/CMakeLists.txt
+--- kde-workspace-4.10.90/kdm/backend/CMakeLists.txt.kdm_logind 2013-05-28 13:38:21.000000000 -0500
++++ kde-workspace-4.10.90/kdm/backend/CMakeLists.txt 2013-06-27 16:27:30.201895054 -0500
+@@ -45,6 +45,10 @@ if (SECURE_RPC)
+ rpcauth.c
+ )
+ endif (SECURE_RPC)
++if(LIBSYSTEMD_LOGIN_FOUND AND LIBSYSTEMD_DAEMON_FOUND)
++ add_definitions( -DWITH_SYSTEMD=1 )
++ set(KDM_SYSTEMD_LIBRARIES ${LIBSYSTEMD_DAEMON_LIBRARIES} ${LIBSYSTEMD_LOGIN_LIBRARIES} )
++endif(LIBSYSTEMD_LOGIN_FOUND AND LIBSYSTEMD_DAEMON_FOUND)
+ macro_add_file_dependencies(dm.h ${confci})
+ macro_add_file_dependencies(error.c ${CMAKE_CURRENT_SOURCE_DIR}/printf.c)
+ kde4_add_executable(kdm NOGUI ${kdm_SRCS})
+@@ -60,6 +64,7 @@ target_link_libraries( kdm
+ ${NSL_LIBRARIES}
+ ${RESOLV_LIBRARIES}
+ ${SOCKET_LIBRARIES}
++ ${KDM_SYSTEMD_LIBRARIES}
+ )
+ if (CKCONNECTOR_FOUND)
+ include_directories(${CKCONNECTOR_INCLUDE_DIR} ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
+diff -up kde-workspace-4.10.90/kdm/backend/dm.c.kdm_logind kde-workspace-4.10.90/kdm/backend/dm.c
+--- kde-workspace-4.10.90/kdm/backend/dm.c.kdm_logind 2013-06-27 16:27:30.184895241 -0500
++++ kde-workspace-4.10.90/kdm/backend/dm.c 2013-06-27 16:27:30.201895054 -0500
+@@ -50,6 +50,23 @@ from the copyright holder.
+ # include <sys/vt.h>
+ #endif
+
++#ifdef WITH_SYSTEMD
++# include <systemd/sd-login.h>
++# include <systemd/sd-daemon.h>
++
++#define SYSTEMD_FAILURE_LIMIT 25
++
++ static int systemdMonitorInit(void);
++ static void systemdMonitorDeinit();
++ static int systemdStartDisplay(char *);
++ static void systemdCheckAdded(char **);
++ static void systemdCheckRemoved(char **);
++ static void systemdHandleChange();
++
++ sd_login_monitor *systemd_monitor = NULL;
++ int systemd_monitor_fd = -1;
++#endif
++
+ static void sigHandler(int n);
+ static int scanConfigs(int force);
+ static void startDisplay(struct display *d);
+@@ -308,7 +325,16 @@ main(int argc, char **argv)
+ #ifdef XDMCP
+ updateListenSockets();
+ #endif
++
++#ifdef WITH_SYSTEMD
++ if (systemdMonitorInit())
++ systemdHandleChange();
++#endif
++
+ mainLoop();
++#ifdef WITH_SYSTEMD
++ systemdMonitorDeinit();
++#endif
+ closeCtrl(0);
+ if (sdRec.how) {
+ int pid;
+@@ -1280,6 +1306,14 @@ mainLoop(void)
+ }
+ continue;
+ }
++ logError("STARTING");
++#ifdef WITH_SYSTEMD
++ if (systemd_monitor_fd >= 0 && FD_ISSET(systemd_monitor_fd, &reads)) {
++ systemdHandleChange();
++ sd_login_monitor_flush(systemd_monitor);
++ continue;
++ }
++#endif
+ #ifdef XDMCP
+ if (processListenSockets(&reads))
+ continue;
+@@ -1304,6 +1338,151 @@ mainLoop(void)
+ }
+ }
+
++#ifdef WITH_SYSTEMD
++static int
++systemdMonitorInit(void)
++{
++ if (access("/run/systemd/seats/", F_OK) < 0) {
++ logError("Didn't boot with systemd, automatic multiseat won't be enabled\n");
++ return False;
++ }
++
++ int check = sd_login_monitor_new("seat", &systemd_monitor);
++ if (check < 0) {
++ logError("Can't get systemd monitor: %d, automatic multiseat won't be enabled\n", check);
++ return False;
++ }
++
++ systemd_monitor_fd = sd_login_monitor_get_fd(systemd_monitor);
++ if (systemd_monitor_fd < 0) {
++ logError("Can't retrieve file descriptor from the systemd monitor: %d, automatic multiseat won't be enabled\n", systemd_monitor_fd);
++ sd_login_monitor_unref(systemd_monitor);
++ systemd_monitor_fd = -1;
++ return False;
++ }
++
++ registerInput(systemd_monitor_fd);
++ return True;
++}
++
++static void
++systemdMonitorDeinit(void)
++{
++ if (systemd_monitor) {
++ sd_login_monitor_unref(systemd_monitor);
++ }
++ systemd_monitor_fd = -1;
++}
++
++static int
++systemdStartDisplay(char *seat)
++{
++ struct display *link = NULL;
++ for (link = displays; link; link = link-> next) {
++ if (link->status == reserve)
++ break;
++ }
++ if (!link) {
++ logError("There's not enough reserve displays for all your seats/sessions");
++ return False;
++ }
++ if (!strDup((&link->systemd_seat), seat)) {
++ return False;
++ }
++#ifdef HAVE_VTS
++ link->serverVT = 0;
++#endif
++ link->status = notRunning;
++ link->stillThere = True;
++ link->authorize = True;
++ link->displayType = dLocal | dPermanent;
++ link->reqSrvVT = -1;
++ link->serverPid = -1;
++ return True;
++}
++
++static void
++systemdCheckAdded(char **seat_names)
++{
++ char **iter_name;
++ struct display *link;
++ for (iter_name = seat_names; *iter_name; iter_name++) {
++ if (strcmp(*iter_name, "seat0") == 0)
++ continue; /* ignore the main seat */
++ int can_graphical = sd_seat_can_graphical(*iter_name);
++ for (link = displays; link; link = link->next) {
++ if (!link->systemd_seat)
++ continue;
++ /* see if the can_graphical property didn't change */
++ if (strcmp(*iter_name, link->systemd_seat) == 0) {
++ if (!can_graphical) {
++ free(link->systemd_seat);
++ link->systemd_seat = NULL;
++ rStopDisplay(link, DS_RESERVE);
++ }
++ break;
++ }
++ }
++ /* the display wasn't found */
++ if (!link) {
++ if (can_graphical) {
++ /* if starting the display failed, skip this round until the next change */
++ if (!systemdStartDisplay(*iter_name))
++ break;
++ }
++ }
++ }
++}
++
++static void
++systemdCheckRemoved(char **seat_names)
++{
++ char **iter_name;
++ struct display *link;
++ for (link = displays; link; link = link->next) {
++ for (iter_name = seat_names; *iter_name; iter_name++) {
++ if (strcmp(*iter_name, "seat0") == 0)
++ continue; /* ignore the main seat */
++ if (link->systemd_seat && strcmp(*iter_name, link->systemd_seat) == 0)
++ break;
++ }
++ if (!(*iter_name) && link->systemd_seat) { /* was not found, stop this one */
++ free(link->systemd_seat);
++ link->systemd_seat = NULL;
++ rStopDisplay(link, DS_RESERVE);
++ }
++ }
++}
++
++static void
++systemdHandleChange(void)
++{
++ static int failures = 0;
++ char **seat_names;
++ char **iter_name;
++ int check;
++ if ((check = sd_get_seats(&seat_names)) < 0) {
++ logError("Can't obtain systemd seats, error %d\n", -check);
++ failures++;
++ if (failures >= SYSTEMD_FAILURE_LIMIT) {
++ logError("%u failed calls to sd_get_seats, disabling systemd multi-seat support\n", SYSTEMD_FAILURE_LIMIT);
++ systemdMonitorDeinit();
++ }
++ return;
++ }
++
++ if (!check)
++ return;
++
++ systemdCheckAdded(seat_names);
++ systemdCheckRemoved(seat_names);
++
++ for (iter_name = seat_names; *iter_name; iter_name++)
++ free(*iter_name);
++ free(seat_names);
++}
++#endif
++
+ static void
+ checkDisplayStatus(struct display *d)
+ {
+diff -up kde-workspace-4.10.90/kdm/backend/dm.h.kdm_logind kde-workspace-4.10.90/kdm/backend/dm.h
+--- kde-workspace-4.10.90/kdm/backend/dm.h.kdm_logind 2013-06-27 16:27:30.184895241 -0500
++++ kde-workspace-4.10.90/kdm/backend/dm.h 2013-06-27 16:27:30.201895054 -0500
+@@ -306,6 +306,9 @@ struct display {
+ char *greeterAuthFile; /* file to store authorization for greeter in */
+
+ int plymouth_is_running; /* Plymouth's status */
++#ifdef WITH_SYSTEMD
++ char *systemd_seat;
++#endif
+ };
+
+ #define d_location 1
+diff -up kde-workspace-4.10.90/kdm/backend/server.c.kdm_logind kde-workspace-4.10.90/kdm/backend/server.c
+--- kde-workspace-4.10.90/kdm/backend/server.c.kdm_logind 2013-06-27 16:27:30.184895241 -0500
++++ kde-workspace-4.10.90/kdm/backend/server.c 2013-06-27 16:27:30.201895054 -0500
+@@ -43,6 +43,7 @@ from the copyright holder.
+ #include <stdio.h>
+ #include <signal.h>
+
++#define SYSTEMD_X_WRAPPER "/lib/systemd/systemd-multi-seat-x"
+
+ struct display *startingServer;
+ time_t serverTimeout = TO_INF;
+@@ -55,9 +56,18 @@ prepareServerArgv(struct display *d, con
+ char vtstr[8];
+ #endif
+
+- if (!(argv = parseArgs(0, d->serverCmd)) ||
+- !(argv = addStrArr(argv, d->name, -1)))
++#if WITH_SYSTEMD
++ FILE *tmpFile = NULL;
++ if ((tmpFile = fopen(SYSTEMD_X_WRAPPER, "rb")) != NULL && fclose(tmpFile) == 0) {
++ if (!(argv = parseArgs(0, SYSTEMD_X_WRAPPER)) || !(argv = addStrArr(argv, d->name, -1))) {
++ exit(47);
++ }
++ }
++ else
++#endif
++ if (!(argv = parseArgs(0, d->serverCmd)) || !(argv = addStrArr(argv, d->name, -1))) {
+ exit(47);
++ }
+ #ifdef HAVE_VTS
+ if (d->serverVT &&
+ !(argv = addStrArr(argv, vtstr,
+@@ -70,6 +80,25 @@ prepareServerArgv(struct display *d, con
+ if (!changeUser(d->serverUID, d->authFile))
+ exit(47);
+
++#ifdef WITH_SYSTEMD
++ if (d->systemd_seat) {
++ if (!(argv = parseArgs(argv, "-seat")))
++ exit(47);
++ if (!(argv = parseArgs(argv, d->systemd_seat)))
++ exit(47);
++ if (!(argv = parseArgs(argv, "-layout")))
++ exit(47);
++ if (!(argv = parseArgs(argv, d->systemd_seat)))
++ exit(47);
++ }
++ else {
++ if (!(argv = parseArgs(argv, "-seat")))
++ exit(47);
++ if (!(argv = parseArgs(argv, "seat0")))
++ exit(47);
++ }
++#endif
++
+ return argv;
+ }
+
+--- kde-workspace-4.10.2/kdm/backend/client.c.kdm_logind
++++ kde-workspace-4.10.2/kdm/backend/client.c
+@@ -1461,6 +1461,14 @@ startClient(volatile int *pid)
+ #endif
+ userEnviron = inheritEnv(env, envvars);
+ env = systemEnv(0, curuser);
++#ifdef WITH_SYSTEMD
++ if (td->systemd_seat) {
++ char *envbuf;
++ ASPrintf(&envbuf, "XDG_SEAT=%s", td->systemd_seat);
++ pam_putenv(pamh, envbuf);
++ env = setEnv(env, "XDG_SEAT", td->systemd_seat);
++ }
++#endif
+ systemEnviron = setEnv(env, "HOME", p->pw_dir);
+ debug("user environment:\n%[|''>'\n's"
+ "system environment:\n%[|''>'\n's"
+--- kde-workspace-4.10.2/kdm/backend/session.c.kdm_logind
++++ kde-workspace-4.10.2/kdm/backend/session.c
+@@ -437,6 +437,10 @@ openGreeter()
+
+ grttalk.pipe = &grtproc.pipe;
+ env = systemEnv(dupEnv(), 0);
++#ifdef WITH_SYSTEMD
++ if (td->systemd_seat)
++ env = setEnv(env, "XDG_SEAT", td->systemd_seat);
++#endif
+ if (gOpen(&grtproc, (char **)0, "_greet", env, name,
+ greeterUID, td->greeterAuthFile, &td->gpipe))
+ sessionExit(EX_UNMANAGE_DPY);
diff --git a/kde-base/kdm/files/kde-workspace-4.8.0-bug796969.patch b/kde-base/kdm/files/kde-workspace-4.8.0-bug796969.patch
new file mode 100644
index 00000000..16e29388
--- /dev/null
+++ b/kde-base/kdm/files/kde-workspace-4.8.0-bug796969.patch
@@ -0,0 +1,37 @@
+per https://bugzilla.redhat.com/show_bug.cgi?id=796969#c23
+The process that executes kdm/backend/session.c:manageSession() is the leader
+process of the logind session.
+
+manageSession() calls:
+
+ blockTerm();
+ clientExited();
+ unblockTerm();
+
+where clientExited() ends the PAM session.
+With the current systemd-logind, ending the PAM session will cause the leader
+process to be delivered SIGHUP and SIGTERM. The process will die and the
+remainder of manageSession() will not be executed.
+
+Interestingly, at the end of the function there's a call to sessionExit(),
+which calls clientExited() again.
+
+Removing the three lines quoted above makes reboot from KDE work again. I
+haven't noticed any bad effects.
+
+diff -up kde-workspace-4.8.0/kdm/backend/session.c.bz796969 kde-workspace-4.8.0/kdm/backend/session.c
+--- kde-workspace-4.8.0/kdm/backend/session.c.bz796969 2012-01-18 14:08:40.000000000 -0600
++++ kde-workspace-4.8.0/kdm/backend/session.c 2012-02-28 07:17:16.270219932 -0600
+@@ -662,9 +662,9 @@ manageSession(void)
+ sessionExit(EX_AL_RESERVER_DPY);
+ }
+
+- blockTerm();
+- clientExited();
+- unblockTerm();
++ /* blockTerm(); */
++ /* clientExited(); */
++ /* unblockTerm(); */
+
+ gSet(&mstrtalk);
+ gSendInt(D_UnUser);
diff --git a/kde-base/kdm/files/kdebase-workspace-4.4.92-kdm_plymouth081.patch b/kde-base/kdm/files/kdebase-workspace-4.4.92-kdm_plymouth081.patch
new file mode 100644
index 00000000..2c49ccd4
--- /dev/null
+++ b/kde-base/kdm/files/kdebase-workspace-4.4.92-kdm_plymouth081.patch
@@ -0,0 +1,165 @@
+diff -up kdebase-workspace-4.4.92/kdm/backend/dm.c.kdm_plymouth kdebase-workspace-4.4.92/kdm/backend/dm.c
+--- kdebase-workspace-4.4.92/kdm/backend/dm.c.kdm_plymouth 2010-07-06 01:54:30.000000000 -0500
++++ kdebase-workspace-4.4.92/kdm/backend/dm.c 2010-07-07 13:55:48.425171749 -0500
+@@ -1329,6 +1329,81 @@ getBusyVTs(void)
+ return activeVTs;
+ }
+
++static int
++get_active_vt (void)
++{
++ int console_fd;
++ struct vt_stat console_state = { 0 };
++ console_fd = open ("/dev/tty0", O_RDONLY | O_NOCTTY);
++ if (console_fd < 0) {
++ goto out;
++ }
++ if (ioctl (console_fd, VT_GETSTATE, &console_state) < 0) {
++ goto out;
++ }
++out:
++ if (console_fd >= 0) {
++ close (console_fd);
++ }
++ return console_state.v_active;
++}
++
++static int
++plymouth_is_running (void)
++{
++ int status;
++ status = system ("/bin/plymouth --ping");
++
++ return WIFEXITED (status) && WEXITSTATUS (status) == 0;
++}
++
++static int
++plymouth_has_active_vt (void)
++{
++ int status;
++ status = system ("/bin/plymouth --has-active-vt");
++
++ return WIFEXITED (status) && WEXITSTATUS (status) == 0;
++}
++
++static int
++plymouth_prepare_for_transition (void)
++{
++ int status;
++ status = system ("/bin/plymouth deactivate");
++
++ return WIFEXITED (status) && WEXITSTATUS (status) == 0;
++}
++
++int
++plymouth_quit_with_transition (void)
++{
++ int status;
++ status = system ("/bin/plymouth quit --retain-splash");
++
++ return WIFEXITED (status) && WEXITSTATUS (status) == 0;
++}
++
++static int
++plymouth_quit_without_transition (void)
++{
++ int status;
++ status = system ("/bin/plymouth quit");
++
++ return WIFEXITED (status) && WEXITSTATUS (status) == 0;
++}
++
++static int
++triggered_to_force_display_on_active_vt (void)
++{
++ int should_force_display_on_active_vt;
++ should_force_display_on_active_vt=open("/var/spool/gdm/force-display-on-active-vt", O_RDONLY);
++ if ( should_force_display_on_active_vt >= 0 )
++ close(should_force_display_on_active_vt);
++ unlink("/var/spool/gdm/force-display-on-active-vt");
++ return should_force_display_on_active_vt;
++}
++
+ static void
+ allocateVT(struct display *d)
+ {
+@@ -1338,6 +1413,43 @@ allocateVT(struct display *d)
+ if ((d->displayType & d_location) == dLocal &&
+ d->status == notRunning && !d->serverVT && d->reqSrvVT >= 0)
+ {
++ /* check for plymouth using newer methods */
++ d->plymouth_is_running = plymouth_is_running ();
++ if (d->plymouth_is_running) {
++ /* call plymouth deactivate */
++ plymouth_prepare_for_transition ();
++ if (plymouth_has_active_vt ()) {
++ /* plymouth was displaying a splash screen and has
++ * terminated leaving it on screen
++ */
++ int vt;
++ vt = get_active_vt ();
++ if (vt > 0) {
++ /* start the X server on the active vt */
++ d->serverVT = vt;
++ return;
++ }
++ }
++ else {
++ /* plymouth might have been running but did not display
++ * a splash screen.
++ */
++
++ /* call plymouth quit and start the X server as usual */
++ d->plymouth_is_running = !plymouth_quit_without_transition ();
++ }
++
++ /* fallback to old/deprecated method */
++ } else if ( triggered_to_force_display_on_active_vt() >= 0 ) {
++ int vt;
++ vt = get_active_vt();
++ if (vt > 0) {
++ d->serverVT = vt;
++ return;
++ }
++ }
++
++
+ if (d->reqSrvVT && d->reqSrvVT < 16) {
+ d->serverVT = d->reqSrvVT;
+ } else {
+diff -up kdebase-workspace-4.4.92/kdm/backend/dm.h.kdm_plymouth kdebase-workspace-4.4.92/kdm/backend/dm.h
+--- kdebase-workspace-4.4.92/kdm/backend/dm.h.kdm_plymouth 2010-07-06 01:54:30.000000000 -0500
++++ kdebase-workspace-4.4.92/kdm/backend/dm.h 2010-07-07 13:48:11.874921158 -0500
+@@ -292,6 +292,8 @@ struct display {
+ int authNum; /* number of authorizations */
+ char *authFile; /* file to store authorization in */
+ char *greeterAuthFile; /* file to store authorization for greeter in */
++
++ int plymouth_is_running; /* Plymouth's status */
+ };
+
+ #define d_location 1
+@@ -404,6 +406,8 @@ int anyDisplaysLeft(void);
+ void forEachDisplay(void (*f)(struct display *));
+ #ifdef HAVE_VTS
+ void forEachDisplayRev(void (*f)(struct display *));
++/* function for plymouth */
++int plymouth_quit_with_transition (void);
+ #endif
+ void removeDisplay(struct display *old);
+ struct display
+diff -up kdebase-workspace-4.4.92/kdm/backend/server.c.kdm_plymouth kdebase-workspace-4.4.92/kdm/backend/server.c
+--- kdebase-workspace-4.4.92/kdm/backend/server.c.kdm_plymouth 2010-07-06 01:54:30.000000000 -0500
++++ kdebase-workspace-4.4.92/kdm/backend/server.c 2010-07-07 13:56:46.960921366 -0500
+@@ -137,6 +137,11 @@ startServerSuccess()
+ struct display *d = startingServer;
+ d->serverStatus = ignore;
+ serverTimeout = TO_INF;
++ if (d->plymouth_is_running) {
++ debug( "Quitting Plymouth with transition\n" );
++ d->plymouth_is_running = !plymouth_quit_with_transition ();
++ debug ("Is Plymouth still running? %s\n", d->plymouth_is_running ? "yes" : "no");
++ }
+ debug("X server ready, starting session\n");
+ startDisplayP2(d);
+ }
diff --git a/kde-base/kdm/files/kdm-4-gentoo-xinitrc.d.patch b/kde-base/kdm/files/kdm-4-gentoo-xinitrc.d.patch
new file mode 100644
index 00000000..538363af
--- /dev/null
+++ b/kde-base/kdm/files/kdm-4-gentoo-xinitrc.d.patch
@@ -0,0 +1,19 @@
+diff -Nurp kdm-4.3.1.orig/kdm/kfrontend/genkdmconf.c kdm-4.3.1/kdm/kfrontend/genkdmconf.c
+--- kdm-4.3.1.orig/kdm/kfrontend/genkdmconf.c 2009-09-20 07:57:19.746730568 +0200
++++ kdm-4.3.1/kdm/kfrontend/genkdmconf.c 2009-09-20 08:01:17.767496412 +0200
+@@ -687,6 +687,15 @@ static const char def_session2[] =
+ "[ -f /etc/xprofile ] && . /etc/xprofile\n"
+ "[ -f $HOME/.xprofile ] && . $HOME/.xprofile\n"
+ "\n"
++"# run all system xinitrc shell scripts.\n"
++"if [ -d /etc/X11/xinit/xinitrc.d ]; then\n"
++" for i in /etc/X11/xinit/xinitrc.d/* ; do\n"
++" if [ -x \"$i\" ]; then\n"
++" . \"$i\"\n"
++" fi\n"
++" done\n"
++"fi\n"
++"\n"
+ "case $session in\n"
+ " \"\")\n"
+ " exec xmessage -center -buttons OK:0 -default OK \"Sorry, $DESKTOP_SESSION is no valid session.\"\n"
diff --git a/kde-base/kdm/files/kdm-logrotate b/kde-base/kdm/files/kdm-logrotate
new file mode 100644
index 00000000..4bce1a03
--- /dev/null
+++ b/kde-base/kdm/files/kdm-logrotate
@@ -0,0 +1,8 @@
+/var/log/kdm.log {
+ maxage 365
+ size=+1024k
+ notifempty
+ missingok
+ compress
+ copytruncate
+}
diff --git a/kde-base/kdm/files/kdm.service b/kde-base/kdm/files/kdm.service
new file mode 100644
index 00000000..e9132882
--- /dev/null
+++ b/kde-base/kdm/files/kdm.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=KDM Display Manager
+After=systemd-user-sessions.service
+
+[Service]
+ExecStart=/usr/bin/kdm -nodaemon
+
+[Install]
+Alias=display-manager.service
diff --git a/kde-base/kdm/kdm-4.11.5.ebuild b/kde-base/kdm/kdm-4.11.5.ebuild
new file mode 100644
index 00000000..31dcebca
--- /dev/null
+++ b/kde-base/kdm/kdm-4.11.5.ebuild
@@ -0,0 +1,164 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+KDE_HANDBOOK="optional"
+KMNAME="kde-workspace"
+inherit systemd kde4-meta flag-o-matic user
+
+DESCRIPTION="KDE login manager, similar to xdm and gdm"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="debug +consolekit kerberos logind pam"
+
+DEPEND="
+ $(add_kdebase_dep libkworkspace)
+ media-libs/qimageblitz
+ x11-libs/libX11
+ x11-libs/libXau
+ x11-libs/libXdmcp
+ x11-libs/libXtst
+ consolekit? (
+ >=sys-apps/dbus-1.0.2
+ sys-auth/consolekit
+ )
+ kerberos? ( virtual/krb5 )
+ pam? (
+ $(add_kdebase_dep kcheckpass)
+ virtual/pam
+ )
+"
+RDEPEND="${DEPEND}
+ $(add_kdebase_dep kdepasswd)
+ >=x11-apps/xinit-1.0.5-r2
+ x11-apps/xmessage
+"
+
+KMEXTRA="
+ libs/kdm/
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-4-gentoo-xinitrc.d.patch"
+ "${FILESDIR}/kdebase-workspace-4.4.92-kdm_plymouth081.patch"
+ "${FILESDIR}/kde-workspace-4.10.90-kdm-logind-multiseat.patch"
+ "${FILESDIR}/kde-workspace-4.8.0-bug796969.patch"
+)
+
+pkg_setup() {
+ kde4-meta_pkg_setup
+
+ # Create kdm:kdm user
+ KDM_HOME=/var/lib/kdm
+ enewgroup kdm
+ enewuser kdm -1 -1 "${KDM_HOME}" kdm
+}
+
+src_configure() {
+ mycmakeargs=(
+ $(cmake-utils_use kerberos KDE4_KRB5AUTH)
+ $(cmake-utils_use_with pam)
+ $(cmake-utils_use_with consolekit CkConnector)
+ )
+
+ kde4-meta_src_configure
+}
+
+src_install() {
+ export GENKDMCONF_FLAGS="--no-old --no-backup"
+
+ kde4-meta_src_install
+
+ # an equivalent file is already installed by kde-base/startkde, bug 377151
+ rm "${ED}/usr/share/apps/kdm/sessions/kde-plasma.desktop" || die
+
+ # Customize the kdmrc configuration:
+ # - SessionDirs set to /usr/share/xsessions
+ # - increase server timeout to 30s
+ # - TerminateServer=true to workaround X server regen bug, bug 278473
+ # - DataDir set to /var/lib/kdm
+ # - FaceDir set to /var/lib/kdm/faces
+ sed -e "s|^.*SessionsDirs=.*$|#&\nSessionsDirs=${EPREFIX}/usr/share/apps/kdm/sessions,${EPREFIX}/usr/share/xsessions|" \
+ -e "/#ServerTimeout=/s/^.*$/ServerTimeout=30/" \
+ -e "/#TerminateServer=/s/^.*$/TerminateServer=true/" \
+ -e "s|^.*DataDir=.*$|#&\nDataDir=${EPREFIX}${KDM_HOME}|" \
+ -e "s|^.*FaceDir=.*$|#&\nFaceDir=${EPREFIX}${KDM_HOME}/faces|" \
+ -e "s|themes/elarun$|themes/sabayon|" \
+ -i "${ED}"/usr/share/config/kdm/kdmrc \
+ || die "Failed to set ServerTimeout and SessionsDirs correctly in kdmrc."
+
+ # Don't install empty dir
+ rmdir "${ED}"/usr/share/config/kdm/sessions
+
+ # Set up permissions to kdm work directory
+ keepdir "${KDM_HOME}"
+ fowners root:kdm "${KDM_HOME}"
+ fperms 1770 "${KDM_HOME}"
+
+ # install logrotate file
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/kdm-logrotate kdm
+
+ systemd_dounit "${FILESDIR}"/kdm.service
+}
+
+pkg_postinst() {
+ kde4-meta_pkg_postinst
+
+ local file src dest dir old_dirs=(
+ /var/lib/kdm-live
+ /var/lib/kdm-4.6
+ /var/lib/kdm-4.5
+ /var/lib/kdm-4.4
+ /usr/share/apps/kdm
+ /usr/kde/4.4/share/apps/kdm
+ /usr/kde/4.3/share/apps/kdm
+ /usr/kde/4.2/share/apps/kdm
+ )
+
+ mkdir -p "${EROOT}${KDM_HOME}/faces"
+ # Set the default kdm face icon if it's not already set by the system admin
+ # because this is user-overrideable in that way, it's not in src_install
+ for file in faces/.default.face.icon:default1.png faces/root.face.icon:root1.png kdmsts: ; do
+ src=${file#*:}
+ dest=${file%:*}
+ if [[ ! -e ${EROOT}${KDM_HOME}/$dest ]]; then
+ for dir in "${old_dirs[@]}"; do
+ if [[ -e ${EROOT}${dir}/${dest} ]]; then
+ cp "${EROOT}${dir}/${dest}" "${EROOT}${KDM_HOME}/${dest}"
+ break 2
+ fi
+ done
+ if [[ -n ${src} ]]; then
+ cp "${EROOT}/usr/share/apps/kdm/pics/users/${src}" \
+ "${EROOT}${KDM_HOME}/${dest}"
+ fi
+ fi
+ done
+ for dir in "${old_dirs[@]}"; do
+ if [[ ${dir} != /usr/* && -d ${EROOT}${dir} ]]; then
+ echo
+ elog "The directory ${EROOT%/}${dir} still exists from an older installation of KDE."
+ elog "You may wish to copy relevant settings into ${EROOT%/}${KDM_HOME}."
+ echo
+ elog "After doing so, you may delete the directory."
+ echo
+ fi
+ done
+
+ # Make sure permissions are correct -- old installations may have
+ # gotten this wrong
+ use prefix || chown root:kdm "${EROOT}${KDM_HOME}"
+ chmod 1770 "${EROOT}${KDM_HOME}"
+
+ # kdm 4.10 and logind have troubles if xdm is in the boot runlevel
+ if ! use consolekit && use logind; then
+ local xdm_boot="${EROOT}/etc/runlevels/boot/xdm"
+ local xdm_default="${EROOT}/etc/runlevels/default/xdm"
+ if [ -e "${xdm_boot}" ]; then
+ einfo "Moving xdm from boot runlevel to default (due to logind)"
+ mv "${xdm_boot}" "${xdm_default}" || die
+ fi
+ fi
+}
diff --git a/kde-base/kdm/kdm-4.11.6.ebuild b/kde-base/kdm/kdm-4.11.6.ebuild
new file mode 100644
index 00000000..31dcebca
--- /dev/null
+++ b/kde-base/kdm/kdm-4.11.6.ebuild
@@ -0,0 +1,164 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+KDE_HANDBOOK="optional"
+KMNAME="kde-workspace"
+inherit systemd kde4-meta flag-o-matic user
+
+DESCRIPTION="KDE login manager, similar to xdm and gdm"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="debug +consolekit kerberos logind pam"
+
+DEPEND="
+ $(add_kdebase_dep libkworkspace)
+ media-libs/qimageblitz
+ x11-libs/libX11
+ x11-libs/libXau
+ x11-libs/libXdmcp
+ x11-libs/libXtst
+ consolekit? (
+ >=sys-apps/dbus-1.0.2
+ sys-auth/consolekit
+ )
+ kerberos? ( virtual/krb5 )
+ pam? (
+ $(add_kdebase_dep kcheckpass)
+ virtual/pam
+ )
+"
+RDEPEND="${DEPEND}
+ $(add_kdebase_dep kdepasswd)
+ >=x11-apps/xinit-1.0.5-r2
+ x11-apps/xmessage
+"
+
+KMEXTRA="
+ libs/kdm/
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-4-gentoo-xinitrc.d.patch"
+ "${FILESDIR}/kdebase-workspace-4.4.92-kdm_plymouth081.patch"
+ "${FILESDIR}/kde-workspace-4.10.90-kdm-logind-multiseat.patch"
+ "${FILESDIR}/kde-workspace-4.8.0-bug796969.patch"
+)
+
+pkg_setup() {
+ kde4-meta_pkg_setup
+
+ # Create kdm:kdm user
+ KDM_HOME=/var/lib/kdm
+ enewgroup kdm
+ enewuser kdm -1 -1 "${KDM_HOME}" kdm
+}
+
+src_configure() {
+ mycmakeargs=(
+ $(cmake-utils_use kerberos KDE4_KRB5AUTH)
+ $(cmake-utils_use_with pam)
+ $(cmake-utils_use_with consolekit CkConnector)
+ )
+
+ kde4-meta_src_configure
+}
+
+src_install() {
+ export GENKDMCONF_FLAGS="--no-old --no-backup"
+
+ kde4-meta_src_install
+
+ # an equivalent file is already installed by kde-base/startkde, bug 377151
+ rm "${ED}/usr/share/apps/kdm/sessions/kde-plasma.desktop" || die
+
+ # Customize the kdmrc configuration:
+ # - SessionDirs set to /usr/share/xsessions
+ # - increase server timeout to 30s
+ # - TerminateServer=true to workaround X server regen bug, bug 278473
+ # - DataDir set to /var/lib/kdm
+ # - FaceDir set to /var/lib/kdm/faces
+ sed -e "s|^.*SessionsDirs=.*$|#&\nSessionsDirs=${EPREFIX}/usr/share/apps/kdm/sessions,${EPREFIX}/usr/share/xsessions|" \
+ -e "/#ServerTimeout=/s/^.*$/ServerTimeout=30/" \
+ -e "/#TerminateServer=/s/^.*$/TerminateServer=true/" \
+ -e "s|^.*DataDir=.*$|#&\nDataDir=${EPREFIX}${KDM_HOME}|" \
+ -e "s|^.*FaceDir=.*$|#&\nFaceDir=${EPREFIX}${KDM_HOME}/faces|" \
+ -e "s|themes/elarun$|themes/sabayon|" \
+ -i "${ED}"/usr/share/config/kdm/kdmrc \
+ || die "Failed to set ServerTimeout and SessionsDirs correctly in kdmrc."
+
+ # Don't install empty dir
+ rmdir "${ED}"/usr/share/config/kdm/sessions
+
+ # Set up permissions to kdm work directory
+ keepdir "${KDM_HOME}"
+ fowners root:kdm "${KDM_HOME}"
+ fperms 1770 "${KDM_HOME}"
+
+ # install logrotate file
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/kdm-logrotate kdm
+
+ systemd_dounit "${FILESDIR}"/kdm.service
+}
+
+pkg_postinst() {
+ kde4-meta_pkg_postinst
+
+ local file src dest dir old_dirs=(
+ /var/lib/kdm-live
+ /var/lib/kdm-4.6
+ /var/lib/kdm-4.5
+ /var/lib/kdm-4.4
+ /usr/share/apps/kdm
+ /usr/kde/4.4/share/apps/kdm
+ /usr/kde/4.3/share/apps/kdm
+ /usr/kde/4.2/share/apps/kdm
+ )
+
+ mkdir -p "${EROOT}${KDM_HOME}/faces"
+ # Set the default kdm face icon if it's not already set by the system admin
+ # because this is user-overrideable in that way, it's not in src_install
+ for file in faces/.default.face.icon:default1.png faces/root.face.icon:root1.png kdmsts: ; do
+ src=${file#*:}
+ dest=${file%:*}
+ if [[ ! -e ${EROOT}${KDM_HOME}/$dest ]]; then
+ for dir in "${old_dirs[@]}"; do
+ if [[ -e ${EROOT}${dir}/${dest} ]]; then
+ cp "${EROOT}${dir}/${dest}" "${EROOT}${KDM_HOME}/${dest}"
+ break 2
+ fi
+ done
+ if [[ -n ${src} ]]; then
+ cp "${EROOT}/usr/share/apps/kdm/pics/users/${src}" \
+ "${EROOT}${KDM_HOME}/${dest}"
+ fi
+ fi
+ done
+ for dir in "${old_dirs[@]}"; do
+ if [[ ${dir} != /usr/* && -d ${EROOT}${dir} ]]; then
+ echo
+ elog "The directory ${EROOT%/}${dir} still exists from an older installation of KDE."
+ elog "You may wish to copy relevant settings into ${EROOT%/}${KDM_HOME}."
+ echo
+ elog "After doing so, you may delete the directory."
+ echo
+ fi
+ done
+
+ # Make sure permissions are correct -- old installations may have
+ # gotten this wrong
+ use prefix || chown root:kdm "${EROOT}${KDM_HOME}"
+ chmod 1770 "${EROOT}${KDM_HOME}"
+
+ # kdm 4.10 and logind have troubles if xdm is in the boot runlevel
+ if ! use consolekit && use logind; then
+ local xdm_boot="${EROOT}/etc/runlevels/boot/xdm"
+ local xdm_default="${EROOT}/etc/runlevels/default/xdm"
+ if [ -e "${xdm_boot}" ]; then
+ einfo "Moving xdm from boot runlevel to default (due to logind)"
+ mv "${xdm_boot}" "${xdm_default}" || die
+ fi
+ fi
+}