If kbus support is disabled we already do omit the installation of
org.freedesktop.systemd1.busname

Be consistent and do that that for all busname units and the
busnames.target unit, since installing them is rather useless without
kdbus support.


Fix install-target-wants-hook while at it.



Cheers,
Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
From aac915d0c81dca230826ca71516d7cfa8ab4b6c5 Mon Sep 17 00:00:00 2001
From: Michael Biebl <bi...@debian.org>
Date: Wed, 3 Sep 2014 23:34:29 +0200
Subject: [PATCH] build: don't install busname units and target if kdbus
 support is disabled

When creating the wants symlinks, we also need to check if the string
contains any non-space characters, simply testing for a string with
length zero is not sufficient. This is due to how automake composes the
variables.

E.g. the generated Makefile looks something like this for
BUSNAMES_TARGET_WANTS:

BUSNAMES_TARGET_WANTS = $(am__append_195) $(am__append_200) \
        $(am__append_208) $(am__append_220) $(am__append_243) \
        $(am__append_254) $(am__append_286)

If kdbus support is disabled, the $what variable in
install-target-wants-hook is set to "       ".
---
 Makefile.am | 46 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 1991fd0..9167add 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -270,7 +270,7 @@ install-target-wants-hook:
 	what="$(USER_BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(userunitdir) && $(add-wants)
 
 define add-wants
