diff mbox series

[1/1] package/bluez5_utils: fix bluetoothd daemon not starting

Message ID 20240913154634.10723-1-nicolas.cavallari@green-communications.fr
State New
Headers show
Series [1/1] package/bluez5_utils: fix bluetoothd daemon not starting | expand

Commit Message

Nicolas Cavallari Sept. 13, 2024, 3:44 p.m. UTC
bluetoothd does not start since commit 1a8676aa6e4b
("package/bluez5_utils: disable datafiles"):

bluetoothd[4242]: Bluetooth daemon 5.75
bluetoothd[4242]: src/main.c:main() Unable to get on D-Bus

This because --disable-datafiles also disables installing the D-Bus
policy file /etc/dbus-1/system.d/bluetooth.conf that allows bluetoothd
to own the "org.bluez" service name.

The underlying issue that the commit tried to fix is that this package
now installs /etc/bluetooth with mode 555, which causes problems when
buildroot need to remove or patch files.

To fix this, fix the permissions in target/ and staging/ after
installation, but still make sure that the permissions on the rootfs are
555.

There could still be permissions issues if make install fails, because
the fixups will not be applied.

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
---
 package/bluez5_utils/bluez5_utils.mk | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/package/bluez5_utils/bluez5_utils.mk b/package/bluez5_utils/bluez5_utils.mk
index b1caef5cc5..f5c556a3db 100644
--- a/package/bluez5_utils/bluez5_utils.mk
+++ b/package/bluez5_utils/bluez5_utils.mk
@@ -22,7 +22,6 @@  BLUEZ5_UTILS_DEPENDENCIES = \
 BLUEZ5_UTILS_CONF_OPTS = \
 	--enable-library \
 	--disable-cups \
-	--disable-datafiles \
 	--disable-manpages \
 	--disable-asan \
 	--disable-lsan \
@@ -194,6 +193,23 @@  else
 BLUEZ5_UTILS_CONF_OPTS += --disable-systemd
 endif
 
+# bluez installs /etc/bluetooth with mode 555 which causes issues
+define BLUEZ5_UTILS_FIX_PERMISSIONS_STAGING
+	chmod 755 $(STAGING_DIR)/etc/bluetooth/
+endef
+BLUEZ5_UTILS_POST_INSTALL_STAGING_HOOKS += \
+	BLUEZ5_UTILS_FIX_PERMISSIONS_STAGING
+
+define BLUEZ5_UTILS_FIX_PERMISSIONS_TARGET
+	chmod 755 $(TARGET_DIR)/etc/bluetooth/
+endef
+BLUEZ5_UTILS_POST_INSTALL_TARGET_HOOKS += \
+	BLUEZ5_UTILS_FIX_PERMISSIONS_TARGET
+
+define BLUEZ5_UTILS_PERMISSIONS
+	/etc/bluetooth/ d 555 0 0 - - - - -
+endef
+
 define BLUEZ5_UTILS_INSTALL_INIT_SYSV
 	$(INSTALL) -m 0755 -D package/bluez5_utils/S40bluetoothd \
 		$(TARGET_DIR)/etc/init.d/S40bluetoothd