[Pkg-xfce-devel] Bug#733220: Add systemd service file

Martin Pitt martin.pitt at ubuntu.com
Sat Apr 26 17:14:47 UTC 2014


Hello all,

Arto Jantunen [2013-12-27 12:57 +0200]:
> +[Install]
> +Alias=display-manager.service

We should not do that, as systemctl enable will make the package that
was installed last "win" the symlink. But we don't want that,
/etc/X11/default-display-manager should define what the default DM
should be. So we can't use the Alias= handling but have to maintain
the /etc/systemd/system/display-manager.service symlink ourselves.

Josselin Mouette, Michael Biebl, and I discussed that on the current
systemd/GNOME sprint and we came up with a plan like in
http://titanpad.com/s-gsprintchangelog how to handle these.

This is implemented for lightdm with the attached patch; Joss is
working on the corresponding patch for gdm. I also just pushed that
upstream:

  http://bazaar.launchpad.net/~lightdm-team/lightdm/trunk/revision/1965

Thanks for considering,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
diff -Nru lightdm-1.10.0/debian/changelog lightdm-1.10.0/debian/changelog
--- lightdm-1.10.0/debian/changelog	2014-04-11 16:25:01.000000000 +0200
+++ lightdm-1.10.0/debian/changelog	2014-04-26 18:41:59.000000000 +0200
@@ -1,3 +1,12 @@
+lightdm (1.10.0-0ubuntu4) utopic; urgency=medium
+
+  * Add debian/lightdm.service: Add systemd unit.
+  * debian/lightdm.postinst: Set /etc/systemd/system/display-manager.service
+    symlink according to /etc/X11/default-display-manager.
+  * Build-depend on and enable dh-systemd.
+
+ -- Martin Pitt <martin.pitt at ubuntu.com>  Tue, 22 Apr 2014 17:29:48 +0200
+
 lightdm (1.10.0-0ubuntu3) trusty; urgency=medium
 
   * debian/patches/06_apparmor_chromium_updates.patch: allow oxide based
diff -Nru lightdm-1.10.0/debian/control lightdm-1.10.0/debian/control
--- lightdm-1.10.0/debian/control	2014-02-05 11:16:51.000000000 +0100
+++ lightdm-1.10.0/debian/control	2014-04-22 17:28:48.000000000 +0200
@@ -21,6 +21,7 @@
                qtbase5-dev,
                dh-autoreconf,
                dh-translations,
+               dh-systemd (>= 1.14),
                gtk-doc-tools,
                yelp-tools,
                dbus,
diff -Nru lightdm-1.10.0/debian/lightdm.postinst lightdm-1.10.0/debian/lightdm.postinst
--- lightdm-1.10.0/debian/lightdm.postinst	2014-02-12 23:08:14.000000000 +0100
+++ lightdm-1.10.0/debian/lightdm.postinst	2014-04-26 18:38:46.000000000 +0200
@@ -80,6 +80,16 @@
                 chmod 0644 /etc/apparmor.d/abstractions/lightdm_chromium-browser || true
             fi
         fi
+
+        # 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
         ;;
 esac
 
diff -Nru lightdm-1.10.0/debian/lightdm.service lightdm-1.10.0/debian/lightdm.service
--- lightdm-1.10.0/debian/lightdm.service	1970-01-01 01:00:00.000000000 +0100
+++ lightdm-1.10.0/debian/lightdm.service	2014-04-26 18:40:57.000000000 +0200
@@ -0,0 +1,12 @@
+[Unit]
+Description=Light Display Manager
+Documentation=man:lightdm(1)
+After=systemd-user-sessions.service
+
+[Service]
+# temporary safety check until all DMs are converted to correct
+# display-manager.service symlink handling
+ExecStartPre=/bin/sh -c '[ ! -f /etc/X11/default-display-manager -o "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/lightdm" ]'
+ExecStart=/usr/sbin/lightdm
+Restart=always
+BusName=org.freedesktop.DisplayManager
diff -Nru lightdm-1.10.0/debian/rules lightdm-1.10.0/debian/rules
--- lightdm-1.10.0/debian/rules	2014-02-05 11:16:51.000000000 +0100
+++ lightdm-1.10.0/debian/rules	2014-04-22 17:32:27.000000000 +0200
@@ -3,7 +3,7 @@
 LDFLAGS+=-Wl,--as-needed
 
 %:
-	dh $@ --with quilt,autoreconf,translations --parallel
+	dh $@ --with quilt,autoreconf,translations,systemd --parallel
 
 override_dh_autoreconf:
 	NOCONFIGURE=1 dh_autoreconf ./autogen.sh
@@ -27,6 +27,9 @@
 override_dh_installinit:
 	dh_installinit --no-start
 
+override_dh_systemd_start:
+	dh_systemd_start -plightdm --no-start -r lightdm.service
+
 override_dh_installpam:
 	dh_installpam
 	dh_installpam --name=lightdm-autologin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-xfce-devel/attachments/20140426/928983d5/attachment.sig>


More information about the Pkg-xfce-devel mailing list