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 <fl@n621.de>
[Thomas: make the option default to disabled, fix small formatting issues.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Florian Larysch 2020-12-04 18:45:08 +01:00 committed by Thomas Petazzoni
parent 10b8d6e512
commit ebce685e1d
2 changed files with 16 additions and 0 deletions

View File

@ -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"

View File

@ -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))