diff mbox series

package/mosquitto: add target mosquitto_passwd

Message ID 20240529072911.288748-1-slaveze@smartandconnective.com
State Accepted
Headers show
Series package/mosquitto: add target mosquitto_passwd | expand

Commit Message

Sebastien Laveze May 29, 2024, 7:29 a.m. UTC
The mosquitto_passwd utility is useful on target if user accounts need
to be created runtime.

Signed-off-by: Sebastien Laveze <slaveze@smartandconnective.com>
---
 package/mosquitto/Config.in    | 7 +++++++
 package/mosquitto/mosquitto.mk | 4 ++++
 2 files changed, 11 insertions(+)

Comments

Peter Korsgaard June 1, 2024, 9:01 p.m. UTC | #1
>>>>> "Sebastien" == Sebastien Laveze <slaveze@smartandconnective.com> writes:

 > The mosquitto_passwd utility is useful on target if user accounts need
 > to be created runtime.

 > Signed-off-by: Sebastien Laveze <slaveze@smartandconnective.com>

Looking at the build logic for mosquitto_passwd (and mosquitto_ctrl) I
see they need openssl (and cjson for mosquitto_ctrl). They don't make a
lot of sense without the broker and they are really tiny compared to the
libraries and the broker, so I have changed the patch to automatically
build them if the broker is enabled and the needed libraries.

ls -lahS target/usr/sbin/mosquitto target/usr/bin/mosquitto_* target/usr/lib/libssl.so.3 target/usr/lib/libcrypto.so.3 target/usr/lib/libcjson.so.1.7.18
-rwxr-xr-x 1 peko peko 4.8M Jun  1 00:42 target/usr/lib/libcrypto.so.3
-rwxr-xr-x 1 peko peko 968K Jun  1 00:42 target/usr/lib/libssl.so.3
-rwxr-xr-x 1 peko peko 266K Jun  1 00:42 target/usr/sbin/mosquitto
-rwxr-xr-x 1 peko peko  58K Jun  1 00:42 target/usr/bin/mosquitto_rr
-rwxr-xr-x 1 peko peko  58K Jun  1 00:42 target/usr/bin/mosquitto_sub
-rwxr-xr-x 1 peko peko  54K Jun  1 00:42 target/usr/bin/mosquitto_ctrl
-rwxr-xr-x 1 peko peko  50K Jun  1 00:42 target/usr/bin/mosquitto_pub
-rwxr-xr-x 1 peko peko  34K Jun  1 00:42 target/usr/lib/libcjson.so.1.7.18
-rwxr-xr-x 1 peko peko  26K Jun  1 00:42 target/usr/bin/mosquitto_passwd

And committed to next, thanks.
Sebastien Laveze June 2, 2024, 7:43 a.m. UTC | #2
> And committed to next, thanks.

Great, thanks.
diff mbox series

Patch

diff --git a/package/mosquitto/Config.in b/package/mosquitto/Config.in
index 8bedf2ad21..fe722108da 100644
--- a/package/mosquitto/Config.in
+++ b/package/mosquitto/Config.in
@@ -29,6 +29,13 @@  config BR2_PACKAGE_MOSQUITTO_BROKER
 	help
 	  Build and install the mosquitto broker onto target.
 
+config BR2_PACKAGE_MOSQUITTO_PASSWORD
+	bool "install the target mosquitto password utility"
+	default n
+	depends on BR2_PACKAGE_MOSQUITTO
+	help
+	  Build and install the target mosquitto password utility.
+
 comment "mosquitto broker needs a toolchain w/ dynamic library"
 	depends on BR2_USE_MMU
 	depends on BR2_STATIC_LIBS
diff --git a/package/mosquitto/mosquitto.mk b/package/mosquitto/mosquitto.mk
index b847e56fec..9226d3d7f1 100644
--- a/package/mosquitto/mosquitto.mk
+++ b/package/mosquitto/mosquitto.mk
@@ -94,6 +94,10 @@  ifeq ($(BR2_PACKAGE_MOSQUITTO_BROKER),y)
 MOSQUITTO_MAKE_DIRS += src
 endif
 
+ifeq ($(BR2_PACKAGE_MOSQUITTO_PASSWORD),y)
+MOSQUITTO_MAKE_DIRS += apps/mosquitto_passwd
+endif
+
 define MOSQUITTO_BUILD_CMDS
 	$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) DIRS="$(MOSQUITTO_MAKE_DIRS)" \
 		$(MOSQUITTO_MAKE_OPTS)