diff mbox series

[meta-oe] polkit: Add a separate package for polkit systemd service/dbus config

Message ID 20260910150143.2155047-1-tillmann.severin@bmw.de
State Under Review
Headers show
Series [meta-oe] polkit: Add a separate package for polkit systemd service/dbus config | expand

Commit Message

Tillmann Severin Sept. 10, 2026, 3:01 p.m. UTC
Creates a separate package for the polkit systemd
service, such that other implementations for polkit
could be used instead of polkit on systemd enabled
systems, while still keeping polkit available. This
is especially helpful for software that depends on
polkit or its libraries etc, e.g. udisks2.

Also package dbus configuration into an own package

Signed-off-by: Tillmann Severin <tillmann.severin@bmw.de>
---
 meta-oe/recipes-extended/polkit/polkit_127.bb | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/polkit/polkit_127.bb b/meta-oe/recipes-extended/polkit/polkit_127.bb
index f97c6efbf7..c0a301c8b0 100644
--- a/meta-oe/recipes-extended/polkit/polkit_127.bb
+++ b/meta-oe/recipes-extended/polkit/polkit_127.bb
@@ -35,9 +35,26 @@  PACKAGECONFIG[libs-only] = "-Dlibs-only=true,-Dlibs-only=false"
 USERADD_PACKAGES = "${PN}"
 USERADD_PARAM:${PN} = "--system --no-create-home --user-group --home-dir ${sysconfdir}/${BPN}-1 --shell /bin/nologin polkitd"
 
-SYSTEMD_SERVICE:${PN} = "${BPN}.service"
+# Package the systemd service into a separate package to be able
+# to exclude the polkit service in favor of alternative implementations
+SYSTEMD_PACKAGES += "${PN}-service"
+SYSTEMD_SERVICE:${PN}-service = "${BPN}.service"
 SYSTEMD_AUTO_ENABLE = "disable"
 
+PACKAGES =+ "${PN}-service"
+RDEPENDS:${PN}-service += "polkit"
+FILES:${PN}-service += " \
+    ${systemd_system_unitdir} \
+    ${sysconfdir}/systemd/system/polkit-virtual-provider.service \
+"
+
+# Package also the dbus configuration into a separate package
+PACKAGES =+ "${PN}-dbus"
+RDEPENDS:${PN}-dbus += "polkit"
+FILES:${PN}-dbus += "\
+    ${datadir}/dbus-1 \
+"
+
 do_install:append() {
 	#Fix up permissions on polkit rules.d to work with rpm4 constraints
 	if ${@bb.utils.contains('PACKAGECONFIG', 'libs-only', 'false', 'true', d)}; then