diff options
author | Ross Burton <ross.burton@arm.com> | 2025-08-05 12:26:13 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-08-07 12:11:16 +0100 |
commit | f266b932995975b94250fd4944800fcfb4741434 (patch) | |
tree | 2f61deaedd7a3f60a1def25d521327481978ff59 | |
parent | 3f2e437a1163c812d7926beabab09997e3cd3354 (diff) | |
download | poky-f266b932995975b94250fd4944800fcfb4741434.tar.gz |
dbus: use the systemd class to handle the unit files
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.
The dbus build was already was installing the service and socket files,
so we are installing them again. Remove the installation of the units.
Manually mask dbus-1.service by simply creating a symlink, instead of
depending on systemctl and using an postinstall script.
(From OE-Core rev: a296b0623eb23300751b8c571ad804884d1fbd4f)
Signed-off-by: Ross Burton <ross.burton@arm.com>
[1] dbus: 718db96199 ("core: convert PID 1 to libsystemd-bus")
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/dbus/dbus_1.16.2.bb | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/meta/recipes-core/dbus/dbus_1.16.2.bb b/meta/recipes-core/dbus/dbus_1.16.2.bb index 1876ea8a94..4fc590eb39 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" | |||
46 | RDEPENDS:${PN} += "${PN}-common ${PN}-tools" | 46 | RDEPENDS:${PN} += "${PN}-common ${PN}-tools" |
47 | RDEPENDS:${PN}:class-native = "" | 47 | RDEPENDS:${PN}:class-native = "" |
48 | 48 | ||
49 | inherit useradd update-rc.d | 49 | inherit systemd useradd update-rc.d |
50 | 50 | ||
51 | INITSCRIPT_NAME = "dbus-1" | 51 | INITSCRIPT_NAME = "dbus-1" |
52 | INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ." | 52 | INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ." |
53 | 53 | ||
54 | python __anonymous() { | ||
55 | if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): | ||
56 | d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") | ||
57 | } | ||
58 | |||
59 | PACKAGES =+ "${PN}-lib ${PN}-common ${PN}-tools" | 54 | PACKAGES =+ "${PN}-lib ${PN}-common ${PN}-tools" |
60 | 55 | ||
61 | USERADD_PACKAGES = "dbus-common" | 56 | USERADD_PACKAGES = "dbus-common" |
@@ -103,16 +98,7 @@ FILES:${PN}-dev += "${libdir}/dbus-1.0/include ${bindir}/dbus-test-tool ${datadi | |||
103 | 98 | ||
104 | RDEPENDS:${PN}-ptest += "bash make dbus" | 99 | RDEPENDS:${PN}-ptest += "bash make dbus" |
105 | 100 | ||
106 | PACKAGE_WRITE_DEPS += "${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','systemd-systemctl-native','',d)}" | ||
107 | pkg_postinst:dbus() { | 101 | pkg_postinst:dbus() { |
108 | # If both systemd and sysvinit are enabled, mask the dbus-1 init script | ||
109 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd sysvinit','true','false',d)}; then | ||
110 | if [ -n "$D" ]; then | ||
111 | OPTS="--root=$D" | ||
112 | fi | ||
113 | systemctl $OPTS mask dbus-1.service | ||
114 | fi | ||
115 | |||
116 | if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then | 102 | if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then |
117 | /etc/init.d/populate-volatile.sh update | 103 | /etc/init.d/populate-volatile.sh update |
118 | fi | 104 | fi |
@@ -134,22 +120,20 @@ do_install:append:class-target() { | |||
134 | install -d ${D}${sysconfdir}/init.d | 120 | install -d ${D}${sysconfdir}/init.d |
135 | sed 's:@bindir@:${bindir}:' < ${UNPACKDIR}/dbus-1.init > ${S}/dbus-1.init.sh | 121 | sed 's:@bindir@:${bindir}:' < ${UNPACKDIR}/dbus-1.init > ${S}/dbus-1.init.sh |
136 | install -m 0755 ${S}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1 | 122 | install -m 0755 ${S}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1 |
123 | |||
137 | install -d ${D}${sysconfdir}/default/volatiles | 124 | install -d ${D}${sysconfdir}/default/volatiles |
138 | echo "d messagebus messagebus 0755 /run/dbus none" \ | 125 | echo "d messagebus messagebus 0755 /run/dbus none" \ |
139 | > ${D}${sysconfdir}/default/volatiles/99_dbus | 126 | > ${D}${sysconfdir}/default/volatiles/99_dbus |
140 | fi | ||
141 | 127 | ||
142 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | 128 | if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then |
143 | for i in dbus.target.wants sockets.target.wants multi-user.target.wants; do \ | 129 | # symlink dbus-1.service to /dev/null to "mask" the service, This ensures |
144 | install -d ${D}${systemd_system_unitdir}/$i; done | 130 | # that if systemd and sysv init systems are both enabled, systemd doesn't |
145 | install -m 0644 ${B}/bus/dbus.service ${B}/bus/dbus.socket ${D}${systemd_system_unitdir}/ | 131 | # start two system buses (one from init.d/dbus-1, one from dbus.service). |
146 | ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/dbus.target.wants/dbus.socket | 132 | ln -s /dev/null ${D}${systemd_system_unitdir}/dbus-1.service |
147 | ln -fs ../dbus.socket ${D}${systemd_system_unitdir}/sockets.target.wants/dbus.socket | 133 | fi |
148 | ln -fs ../dbus.service ${D}${systemd_system_unitdir}/multi-user.target.wants/dbus.service | ||
149 | fi | 134 | fi |
150 | 135 | ||
151 | mkdir -p ${D}${localstatedir}/lib/dbus | 136 | mkdir -p ${D}${localstatedir}/lib/dbus |
152 | |||
153 | chown messagebus:messagebus ${D}${localstatedir}/lib/dbus | 137 | chown messagebus:messagebus ${D}${localstatedir}/lib/dbus |
154 | 138 | ||
155 | if [ "${@bb.utils.contains('PACKAGECONFIG', 'traditional-activation', '1', '0', d)}" = "1" ] | 139 | if [ "${@bb.utils.contains('PACKAGECONFIG', 'traditional-activation', '1', '0', d)}" = "1" ] |