diff mbox series

[4/5] dbus: use the systemd class to handle the unit files

Message ID 20250801204928.2580529-4-ross.burton@arm.com
State New
Headers show
Series [1/5] systemd: explicitly disable dbus | expand

Commit Message

Ross Burton Aug. 1, 2025, 8:49 p.m. UTC
Originally, the dbus recipe couldn't use the systemd class because there
was a circular dependency between systemd and dbus.

However, since systemd v209 in 2014[1] systemd hasn't needed libdbus, as
it has it's own implementation of the client library. DBus does not use
the systemd libraries, so there is no circular dependency.

Also the dbus package already was installing the service and socket
files, so we were installing them again.

Signed-off-by: Ross Burton <ross.burton@arm.com>

[1] dbus: 718db96199 ("core: convert PID 1 to libsystemd-bus")
---
 meta/recipes-core/dbus/dbus_1.16.2.bb | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-core/dbus/dbus_1.16.2.bb b/meta/recipes-core/dbus/dbus_1.16.2.bb
index 1876ea8a944..5de6ba66bc7 100644
--- a/meta/recipes-core/dbus/dbus_1.16.2.bb
+++ b/meta/recipes-core/dbus/dbus_1.16.2.bb
@@ -46,16 +46,11 @@  DEPENDS = "expat virtual/libintl"
 RDEPENDS:${PN} += "${PN}-common ${PN}-tools"
 RDEPENDS:${PN}:class-native = ""
 
-inherit useradd update-rc.d
+inherit systemd useradd update-rc.d
 
 INITSCRIPT_NAME = "dbus-1"
 INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ."
 
-python __anonymous() {
-    if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
-        d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
-}
-
 PACKAGES =+ "${PN}-lib ${PN}-common ${PN}-tools"
 
 USERADD_PACKAGES = "dbus-common"
@@ -103,10 +98,10 @@  FILES:${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-test-tool ${datadi
 
 RDEPENDS:${PN}-ptest += "bash make dbus"
 
-PACKAGE_WRITE_DEPS += "${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-systemctl-native','',d)}"
 pkg_postinst:dbus() {
-	# If both systemd and sysvinit are enabled, mask the dbus-1 init script
-        if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
+	# If both systemd and sysvinit are enabled, mask the dbus-1 init script as systemd
+	# doesn't know that it matches dbus.service.
+	if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then
 		if [ -n "$D" ]; then
 			OPTS="--root=$D"
 		fi
@@ -139,15 +134,6 @@  do_install:append:class-target() {
 		     > ${D}${sysconfdir}/default/volatiles/99_dbus
 	fi
 
-	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
-		for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \
-			install -d ${D}${systemd_system_unitdir}/$i; done
-		install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_system_unitdir}/
-		ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/dbus.target.wants/dbus.socket
-		ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/sockets.target.wants/dbus.socket
-		ln -fs ../dbus.service ${D}${systemd_system_unitdir}/multi-user.target.wants/dbus.service
-	fi
-
 	mkdir -p ${D}${localstatedir}/lib/dbus
 
 	chown messagebus:messagebus ${D}${localstatedir}/lib/dbus