<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY>
On Sun, 2011-08-28 at 17:12 -0400, Gaetan Nadon wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
On Sun, 2011-08-28 at 09:49 +0200, Michał Górny wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Signed-off-by: Michał Górny <<A HREF="mailto:mgorny@gentoo.org">mgorny@gentoo.org</A>>
Fixes: <A HREF="https://bugs.freedesktop.org/show_bug.cgi?id=38339">https://bugs.freedesktop.org/show_bug.cgi?id=38339</A>
---
Makefile.am | 10 ++++++++++
configure.ac | 12 ++++++++++++
xdm.service.in | 10 ++++++++++
3 files changed, 32 insertions(+), 0 deletions(-)
create mode 100644 xdm.service.in
diff --git a/Makefile.am b/Makefile.am
index 0bd7ca9..74ea361 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,6 +38,16 @@ lint:
        (cd chooser && $(MAKE) $(AM_MAKEFLAGS) lint)
endif LINT
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = xdm.service
+
+xdm.service: xdm.service.in
+        $(AM_V_GEN)$(SED) -e 's|BINDIR|$(bindir)|g' < $< > $@
+
+MOSTLYCLEANFILES = xdm.service
+endif HAVE_SYSTEMD
+EXTRA_DIST = xdm.service.in
</PRE>
</BLOCKQUOTE>
If make creates xdm.service and the module is reconfigured using --without such that the file should no longer be created, it is not removed and thus gets installed anyway. It won't even be removed if you do 'make clean' . It could be a .PHONY target.<BR>
</BLOCKQUOTE>
Just need to change MOSTLYCLEANFILES to CLEANFILES, the rest is ok. A user can reconfigure with a different value for bindir.<BR>
<BLOCKQUOTE TYPE=CITE>
<BR>
When the path to the service dir is not writable by the user, the distcheck target will fail. The option should be added to DISTCHECK_CONFIGURE_FLAGS.<BR>
</BLOCKQUOTE>
This will fix the problem:
<BLOCKQUOTE>
<PRE>
# This ensures distcheck is performed in a location where user has write access
DISTCHECK_CONFIGURE_FLAGS = \
        --with-appdefaultdir=\$${datadir}/X11/app-defaults \
        --with-systemdsystemunitdir=\$${libdir}/systemd/system
</PRE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
+
MAINTAINERCLEANFILES = ChangeLog INSTALL
.PHONY: ChangeLog INSTALL
diff --git a/configure.ac b/configure.ac
index 0c79999..1443d9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,6 +145,18 @@ if test "x$USE_SELINUX" != "xno" ; then
)
fi
+# Check whether to install systemd unit files, as suggest in daemon(7).
+AC_ARG_WITH([systemdsystemunitdir],
+        AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
+                [Directory for systemd service files]),
</PRE>
</BLOCKQUOTE>
The help string should state (within reason) what is the default path for the service directory.
<BLOCKQUOTE TYPE=CITE>
<PRE>
+        [],
+        [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]
+)
+if test "x$with_systemdsystemunitdir" != "xno" ; then
+        AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
</PRE>
</BLOCKQUOTE>
When user input is "--with-systemdsystemunitdir" (the path is missing), variable systemdsystemunitdir is set to 'yes' and HAVE_SYSTEMD is set to true which does not make much sense. Make install will attempt to write it in the 'yes' directory. Perhaps it should pick the default value.<BR>
<BR>
When user does not type any --with or any --without and does not have the systemd installed, what is the default value for systemdsystemunitdir? <BR>
<BR>
When a user inputs "--with-systemdsystemunitdir=<TT>/usr/lib/systemd/system</TT>" and does not have systemd installed, will the service file be installed? In my opinion, it should not. This is for Linux only, only a few distros have it, other O/S such as *BSD and Solaris don't. With this patch it would.<BR>
<BR>
In essence, when the user input clearly indicates he wants to set systemdsystemunitdir, an error should occur if systemd is not installed. <BR>
</BLOCKQUOTE>
After seeing Julien's comment and looking at other modules, this part is ok.<BR>
<BR>
A couple of lines with some text changed:
<BLOCKQUOTE>
<PRE>
# Check whether to install Linux systemd unit files, as suggested in daemon(7).
[Directory for systemd service files (default from the System and Service Manager)]),
</PRE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE TYPE=CITE>
<PRE>
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+
# FIXME: Find better test for which OS'es use su -m - for now, just try to
# mirror the Imakefile setting of:
# if defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) || defined(FreeBSDArchitecture) || defined(DarwinArchitecture)
diff --git a/xdm.service.in b/xdm.service.in
new file mode 100644
index 0000000..2e85c13
--- /dev/null
+++ b/xdm.service.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=X-Window Display Manager on %I
+Requires=dev-%i.device
+After=dev-%i.device systemd-user-sessions.service
+
+[Service]
+ExecStart=BINDIR/xdm -nodaemon
+
+[Install]
+Alias=graphical.target.wants/<A HREF="mailto:xdm@tty7.service">xdm@tty7.service</A>
--
1.7.6.1
_______________________________________________
<A HREF="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</A>: X.Org development
Archives: <A HREF="http://lists.x.org/archives/xorg-devel">http://lists.x.org/archives/xorg-devel</A>
Info: <A HREF="http://lists.x.org/mailman/listinfo/xorg-devel">http://lists.x.org/mailman/listinfo/xorg-devel</A>
</PRE>
</BLOCKQUOTE>
<BR>
<PRE>
_______________________________________________
<A HREF="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</A>: X.Org development
Archives: <A HREF="http://lists.x.org/archives/xorg-devel">http://lists.x.org/archives/xorg-devel</A>
Info: <A HREF="http://lists.x.org/mailman/listinfo/xorg-devel">http://lists.x.org/mailman/listinfo/xorg-devel</A>
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>