On lun, set 15, 2014 at 12:14:07 +0200, Agustin Martin wrote:
> Control: tag 748668 +patch

Maybe I'm missing something but your email doesn't provide any patch.

Anyway, I wrote a patch that fixes this bug (see attached) as you suggested. The
patch does:

1 Patches the systemd service file to not start unless slim is the default
  manager (as per /etc/X11/default-display-manager).
2 Removes the [Install] section in the systemd service file so that it doesn't
  take over the system on install. This also removes the WantedBy statement that
  was added as part of the fix for #741511 which is IMO wrong.
3 Creates the /etc/systemd/system/display-manager.service in postinst if slim is
  the dfault manager.

Note that 1 and 3 above actually come from the lightdm package (I only removed
the part where it reloads dbus, which is not used by slim).

I think that this patch should be included in jessie.

Cheers
From 0edf3170f060aa69248fd37164e1c415272d631c Mon Sep 17 00:00:00 2001
From: Alessandro Ghedini <alessan...@ghedini.me>
Date: Fri, 21 Nov 2014 15:44:17 +0100
Subject: [PATCH] Properly integrate with systemd

Closes: #748668
---
 debian/patches/fix-systemd-service.patch | 14 ++++++++++----
 debian/slim.postinst                     | 13 +++++++++++++
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/debian/patches/fix-systemd-service.patch b/debian/patches/fix-systemd-service.patch
index fc53dd0..d36c4bd 100644
--- a/debian/patches/fix-systemd-service.patch
+++ b/debian/patches/fix-systemd-service.patch
@@ -4,8 +4,14 @@ Bug-Debian: http://bugs.debian.org/741511
 
 --- a/slim.service
 +++ b/slim.service
-@@ -7,3 +7,4 @@ ExecStart=/usr/bin/slim -nodaemon
+@@ -3,7 +3,7 @@
+ After=systemd-user-sessions.service
  
- [Install]
- Alias=display-manager.service
-+WantedBy=graphical.target
+ [Service]
++# temporary safety check until all DMs are converted to correct
++# display-manager.service symlink handling
++ExecStartPre=/bin/sh -c '[ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/bin/slim" ]'
+ ExecStart=/usr/bin/slim -nodaemon
+-
+-[Install]
+-Alias=display-manager.service
diff --git a/debian/slim.postinst b/debian/slim.postinst
index 91a857f..cb3d51c 100644
--- a/debian/slim.postinst
+++ b/debian/slim.postinst
@@ -29,6 +29,19 @@ if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" ]; then
   rm "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
 fi
 
+if [ "$1" = "configure" ];
+then
+  # set default-display-manager systemd service link according to our config
+  if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" -a -d /etc/systemd/system/ ]; then
+    SERVICE=/lib/systemd/system/$(basename $(cat "$DEFAULT_DISPLAY_MANAGER_FILE")).service
+    if [ -e "$SERVICE" ]; then
+      ln -sf "$SERVICE" /etc/systemd/system/display-manager.service
+    else
+      echo "ERROR: $SERVICE is the selected default display manager but does not exist" >&2
+    fi
+  fi
+fi
+
 # debconf hangs if slim gets started below without this
 db_stop || true
 
-- 
2.1.3

Attachment: signature.asc
Description: Digital signature

Reply via email to