From b8f5599379e652254f4d9970beeb16b8b6c4bb5e Mon Sep 17 00:00:00 2001 From: Benedikt Morbach Date: Thu, 12 Jan 2012 16:22:50 +0100 Subject: [PATCH] install a systemd service file if systemd is used this makes dbus defer starting upowerd to systemd instead of doing it itself and thus puts the daemon under proper systemd supervision. --- Makefile.am | 3 +- configure.ac | 11 ++++++++++ data/Makefile.am | 28 +++++++++++++++++++------ data/colord.service.in | 16 ++++++++++++++ data/org.freedesktop.ColorManager.service.in | 1 + 5 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 data/colord.service.in diff --git a/Makefile.am b/Makefile.am index c4a7bf4..e6da2a0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,7 +22,8 @@ snapshot: DISTCHECK_CONFIGURE_FLAGS = \ --enable-introspection \ - --enable-fd-fallback + --enable-fd-fallback \ + --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) EXTRA_DIST = \ COPYING \ diff --git a/configure.ac b/configure.ac index ad111e0..1796f4e 100644 --- a/configure.ac +++ b/configure.ac @@ -171,6 +171,17 @@ if test x$enable_polkit = xyes; then fi dnl --------------------------------------------------------------------------- +dnl - Select whether and where to install systemd system service files +dnl --------------------------------------------------------------------------- + +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], + [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) +AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) +AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"]) + +dnl --------------------------------------------------------------------------- dnl - Build DBus examples dnl --------------------------------------------------------------------------- AC_ARG_ENABLE(examples, AS_HELP_STRING([--enable-examples],[enable DBus example code]), diff --git a/data/Makefile.am b/data/Makefile.am index 727b419..516c6a2 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -8,17 +8,30 @@ dist_dbus_DATA = org.freedesktop.ColorManager.conf profiledir = $(datadir)/color/icc/colord dist_profile_DATA = x11-colors.icc crayons.icc -servicemaindir = $(datadir)/dbus-1/system-services -servicemain_in_files = org.freedesktop.ColorManager.service.in -servicemain_DATA = $(servicemain_in_files:.service.in=.service) -$(servicemain_DATA): $(servicemain_in_files) Makefile +dbusservicemaindir = $(datadir)/dbus-1/system-services +dbusservicemain_in_files = org.freedesktop.ColorManager.service.in +dbusservicemain_DATA = $(dbusservicemain_in_files:.service.in=.service) +$(dbusservicemain_DATA): $(dbusservicemain_in_files) Makefile @sed -e "s|\@servicedir\@|$(libexecdir)|" $< | \ sed -e "s|\@daemon_user\@|$(daemon_user)|" > $@ +if HAVE_SYSTEMD +systemdservicemaindir = $(systemdsystemunitdir) +systemdservicemain_in_files = colord.service.in +systemdservicemain_DATA = $(systemdservicemain_in_files:.service.in=.service) +$(systemdservicemain_DATA): $(systemdservicemain_in_files) Makefile + @sed -e "s|\@servicedir\@|$(libexecdir)|" $< | \ + sed -e "s|\@daemon_user\@|$(daemon_user)|" > $@ +endif + EXTRA_DIST = \ - $(servicemain_in_files) \ + $(dbusservicemain_in_files) \ org.freedesktop.ColorManager.conf.in +if HAVE_SYSTEMD +EXTRA_DIST += $(systemdservicemain_in_files) +endif + x11-colors.icc: $(top_builddir)/client/cd-create-profile --output $@ --named-color-palette ./x11-colors.csv --nc-prefix="X11" --named-color-type srgb -d "X11 Colors" -c "No copyright" -n "Richard Hughes" @@ -29,7 +42,8 @@ gamma-90.icc: $(top_builddir)/client/cd-create-profile --output $@ --xorg-gamma "0.9,0.9,0.9" -d "sRGB display 90% Gamma" -c "No copyright" -n "Richard Hughes" DISTCLEANFILES = \ - org.freedesktop.ColorManager.service \ - $(dist_profile_DATA) + $(dbusservicemain_DATA) \ + $(dist_profile_DATA) \ + $(systemdservicemain_DATA) -include $(top_srcdir)/git.mk diff --git a/data/colord.service.in b/data/colord.service.in new file mode 100644 index 0000000..3b9df4d --- /dev/null +++ b/data/colord.service.in @@ -0,0 +1,16 @@ +[Unit] +Description=Daemon for managing, installing and generating color profiles +After=syslog.target + +[Service] +Type=dbus +BusName=org.freedesktop.ColorManager +ExecStart=@servicedir@/colord +User=@daemon_user@ + +[Install] +# We pull this in by graphical.target instead of waiting for the bus +# activation, to speed things up a little: gdm uses this anyway so it is nice +# if it is already around when gdm wants to use it and doesn't have to wait for +# it. +WantedBy=graphical.target diff --git a/data/org.freedesktop.ColorManager.service.in b/data/org.freedesktop.ColorManager.service.in index aecf7d3..29fabe3 100644 --- a/data/org.freedesktop.ColorManager.service.in +++ b/data/org.freedesktop.ColorManager.service.in @@ -2,3 +2,4 @@ Name=org.freedesktop.ColorManager Exec=@servicedir@/colord User=@daemon_user@ +SystemdService=colord.service -- 1.7.8.1