From ebce685e1d60b47b8fc5490a5820b79fc3a913ca Mon Sep 17 00:00:00 2001 From: Florian Larysch Date: Fri, 4 Dec 2020 18:45:08 +0100 Subject: [PATCH] package/avahi: add option to enable/disable default services By default, Avahi installs service definitions for SSH and SFTP, but those might not be present on all systems. This commit adds an option to control the installation of those Avahi services. Even though that potentially breaks backward compatibility with older configuration, we have chosen to make the option default to disable, which means that now the SSH and SFTP avahi services are no longer installed by default. As there is no way to tell the Avahi package not to install the service files in the first place, we have to manually remove them from the target directory. Signed-off-by: Florian Larysch [Thomas: make the option default to disabled, fix small formatting issues.] Signed-off-by: Thomas Petazzoni --- package/avahi/Config.in | 7 +++++++ package/avahi/avahi.mk | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/package/avahi/Config.in b/package/avahi/Config.in index 5e303d044e..95b01bfe92 100644 --- a/package/avahi/Config.in +++ b/package/avahi/Config.in @@ -42,6 +42,13 @@ config BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY Enable the libdns_sd (Bonjour) compatibility library support for legacy applications. +config BR2_PACKAGE_AVAHI_DEFAULT_SERVICES + bool "install default service definitions" + depends on BR2_PACKAGE_AVAHI_DAEMON + help + Install the SSH/SFTP service definitions included with the + Avahi daemon by default. + endif comment "avahi needs a toolchain w/ threads" diff --git a/package/avahi/avahi.mk b/package/avahi/avahi.mk index 9de6ebc4d2..13e2106014 100644 --- a/package/avahi/avahi.mk +++ b/package/avahi/avahi.mk @@ -193,4 +193,13 @@ endef AVAHI_POST_INSTALL_STAGING_HOOKS += AVAHI_STAGING_INSTALL_LIBDNSSD_LINK endif +ifeq ($(BR2_PACKAGE_AVAHI_DEFAULT_SERVICES),) +define AVAHI_REMOVE_DEFAULT_SERVICES + $(foreach service,ssh sftp-ssh, \ + $(RM) -f $(TARGET_DIR)/etc/avahi/services/$(service).service + ) +endef +AVAHI_POST_INSTALL_TARGET_HOOKS += AVAHI_REMOVE_DEFAULT_SERVICES +endif + $(eval $(autotools-package))