* [Buildroot] [PATCH 1/1] package/mdnsd: new package
@ 2023-01-23 5:52 Joachim Wiberg
2023-07-30 14:16 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Joachim Wiberg @ 2023-01-23 5:52 UTC (permalink / raw)
To: buildroot; +Cc: Joachim Wiberg, Thomas Petazzoni
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
DEVELOPERS | 1 +
package/Config.in | 1 +
package/mdnsd/Config.in | 50 +++++++++++++++++++++++
package/mdnsd/S50mdnsd | 51 ++++++++++++++++++++++++
package/mdnsd/ftp.service | 2 +
package/mdnsd/http.service | 2 +
package/mdnsd/ipp.service | 2 +
package/mdnsd/mdnsd.hash | 6 +++
package/mdnsd/mdnsd.mk | 75 +++++++++++++++++++++++++++++++++++
package/mdnsd/printer.service | 2 +
package/mdnsd/ssh.service | 2 +
11 files changed, 194 insertions(+)
create mode 100644 package/mdnsd/Config.in
create mode 100755 package/mdnsd/S50mdnsd
create mode 100644 package/mdnsd/ftp.service
create mode 100644 package/mdnsd/http.service
create mode 100644 package/mdnsd/ipp.service
create mode 100644 package/mdnsd/mdnsd.hash
create mode 100644 package/mdnsd/mdnsd.mk
create mode 100644 package/mdnsd/printer.service
create mode 100644 package/mdnsd/ssh.service
diff --git a/DEVELOPERS b/DEVELOPERS
index e8e0dffcd3..bb12d79b11 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1491,6 +1491,7 @@ F: package/libnet/
F: package/libteam/
F: package/libuev/
F: package/mg/
+F: package/mdnsd/
F: package/mini-snmpd/
F: package/mrouted/
F: package/netcalc/
diff --git a/package/Config.in b/package/Config.in
index 995dae2c57..faa7e7d628 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1932,6 +1932,7 @@ menu "Networking"
source "package/libyang/Config.in"
source "package/lksctp-tools/Config.in"
source "package/mbuffer/Config.in"
+ source "package/mdnsd/Config.in"
source "package/mongoose/Config.in"
source "package/nanomsg/Config.in"
source "package/neon/Config.in"
diff --git a/package/mdnsd/Config.in b/package/mdnsd/Config.in
new file mode 100644
index 0000000000..095a924e98
--- /dev/null
+++ b/package/mdnsd/Config.in
@@ -0,0 +1,50 @@
+config BR2_PACKAGE_MDNSD
+ bool "mdnsd"
+ depends on BR2_USE_MMU # fork()
+ help
+ Small mDNS-SD daemon for advertising services and device discovery,
+ similar to Avahi and Bonjour.
+
+ By default, mdnsd runs on all interfaces that support multicast.
+ It reads services to announce from /etc/mdns.d/*.service, a few
+ common services are included below. To override the defaults,
+ e.g., path to services, TTL of multicast frames, or the default
+ interface, set MDNSD_ARGS in /etc/default/mdnsd
+
+ Note: currently no NSS integration with GLIBC.
+
+if BR2_PACKAGE_MDNSD
+
+config BR2_PACKAGE_MDNSD_MQUERY
+ bool "mquery"
+ default n
+ help
+ Scan a LAN for mDNS capable devices, or query specific records,
+ similar to the mdns-scan tool. Useful for verifying multicast
+ connectivity or locating neighbors with link-local address.
+
+comment "Services to advertise"
+
+config BR2_PACKAGE_MDNSD_FTP_SERVICE
+ bool "FTP service"
+ default n
+
+config BR2_PACKAGE_MDNSD_HTTP_SERVICE
+ bool "HTTP service"
+ default n
+
+config BR2_PACKAGE_MDNSD_IPP_SERVICE
+ bool "IPP service"
+ default n
+
+config BR2_PACKAGE_MDNSD_PRINTER_SERVICE
+ bool "Printer service"
+ default n
+
+config BR2_PACKAGE_MDNSD_SSH_SERVICE
+ bool "SSH service"
+ default y if BR2_PACKAGE_DROPBEAR
+ default y if BR2_PACKAGE_OPENSSH
+ default y if BR2_PACKAGE_LIBSSH_SERVER
+
+endif
diff --git a/package/mdnsd/S50mdnsd b/package/mdnsd/S50mdnsd
new file mode 100755
index 0000000000..1c2b71802c
--- /dev/null
+++ b/package/mdnsd/S50mdnsd
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+DAEMON=mdnsd
+MDNSD=/usr/sbin/$DAEMON
+PIDFILE=/var/run/$DAEMON.pid
+CFGFILE=/etc/default/$DAEMON
+
+MDNSD_ARGS=""
+
+# Read configuration variable file if it is present
+# shellcheck source=/dev/null
+[ -r "$CFGFILE" ] && . "$CFGFILE"
+
+# shellcheck disable=SC2086
+start() {
+ [ -n "$1" ] || printf 'Starting %s: ' "$DAEMON"
+ start-stop-daemon -S -q -p "$PIDFILE" -x "$MDNSD" -- $MDNSD_ARGS
+}
+
+stop() {
+ [ -n "$1" ] || printf 'Stopping %s: ' "$DAEMON"
+ start-stop-daemon -K -q -p "$PIDFILE" -x "$MDNSD"
+}
+
+restart() {
+ printf 'Restarting %s: ' "$DAEMON"
+ stop silent
+ start silent
+}
+
+# SIGHUP reloads /etc/mdns.d/*.service
+reload() {
+ printf 'Reloading %s: ' "$DAEMON"
+ start-stop-daemon -K -s HUP -q -p "$PIDFILE" -x "$MDNSD"
+}
+
+case "$1" in
+ start|stop|restart|reload)
+ if "$1"; then
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload}"
+ exit 1
+ ;;
+esac
+
+exit $?
diff --git a/package/mdnsd/ftp.service b/package/mdnsd/ftp.service
new file mode 100644
index 0000000000..200a379efd
--- /dev/null
+++ b/package/mdnsd/ftp.service
@@ -0,0 +1,2 @@
+type _ftp._tcp
+port 21
diff --git a/package/mdnsd/http.service b/package/mdnsd/http.service
new file mode 100644
index 0000000000..7a40d2405f
--- /dev/null
+++ b/package/mdnsd/http.service
@@ -0,0 +1,2 @@
+type _http._tcp
+port 80
diff --git a/package/mdnsd/ipp.service b/package/mdnsd/ipp.service
new file mode 100644
index 0000000000..0d43e780d1
--- /dev/null
+++ b/package/mdnsd/ipp.service
@@ -0,0 +1,2 @@
+type _ipp._tcp
+port 631
diff --git a/package/mdnsd/mdnsd.hash b/package/mdnsd/mdnsd.hash
new file mode 100644
index 0000000000..2fa7552d85
--- /dev/null
+++ b/package/mdnsd/mdnsd.hash
@@ -0,0 +1,6 @@
+# Upstream sha256 from GitHub
+sha256 1af8742ab82a0af88d99d0b15508358ad4305879ab039631bea889138f5c87e8 mdnsd-0.12.tar.gz
+
+# Locally computed
+sha256 2969546227b58ce1b431cc4c36c9a9b45d604e6b94fb8b787ea5d3696f3eee3b LICENSE
+
diff --git a/package/mdnsd/mdnsd.mk b/package/mdnsd/mdnsd.mk
new file mode 100644
index 0000000000..90a4d4c051
--- /dev/null
+++ b/package/mdnsd/mdnsd.mk
@@ -0,0 +1,75 @@
+################################################################################
+#
+# mdnsd
+#
+################################################################################
+
+MDNSD_VERSION = 0.12
+MDNSD_SITE = https://github.com/troglobit/mdnsd/releases/download/v$(MDNSD_VERSION)
+MDNSD_LICENSE = BSD-3-Clause
+MDNSD_LICENSE_FILES = LICENSE
+MDNSD_DEPENDENCIES = host-pkgconf
+
+ifeq ($(BR2_PACKAGE_MDNSD_MQUERY),y)
+MDNSD_CONF_OPTS += --with-mquery
+else
+MDNSD_CONF_OPTS += --without-mquery
+endif
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+MDNSD_DEPENDENCIES += systemd
+MDNSD_CONF_OPTS += --with-systemd
+else
+MDNSD_CONF_OPTS += --without-systemd
+endif
+
+ifeq ($(BR2_PACKAGE_MDNSD_FTP_SERVICE),y)
+define MDNSD_INSTALL_FTP_SERVICE
+ $(INSTALL) -D -m 0644 package/mdnsd/ftp.service \
+ $(TARGET_DIR)/etc/mdns.d/
+endef
+MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_FTP_SERVICE
+endif
+
+ifeq ($(BR2_PACKAGE_MDNSD_HTTP_SERVICE),y)
+define MDNSD_INSTALL_HTTP_SERVICE
+ $(INSTALL) -D -m 0644 package/mdnsd/http.service \
+ $(TARGET_DIR)/etc/mdns.d/
+endef
+MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_HTTP_SERVICE
+endif
+
+ifeq ($(BR2_PACKAGE_MDNSD_IPP_SERVICE),y)
+define MDNSD_INSTALL_IPP_SERVICE
+ $(INSTALL) -D -m 0644 package/mdnsd/ipp.service \
+ $(TARGET_DIR)/etc/mdns.d/
+endef
+MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_IPP_SERVICE
+endif
+
+ifeq ($(BR2_PACKAGE_MDNSD_PRINTER_SERVICE),y)
+define MDNSD_INSTALL_PRINTER_SERVICE
+ $(INSTALL) -D -m 0644 package/mdnsd/printer.service \
+ $(TARGET_DIR)/etc/mdns.d/
+endef
+MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_PRINTER_SERVICE
+endif
+
+ifeq ($(BR2_PACKAGE_MDNSD_SSH_SERVICE),y)
+define MDNSD_INSTALL_SSH_SERVICE
+ $(INSTALL) -D -m 0644 package/mdnsd/ssh.service \
+ $(TARGET_DIR)/etc/mdns.d/
+endef
+MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_SSH_SERVICE
+endif
+
+define MDNSD_INSTALL_INIT_SYSV
+ $(INSTALL) -m 755 -D package/mdnsd/S50mdnsd $(TARGET_DIR)/etc/init.d/
+endef
+
+define MDNSD_INSTALL_INIT_SYSTEMD
+ $(INSTALL) -D -m 644 $(@D)/mdnsd.service \
+ $(TARGET_DIR)/usr/lib/systemd/system/mdnsd.service
+endef
+
+$(eval $(autotools-package))
diff --git a/package/mdnsd/printer.service b/package/mdnsd/printer.service
new file mode 100644
index 0000000000..cd32295471
--- /dev/null
+++ b/package/mdnsd/printer.service
@@ -0,0 +1,2 @@
+type _printer._tcp
+port 515
diff --git a/package/mdnsd/ssh.service b/package/mdnsd/ssh.service
new file mode 100644
index 0000000000..596d20ba17
--- /dev/null
+++ b/package/mdnsd/ssh.service
@@ -0,0 +1,2 @@
+type _ssh._tcp
+port 22
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/mdnsd: new package
2023-01-23 5:52 [Buildroot] [PATCH 1/1] package/mdnsd: new package Joachim Wiberg
@ 2023-07-30 14:16 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-07-30 14:16 UTC (permalink / raw)
To: Joachim Wiberg; +Cc: buildroot
Hello,
On Mon, 23 Jan 2023 06:52:58 +0100
Joachim Wiberg <troglobit@gmail.com> wrote:
> Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Thanks, I've applied with those changes. See below.
> diff --git a/package/mdnsd/Config.in b/package/mdnsd/Config.in
> new file mode 100644
> index 0000000000..095a924e98
> --- /dev/null
> +++ b/package/mdnsd/Config.in
> @@ -0,0 +1,50 @@
> +config BR2_PACKAGE_MDNSD
> + bool "mdnsd"
> + depends on BR2_USE_MMU # fork()
> + help
> + Small mDNS-SD daemon for advertising services and device discovery,
> + similar to Avahi and Bonjour.
> +
> + By default, mdnsd runs on all interfaces that support multicast.
> + It reads services to announce from /etc/mdns.d/*.service, a few
> + common services are included below. To override the defaults,
> + e.g., path to services, TTL of multicast frames, or the default
> + interface, set MDNSD_ARGS in /etc/default/mdnsd
> +
> + Note: currently no NSS integration with GLIBC.
Some of the lines here were too long, causing a check-package warning.
Also the upstream URL of the project was missing as a last line in the
help text.
> +
> +if BR2_PACKAGE_MDNSD
> +
> +config BR2_PACKAGE_MDNSD_MQUERY
> + bool "mquery"
> + default n
Not needed, being disabled is the default.
> + help
> + Scan a LAN for mDNS capable devices, or query specific records,
> + similar to the mdns-scan tool. Useful for verifying multicast
> + connectivity or locating neighbors with link-local address.
Some of the lines here were too long, causing a check-package warning.
> +comment "Services to advertise"
> +
> +config BR2_PACKAGE_MDNSD_FTP_SERVICE
> + bool "FTP service"
> + default n
> +
> +config BR2_PACKAGE_MDNSD_HTTP_SERVICE
> + bool "HTTP service"
> + default n
> +
> +config BR2_PACKAGE_MDNSD_IPP_SERVICE
> + bool "IPP service"
> + default n
> +
> +config BR2_PACKAGE_MDNSD_PRINTER_SERVICE
> + bool "Printer service"
> + default n
Same comment as above about "default n".
> diff --git a/package/mdnsd/mdnsd.hash b/package/mdnsd/mdnsd.hash
> new file mode 100644
> index 0000000000..2fa7552d85
> --- /dev/null
> +++ b/package/mdnsd/mdnsd.hash
> @@ -0,0 +1,6 @@
> +# Upstream sha256 from GitHub
> +sha256 1af8742ab82a0af88d99d0b15508358ad4305879ab039631bea889138f5c87e8 mdnsd-0.12.tar.gz
> +
> +# Locally computed
> +sha256 2969546227b58ce1b431cc4c36c9a9b45d604e6b94fb8b787ea5d3696f3eee3b LICENSE
> +
This final empty line was causing a check-package warning.
> diff --git a/package/mdnsd/mdnsd.mk b/package/mdnsd/mdnsd.mk
> new file mode 100644
> index 0000000000..90a4d4c051
> --- /dev/null
> +++ b/package/mdnsd/mdnsd.mk
> @@ -0,0 +1,75 @@
> +################################################################################
> +#
> +# mdnsd
> +#
> +################################################################################
> +
> +MDNSD_VERSION = 0.12
> +MDNSD_SITE = https://github.com/troglobit/mdnsd/releases/download/v$(MDNSD_VERSION)
> +MDNSD_LICENSE = BSD-3-Clause
> +MDNSD_LICENSE_FILES = LICENSE
> +MDNSD_DEPENDENCIES = host-pkgconf
> +
> +ifeq ($(BR2_PACKAGE_MDNSD_MQUERY),y)
> +MDNSD_CONF_OPTS += --with-mquery
> +else
> +MDNSD_CONF_OPTS += --without-mquery
> +endif
> +
> +ifeq ($(BR2_PACKAGE_SYSTEMD),y)
> +MDNSD_DEPENDENCIES += systemd
> +MDNSD_CONF_OPTS += --with-systemd
> +else
> +MDNSD_CONF_OPTS += --without-systemd
> +endif
> +
> +ifeq ($(BR2_PACKAGE_MDNSD_FTP_SERVICE),y)
> +define MDNSD_INSTALL_FTP_SERVICE
> + $(INSTALL) -D -m 0644 package/mdnsd/ftp.service \
> + $(TARGET_DIR)/etc/mdns.d/
> +endef
> +MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_FTP_SERVICE
> +endif
> +
> +ifeq ($(BR2_PACKAGE_MDNSD_HTTP_SERVICE),y)
> +define MDNSD_INSTALL_HTTP_SERVICE
> + $(INSTALL) -D -m 0644 package/mdnsd/http.service \
> + $(TARGET_DIR)/etc/mdns.d/
> +endef
> +MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_HTTP_SERVICE
> +endif
> +
> +ifeq ($(BR2_PACKAGE_MDNSD_IPP_SERVICE),y)
> +define MDNSD_INSTALL_IPP_SERVICE
> + $(INSTALL) -D -m 0644 package/mdnsd/ipp.service \
> + $(TARGET_DIR)/etc/mdns.d/
> +endef
> +MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_IPP_SERVICE
> +endif
> +
> +ifeq ($(BR2_PACKAGE_MDNSD_PRINTER_SERVICE),y)
> +define MDNSD_INSTALL_PRINTER_SERVICE
> + $(INSTALL) -D -m 0644 package/mdnsd/printer.service \
> + $(TARGET_DIR)/etc/mdns.d/
> +endef
> +MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_PRINTER_SERVICE
> +endif
> +
> +ifeq ($(BR2_PACKAGE_MDNSD_SSH_SERVICE),y)
> +define MDNSD_INSTALL_SSH_SERVICE
> + $(INSTALL) -D -m 0644 package/mdnsd/ssh.service \
> + $(TARGET_DIR)/etc/mdns.d/
> +endef
> +MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_SSH_SERVICE
> +endif
All of this service handling stuff was very verbose. I've refactored it
like this:
MDNSD_SERVICES_$(BR2_PACKAGE_MDNSD_FTP_SERVICE) += ftp
MDNSD_SERVICES_$(BR2_PACKAGE_MDNSD_HTTP_SERVICE) += http
MDNSD_SERVICES_$(BR2_PACKAGE_MDNSD_IPP_SERVICE) += ipp
MDNSD_SERVICES_$(BR2_PACKAGE_MDNSD_PRINTER_SERVICE) += printer
MDNSD_SERVICES_$(BR2_PACKAGE_MDNSD_SSH_SERVICE) += ssh
define MDNSD_INSTALL_SERVICES
$(foreach service,$(MDNSD_SERVICES_y),\
$(INSTALL) -D -m 0644 package/mdnsd/$(service).service \
$(TARGET_DIR)/etc/mdns.d/$(service).service
)
endef
MDNSD_POST_INSTALL_TARGET_HOOKS += MDNSD_INSTALL_SERVICES
> +define MDNSD_INSTALL_INIT_SYSV
> + $(INSTALL) -m 755 -D package/mdnsd/S50mdnsd $(TARGET_DIR)/etc/init.d/
You need a full destination path here.
As said above: I fixed those various small things when applying.
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-30 14:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-23 5:52 [Buildroot] [PATCH 1/1] package/mdnsd: new package Joachim Wiberg
2023-07-30 14:16 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox