polkit: Add a separate package for polkit systemd service/dbus config
PATCH 1/1 polkit: Add a separate package for polkit systemd service/dbus config
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
--- meta-oe/recipes-extended/polkit/polkit_127.bb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
meta-oe/recipes-extended/polkit/polkit_127.bb +18 -1
@@ -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
Signature · 1 line
2.43.0
Quoted 37 lines · On Thu, Sep 10, 2026 at 12:01 PM Severin Tillmann, DE-862 via…
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 <[email protected]>--- meta-oe/recipes-extended/polkit/polkit_127.bb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)meta-oe/recipes-extended/polkit/polkit_127.bb +11
-1@@ -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 \ +" +
meta-oe/recipes-extended/polkit/polkit_127.bb PACKAGECONFIG[libs-only] = "-Dlibs-only=true,-Dlibs-only=false" · line 60
Quoted 10 lines
meta-oe/recipes-extended/polkit/polkit_127.bb +7
-0+# 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
One regression I noticed after this change is that the contents of polkit-service and polkit-dbus packages are not installed by default anymore (as they were part of the polkit package before, and here polkit itself is not rdepending on ${PN}-service ${PN}-dbus).
There is now "PREFERRED_PROVIDER_polkit ?= "polkit"", but that also doesn't help, since it will basically just install the new polkit package without the service and dbus.
I understand it can be replaced by smolkit as a different provider, but should we really drop ${PN}-service and ${PN}-dbus by default?
Noticed as everything that uses polkit stopped working after I updated to the latest meta-oe (since before NM / etc would just depend on polkit and everything would be provided by the package).
Thanks,
Ricardo