Hi,

We discussed that extensively the last few days on #debian-systemd. We came to the conclusion that we are going to help the maintainers providing the current snippet we are using for gdm3 for jessie. It's really close be updated compared to what Agustin was proposing.

Note that on jessie+1, this snippet will be smaller and more declarative (we are going to use the Alias feature of systemd), however this needs coordination of all DMs to have the snippet running in any DM postinst, and we think that it's a little bit with the freeze to have changing existing DMs having service file accepted by the RT.

The most straightforward way is then just to handle symlinks manually and then, moving (we are going to pilot that in ubuntu vivid) to the Alias handling for jessie+1.

Here is the patch for slim, I'll add to that bug other impacted DMs and proposing patches.
Cheers,
Didier
diff -Nru slim-1.3.6/debian/changelog slim-1.3.6/debian/changelog
--- slim-1.3.6/debian/changelog 2014-04-29 13:18:36.000000000 +0200
+++ slim-1.3.6/debian/changelog 2014-11-25 16:03:47.000000000 +0100
@@ -1,3 +1,11 @@
+slim (1.3.6-4) UNRELEASED; urgency=medium
+
+  * debian/patches/fix-systemd-service.patch, debian/slim.postinst:
+    - ensure we are starting slim under systemd only when selected as
+      default. (Closes: #748668)
+
+ -- Didier Roche <didro...@ubuntu.com>  Tue, 25 Nov 2014 16:02:43 +0100
+
 slim (1.3.6-3) unstable; urgency=high
 
   * debian/patches:
diff -Nru slim-1.3.6/debian/patches/fix-systemd-service.patch 
slim-1.3.6/debian/patches/fix-systemd-service.patch
--- slim-1.3.6/debian/patches/fix-systemd-service.patch 2014-03-14 
23:01:58.000000000 +0100
+++ slim-1.3.6/debian/patches/fix-systemd-service.patch 2014-11-25 
16:02:39.000000000 +0100
@@ -1,11 +1,21 @@
-Description: Add WantedBy field to systemd slim.service
-Author: Mateusz Łukasik <mat...@linuxmint.pl>
-Bug-Debian: http://bugs.debian.org/741511
+Description: Ensure we are starting slim under systemd only when selected
+Author: Didier Roche <didro...@ubuntu.com>
+Bug-Debian: http://bugs.debian.org/748668
 
---- a/slim.service
-+++ b/slim.service
-@@ -7,3 +7,4 @@ ExecStart=/usr/bin/slim -nodaemon
+Index: slim-1.3.6/slim.service
+===================================================================
+--- slim-1.3.6.orig/slim.service
++++ slim-1.3.6/slim.service
+@@ -1,9 +1,8 @@
+ [Unit]
+ Description=SLiM Simple Login Manager
+-After=systemd-user-sessions.service
++After=systemd-user-sessions.service plymouth-quit.service
  
- [Install]
- Alias=display-manager.service
-+WantedBy=graphical.target
+ [Service]
++ExecStartPre=/bin/sh -c '[ "$(cat /etc/X11/default-display-manager 
2>/dev/null)" = "/usr/sbin/slim" ]'
+ ExecStart=/usr/bin/slim -nodaemon
+-
+-[Install]
+-Alias=display-manager.service
++Restart=always
diff -Nru slim-1.3.6/debian/slim.postinst slim-1.3.6/debian/slim.postinst
--- slim-1.3.6/debian/slim.postinst     2014-01-08 19:18:55.000000000 +0100
+++ slim-1.3.6/debian/slim.postinst     2014-11-25 16:00:51.000000000 +0100
@@ -45,6 +45,24 @@
   invoke-rc.d dbus reload || true
 fi
 
+DEFAULT_SERVICE=/etc/systemd/system/display-manager.service
+# set default-display-manager systemd service link according to our config
+if [ "$1" = configure ] && [ -d /etc/systemd/system/ ]; then
+  if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
+    SERVICE=/lib/systemd/system/$(basename $(cat 
"$DEFAULT_DISPLAY_MANAGER_FILE")).service
+    if [ -h "$DEFAULT_SERVICE" ] && [ $(readlink "$DEFAULT_SERVICE") = 
/dev/null ]; then
+      echo "Display manager service is masked" >&2
+    elif [ -e "$SERVICE" ]; then
+      ln -sf "$SERVICE" "$DEFAULT_SERVICE"
+    else
+      echo "WARNING: $SERVICE is the selected default display manager but does 
not exist" >&2
+      rm -f "$DEFAULT_SERVICE"
+    fi
+  else
+    rm -f "$DEFAULT_SERVICE"
+  fi
+fi
+
 #DEBHELPER#
 
 exit 0

Reply via email to