mirror of
https://git.yoctoproject.org/poky
synced 2026-05-01 15:32:12 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
3f2e437a11
commit
f266b93299
@@ -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,16 +98,7 @@ 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 [ -n "$D" ]; then
|
||||
OPTS="--root=$D"
|
||||
fi
|
||||
systemctl $OPTS mask dbus-1.service
|
||||
fi
|
||||
|
||||
if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
|
||||
/etc/init.d/populate-volatile.sh update
|
||||
fi
|
||||
@@ -134,22 +120,20 @@ do_install:append:class-target() {
|
||||
install -d ${D}${sysconfdir}/init.d
|
||||
sed 's:@bindir@:${bindir}:' < ${UNPACKDIR}/dbus-1.init > ${S}/dbus-1.init.sh
|
||||
install -m 0755 ${S}/dbus-1.init.sh ${D}${sysconfdir}/init.d/dbus-1
|
||||
|
||||
install -d ${D}${sysconfdir}/default/volatiles
|
||||
echo "d messagebus messagebus 0755 /run/dbus none" \
|
||||
> ${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
|
||||
if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then
|
||||
# symlink dbus-1.service to /dev/null to "mask" the service, This ensures
|
||||
# that if systemd and sysv init systems are both enabled, systemd doesn't
|
||||
# start two system buses (one from init.d/dbus-1, one from dbus.service).
|
||||
ln -s /dev/null ${D}${systemd_system_unitdir}/dbus-1.service
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p ${D}${localstatedir}/lib/dbus
|
||||
|
||||
chown messagebus:messagebus ${D}${localstatedir}/lib/dbus
|
||||
|
||||
if [ "${@bb.utils.contains('PACKAGECONFIG', 'traditional-activation', '1', '0', d)}" = "1" ]
|
||||
|
||||
Reference in New Issue
Block a user