-	[ -z "$$what" ] || ( \
+	[ -z "$$what" ] || ! echo $$what | grep -q '[^[:space:]]' || ( \
 	  dir=$(DESTDIR)$$dir/$$wants.wants && \
 	  $(MKDIR_P) -m 0755 $$dir && \
 	  cd $$dir && \
@@ -466,7 +466,6 @@ dist_systemunit_DATA = \
 	units/sigpwr.target \
 	units/sleep.target \
 	units/sockets.target \
-	units/busnames.target \
 	units/timers.target \
 	units/paths.target \
 	units/suspend.target \
@@ -494,6 +493,11 @@ dist_systemunit_DATA = \
 	units/system-update.target \
 	units/initrd-switch-root.target
 
+if ENABLE_KDBUS
+dist_systemunit_DATA += \
+	units/busnames.target
+endif
+
 nodist_systemunit_DATA = \
 	units/getty@.service \
 	units/serial-getty@.service \
@@ -4474,8 +4478,10 @@ rootlibexec_PROGRAMS += \
 nodist_systemunit_DATA += \
 	units/systemd-hostnamed.service
 
+if ENABLE_KDBUS
 dist_systemunit_DATA += \
 	units/org.freedesktop.hostname1.busname
+endif
 
 dist_dbuspolicy_DATA += \
 	src/hostname/org.freedesktop.hostname1.conf
@@ -4489,8 +4495,10 @@ polkitpolicy_files += \
 SYSTEM_UNIT_ALIASES += \
 	systemd-hostnamed.service dbus-org.freedesktop.hostname1.service
 
+if ENABLE_KDBUS
 BUSNAMES_TARGET_WANTS += \
 	org.freedesktop.hostname1.busname
+endif
 
 hostnamectl_SOURCES = \
 	src/hostname/hostnamectl.c
@@ -4538,8 +4546,10 @@ systemd_localed_LDADD = \
 nodist_systemunit_DATA += \
 	units/systemd-localed.service
 
+if ENABLE_KDBUS
 dist_systemunit_DATA += \
 	units/org.freedesktop.locale1.busname
+endif
 
 rootlibexec_PROGRAMS += \
 	systemd-localed
@@ -4556,8 +4566,10 @@ polkitpolicy_files += \
 SYSTEM_UNIT_ALIASES += \
 	systemd-localed.service dbus-org.freedesktop.locale1.service
 
+if ENABLE_KDBUS
 BUSNAMES_TARGET_WANTS += \
 	org.freedesktop.locale1.busname
+endif
 
 dist_pkgdata_DATA += \
 	src/locale/kbd-model-map
@@ -4613,8 +4625,10 @@ dist_dbuspolicy_DATA += \
 nodist_systemunit_DATA += \
 	units/systemd-timedated.service
 
+if ENABLE_KDBUS
 dist_systemunit_DATA += \
 	units/org.freedesktop.timedate1.busname
+endif
 
 polkitpolicy_files += \
 	src/timedate/org.freedesktop.timedate1.policy
@@ -4622,8 +4636,10 @@ polkitpolicy_files += \
 SYSTEM_UNIT_ALIASES += \
 	systemd-timedated.service dbus-org.freedesktop.timedate1.service
 
+if ENABLE_KDBUS
 BUSNAMES_TARGET_WANTS += \
 	org.freedesktop.timedate1.busname
+endif
 
 timedatectl_SOURCES = \
 	src/timedate/timedatectl.c
@@ -4775,8 +4791,12 @@ nodist_systemunit_DATA += \
 	units/systemd-machined.service
 
 dist_systemunit_DATA += \
-	units/machine.slice \
+	units/machine.slice
+
+if ENABLE_KDBUS
+dist_systemunit_DATA += \
 	units/org.freedesktop.machine1.busname
+endif
 
 dist_dbussystemservice_DATA += \
 	src/machine/org.freedesktop.machine1.service
@@ -4791,8 +4811,10 @@ dist_zshcompletion_DATA += \
 SYSTEM_UNIT_ALIASES += \
 	systemd-machined.service dbus-org.freedesktop.machine1.service
 
+if ENABLE_KDBUS
 BUSNAMES_TARGET_WANTS += \
 	org.freedesktop.machine1.busname
+endif
 
 EXTRA_DIST += \
 	units/systemd-machined.service.in
@@ -4885,8 +4907,10 @@ rootlibexec_PROGRAMS += \
 nodist_systemunit_DATA += \
 	units/systemd-resolved.service
 
+if ENABLE_KDBUS
 dist_systemunit_DATA += \
 	units/org.freedesktop.resolve1.busname
+endif
 
 dist_dbuspolicy_DATA += \
 	src/resolve/org.freedesktop.resolve1.conf
@@ -4900,8 +4924,10 @@ EXTRA_DIST += \
 SYSTEM_UNIT_ALIASES += \
 	systemd-resolved.service dbus-org.freedesktop.resolve1.service
 
+if ENABLE_KDBUS
 BUSNAMES_TARGET_WANTS += \
 	org.freedesktop.resolve1.busname
+endif
 
 GENERAL_ALIASES += \
 	$(systemunitdir)/systemd-resolved.service $(pkgsysconfdir)/system/multi-user.target.wants/systemd-resolved.service
@@ -5277,8 +5303,12 @@ nodist_systemunit_DATA += \
 	units/systemd-user-sessions.service
 
 dist_systemunit_DATA += \
-	units/user.slice \
+	units/user.slice
+
+if ENABLE_KDBUS
+dist_systemunit_DATA += \
 	units/org.freedesktop.login1.busname
+endif
 
 dist_dbussystemservice_DATA += \
 	src/login/org.freedesktop.login1.service
@@ -5302,8 +5332,10 @@ MULTI_USER_TARGET_WANTS += \
 SYSTEM_UNIT_ALIASES += \
 	systemd-logind.service dbus-org.freedesktop.login1.service
 
+if ENABLE_KDBUS
 BUSNAMES_TARGET_WANTS += \
 	org.freedesktop.login1.busname
+endif
 
 if ENABLE_MULTI_SEAT_X
 
@@ -5891,7 +5923,6 @@ SYSTEM_UNIT_ALIASES += \
 USER_UNIT_ALIASES += \
 	$(systemunitdir)/shutdown.target shutdown.target \
 	$(systemunitdir)/sockets.target sockets.target \
-	$(systemunitdir)/busnames.target busnames.target \
 	$(systemunitdir)/timers.target timers.target \
 	$(systemunitdir)/paths.target paths.target \
 	$(systemunitdir)/bluetooth.target bluetooth.target \
@@ -5899,6 +5930,11 @@ USER_UNIT_ALIASES += \
 	$(systemunitdir)/sound.target sound.target \
 	$(systemunitdir)/smartcard.target smartcard.target
 
+if ENABLE_KDBUS
+USER_UNIT_ALIASES += \
+	$(systemunitdir)/busnames.target busnames.target
+endif
+
 GENERAL_ALIASES += \
 	$(systemunitdir)/remote-fs.target $(pkgsysconfdir)/system/multi-user.target.wants/remote-fs.target \
 	$(systemunitdir)/getty@.service $(pkgsysconfdir)/system/getty.target.wants/getty@tty1.service \
-- 
2.1.0

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to