diff mbox series

[meta-oe,master,kirkstone] fwupd: fix ${datadir}/polkit-1/rules.d permissions

Message ID 20221028131037.3600179-1-mikko.rapeli@linaro.org
State New
Headers show
Series [meta-oe,master,kirkstone] fwupd: fix ${datadir}/polkit-1/rules.d permissions | expand

Commit Message

Mikko Rapeli Oct. 28, 2022, 1:10 p.m. UTC
They need to be the same as systemd which creates the
directory or rpm/dnf will fail rootfs build with error:

Error: Transaction test error:
  file /usr/share/polkit-1/rules.d conflicts between attempted installs of fwupd-1.7.6-r0.qemuarm64 and systemd-1:250.5-r0.armv8a

"bitbake -c install systemd && bitbake -c devshell systemd"
shows that the permissons should be:

  2581167      1 drwx------   2 polkitd  root            3 Oct 28 11:22 ../image/usr/share/polkit-1/rules.d

but "bitbake -c install fwupd && bitbake -c devshell fwupd" shows
the permissions as:

  2554626      1 drwxr-xr-x   2 root     root            3 Oct 28 11:17 ../image/usr/share/polkit-1/rules.d

Now they are fixed to be the same and installing both systemd and fwupd
to rootfs works with rpm and dnf.

Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
 meta-oe/recipes-bsp/fwupd/fwupd_1.7.6.bb | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Ross Burton Oct. 28, 2022, 2:57 p.m. UTC | #1
> On 28 Oct 2022, at 14:10, Mikko Rapeli via lists.openembedded.org <mikko.rapeli=linaro.org@lists.openembedded.org> wrote:
> +        if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
> +                if [ -d ${D}${datadir}/polkit-1/rules.d ]; then

No point to have the double check here: just check if the directory exists.

Ross
Mikko Rapeli Oct. 31, 2022, 7:40 a.m. UTC | #2
Hi,

On Fri, Oct 28, 2022 at 02:57:50PM +0000, Ross Burton wrote:
> 
> > On 28 Oct 2022, at 14:10, Mikko Rapeli via lists.openembedded.org <mikko.rapeli=linaro.org@lists.openembedded.org> wrote:
> > +        if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
> > +                if [ -d ${D}${datadir}/polkit-1/rules.d ]; then
> 
> No point to have the double check here: just check if the directory exists.

This is direct copy paste from systemd recipe. I think it should stay
like that. I think there are still some configurations where this will
break again though. I'm hoping that polkit would imply also systemd.

Cheers,

-Mikko
diff mbox series

Patch

diff --git a/meta-oe/recipes-bsp/fwupd/fwupd_1.7.6.bb b/meta-oe/recipes-bsp/fwupd/fwupd_1.7.6.bb
index 53f1720b0..ccce4b1df 100644
--- a/meta-oe/recipes-bsp/fwupd/fwupd_1.7.6.bb
+++ b/meta-oe/recipes-bsp/fwupd/fwupd_1.7.6.bb
@@ -125,3 +125,14 @@  FILES:${PN} += "${libdir}/fwupd-plugins-* \
 FILES:${PN}-ptest += "${libexecdir}/installed-tests/ \
                       ${datadir}/installed-tests/"
 RDEPENDS:${PN}-ptest += "gnome-desktop-testing"
+
+do_install:append() {
+        # do the same as systemd to avoid rpm/dnf errors when installing both
+        # If polkit is setup fixup permissions and ownership
+        if ${@bb.utils.contains('PACKAGECONFIG', 'polkit', 'true', 'false', d)}; then
+                if [ -d ${D}${datadir}/polkit-1/rules.d ]; then
+                        chmod 700 ${D}${datadir}/polkit-1/rules.d
+                        chown polkitd:root ${D}${datadir}/polkit-1/rules.d
+                fi
+        fi
+}