[PATCH] Support installing systemd unit file.

Gaetan Nadon memsize at videotron.ca
Wed Aug 31 12:16:46 PDT 2011


On Wed, 2011-08-31 at 18:02 +0200, Michał Górny wrote:

> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=38339
> Signed-off-by: Michał Górny <mgorny at gentoo.org>
> Reviewed-by: Gaetan Nadon <memsize at videotron.ca>
> Tested-by: Gaetan Nadon <memsize at videotron.ca>
> ---
>  .gitignore     |    1 +
>  Makefile.am    |   13 ++++++++++++-
>  configure.ac   |   21 +++++++++++++++++++++
>  xdm.service.in |    9 +++++++++
>  4 files changed, 43 insertions(+), 1 deletions(-)
>  create mode 100644 xdm.service.in
> 
> diff --git a/.gitignore b/.gitignore
> index fbf6b92..c51052d 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -76,3 +76,4 @@ core
>  #		Edit the following section as needed
>  # For example, !report.pc overrides *.pc. See 'man gitignore'
>  #
> +xdm.service
> diff --git a/Makefile.am b/Makefile.am
> index 0bd7ca9..e5f9f5c 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -24,7 +24,9 @@ SUBDIRS = app-defaults chooser config greeter include man xdm xdmshell
>  ACLOCAL_AMFLAGS = -I m4
>  
>  # This ensures distcheck is performed in a location where user has write access
> -DISTCHECK_CONFIGURE_FLAGS = --with-appdefaultdir=\$${datadir}/X11/app-defaults
> +DISTCHECK_CONFIGURE_FLAGS = \
> +	--with-appdefaultdir=\$${datadir}/X11/app-defaults \
> +	--with-systemdsystemunitdir=\$${libdir}/systemd/system
>  
>  if LINT
>  ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
> @@ -38,6 +40,15 @@ 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' < $< > $@
> +endif HAVE_SYSTEMD
> +CLEANFILES = xdm.service
> +EXTRA_DIST = xdm.service.in
> +
>  MAINTAINERCLEANFILES = ChangeLog INSTALL
>  
>  .PHONY: ChangeLog INSTALL
> diff --git a/configure.ac b/configure.ac
> index 0c79999..2485288 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -145,6 +145,27 @@ if test "x$USE_SELINUX" != "xno" ; then
>      )
>  fi
>  
> +# Check whether to install systemd unit files, as suggested in daemon(7).
> +AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
> +	[Directory for systemd service files (default from the System and Service Manager)]),,
> +	[with_systemdsystemunitdir=auto])
> +AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
> +    def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
> +
> +    AS_IF([test "x$def_systemdsystemunitdir" = "x"], [
> +	AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], [
> +	    AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])
> +	])
> +	with_systemdsystemunitdir=no
> +    ], [
> +	with_systemdsystemunitdir=$def_systemdsystemunitdir
> +    ])
> +])
> +AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
> +	AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
> +])
> +AM_CONDITIONAL(HAVE_SYSTEMD, [test "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..d15e072
> --- /dev/null
> +++ b/xdm.service.in
> @@ -0,0 +1,9 @@
> +[Unit]
> +Description=X-Window Display Manager
> +After=systemd-user-sessions.service
> +
> +[Service]
> +ExecStart=BINDIR/xdm -nodaemon
> +
> +[Install]
> +Alias=graphical.target.wants/xdm.service


Reviewed-by: Gaetan Nadon <memsize at videotron.ca>
Tested-by: Gaetan Nadon <memsize at videotron.ca>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110831/6fee13fe/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110831/6fee13fe/attachment.pgp>


More information about the xorg-devel mailing list