[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#759005: xdm: Missing xdm.service, can't use with systemd



Control: tags -1 patch

On sab, ago 23, 2014 at 09:30:24 +0200, Sven Joachim wrote:
> On 2014-08-23 19:52 +0200, Kan-Ru Chen (陳侃如) wrote:
> 
> > Package: xdm
> > Version: 1:1.1.11-1
> > Severity: important
> >
> > The xdm upstream ships a xdm.service file however it is not include in
> > the xdm debian package.
> 
> It would probably make sense to ship it, but care must be taken not to
> enable the service unless xdm is the default display manager.

I wrote a patch that makes the display-manager.service systemd thing work with
xdm (see attached patch). The patch does:

1 Patches the systemd service file to not start unless xdm is the default
  manager (as per /etc/X11/default-display-manager).
2 Removes the [Install] section in the systemd service file so that if the user
  manually enables the service it does nothing (so that it doesn't conflict with
  the default manager).
3 Creates the /etc/systemd/system/display-manager.service in postinst if xdm is
  the dfault manager.
4 Installs the systemd service file.

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 xdm).

Cheers
From 7a14e992eb2b194b3be19cca7bcacc1b2e2e5906 Mon Sep 17 00:00:00 2001
From: Alessandro Ghedini <alessandro@ghedini.me>
Date: Fri, 21 Nov 2014 15:19:43 +0100
Subject: [PATCH] Install systemd service file

Closes: #759005
---
 debian/patches/22_systemd_service.diff | 13 +++++++++++++
 debian/patches/series                  |  2 ++
 debian/rules                           |  1 +
 debian/xdm.install                     |  1 +
 debian/xdm.postinst.in                 | 13 +++++++++++++
 5 files changed, 30 insertions(+)
 create mode 100644 debian/patches/22_systemd_service.diff

diff --git a/debian/patches/22_systemd_service.diff b/debian/patches/22_systemd_service.diff
new file mode 100644
index 0000000..3d8161d
--- /dev/null
+++ b/debian/patches/22_systemd_service.diff
@@ -0,0 +1,13 @@
+--- a/xdm.service.in
++++ b/xdm.service.in
+@@ -3,7 +3,7 @@
+ 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 '[ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/bin/xdm" ]'
+ ExecStart=BINDIR/xdm -nodaemon
+-
+-[Install]
+-Alias=graphical.target.wants/xdm.service
diff --git a/debian/patches/series b/debian/patches/series
index 854f2c2..33d0e9f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,6 +8,8 @@ greeter-xrender.diff
 20_xdm_log_timestamp.diff
 21_xdm_log_append.diff
 
+22_systemd_service.diff
+
 support_logfile_rotation.diff
 
 debian.diff
diff --git a/debian/rules b/debian/rules
index 59da5d4..b758411 100755
--- a/debian/rules
+++ b/debian/rules
@@ -24,6 +24,7 @@ confflags += \
 	--with-pixmapdir=/usr/share/X11/xdm/pixmaps \
 	--with-color-pixmap=debian.xpm \
 	--with-bw-pixmap=debianbw.xpm \
+	--with-systemdsystemunitdir=yes \
 	--disable-xdm-auth \
 	--with-xft \
 	--disable-silent-rules \
diff --git a/debian/xdm.install b/debian/xdm.install
index 60ec165..78c8c7d 100644
--- a/debian/xdm.install
+++ b/debian/xdm.install
@@ -10,6 +10,7 @@ etc/X11/xdm/Xwilling
 etc/X11/xdm/xdm-config
 etc/X11/xdm/xdm.options
 etc/insserv.conf.d/xdm
+lib/systemd/system/xdm.service
 usr/bin/xdm
 usr/lib/X11/xdm/chooser
 usr/lib/X11/xdm/libXdmGreet.so
diff --git a/debian/xdm.postinst.in b/debian/xdm.postinst.in
index d871e02..e0fbe67 100644
--- a/debian/xdm.postinst.in
+++ b/debian/xdm.postinst.in
@@ -63,6 +63,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
+
 # Registering the init scripts or starting the daemon may cause output to
 # stdout, which can confuse debconf.
 db_stop
-- 
2.1.3

Attachment: signature.asc
Description: Digital signature


Reply to: