Skip to contentSkip to conversation

package/avahi: allow disabling default services

PATCH In review Florian Larysch 5 participants 6 messages Dec 4, 2020 – Jan 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/avahi: allow disabling default services

By default, Avahi installs service definitions for SSH and SFTP, but those might not be present on all systems. Add an option for disabling them.

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.

---
 package/avahi/Config.in | 8 ++++++++
 package/avahi/avahi.mk  | 9 +++++++++
 2 files changed, 17 insertions(+)
package/avahi/Config.in +8 -0
index 5e303d044e..4a000dd676 100644
@@ -42,6 +42,14 @@ 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
+	default y
+	help
+	  Install the SSH/SFTP service definitions included with the Avahi
+	  daemon by default.
+
 endif
 
 comment "avahi needs a toolchain w/ threads"
package/avahi/avahi.mk +9 -0
index eef05f0d2f..b8aea90fcc 100644
@@ -184,4 +184,13 @@ endef
 AVAHI_POST_INSTALL_STAGING_HOOKS += AVAHI_STAGING_INSTALL_LIBDNSSD_LINK
 endif
 
+ifeq (${BR2_PACKAGE_AVAHI_DEFAULT_SERVICES},)
+define AVAHI_REMOVE_DEFAULT_SERVICES
+	for service in ssh sftp-ssh; do \
+		$(RM) -f $(TARGET_DIR)/etc/avahi/services/$${service}.service; \
+	done
+endef
+AVAHI_POST_INSTALL_TARGET_HOOKS += AVAHI_REMOVE_DEFAULT_SERVICES
+endif
+
 $(eval $(autotools-package))
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/1 package/avahi: allow disabling default services

Florian, All

Quoted 4 lines · Florian Larysch

By default, Avahi installs service definitions for SSH and SFTP, but those might not be present on all systems. Add an option for disabling them.

I have this removal in all my post-build scripts. So it would be great to have it as an option. I would even suggest to always remove the .service files and make it optional. I think an embedded system should explicitly enable services.

package/avahi/Config.in config BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY · line 48

Quoted 5 lines
package/avahi/Config.in +4 -0
+config BR2_PACKAGE_AVAHI_DEFAULT_SERVICES
+	bool "install default service definitions"
+	depends on BR2_PACKAGE_AVAHI_DAEMON
+	default y

If kept as an Option: default this to n?

Regards,
Michael

#2 lore raw

PATCH 1/1 package/avahi: allow disabling default services

Quoted 14 lines · Michael Nosthoff via buildroot

Florian, All

Quoted 4 lines · Florian Larysch

By default, Avahi installs service definitions for SSH and SFTP, but those might not be present on all systems. Add an option for disabling them.

I have this removal in all my post-build scripts. So it would be great to have it as an option. I would even suggest to always remove the .service files and make it optional. I think an embedded system should explicitly enable services.

Quoted 1 line
Quoted 6 lines

package/avahi/Config.in config BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY · line 48

Quoted 4 lines
package/avahi/Config.in +4 -0
+config BR2_PACKAGE_AVAHI_DEFAULT_SERVICES
+	bool "install default service definitions"
+	depends on BR2_PACKAGE_AVAHI_DAEMON
+	default y

If kept as an Option: default this to n?

To make it easy to upgrade Buildroot, we want as much as possible to make sure
that existing configurations still work. If you have an existing configuration that actually relies on these services to be installed, then it would be very annoying if they just disappear under your feet... So in general, we want the default to reflect the old situation. That means that adding an option that removes something will generally have to default y.

This policy is far from ideal, because it means people will often have to
explicitly unset this option. In many cases, even for existing configs, unsetting it is in fact the right thing to do.

So maybe we should consider changing this policy.

I think we should only do that if we also add a prominent file in the root,
e.g. UPGRADING, that makes explicit note of such changes. Some time ago, I tried to keep something like that going by editing CHANGES, but it didn't amount to much, and that file is so full that it's hard to find the relevant bits.

I've added a bunch of random people in Cc whom I think might have a relevant
opinion about this. I hope nobody will feel offended because I didn't include them :-)

If this idea gains traction, I volunteer to write a skeleton UPGRADING file,
and refer to it from the manual. I've been thinking for a long time already that I really should add a section to the manual about what to do when you upgrade Buildroot, and this would be the ideal push for me.

Regards,
Arnout

#3 lore raw

PATCH 1/1 package/avahi: allow disabling default services

Arnout, All,

On 2021-04-15 21:02 +0200, Arnout Vandecappelle spake thusly:

Quoted 5 lines · Michael Nosthoff via buildroot
Quoted 4 lines · Florian Larysch
Quoted 3 lines

By default, Avahi installs service definitions for SSH and SFTP, but those might not be present on all systems. Add an option for disabling them.

[--SNIP--]

Quoted 6 lines
Quoted 5 lines

package/avahi/Config.in config BR2_PACKAGE_AVAHI_LIBDNSSD_COMPATIBILITY · line 48

Quoted 4 lines
package/avahi/Config.in +4 -0
+config BR2_PACKAGE_AVAHI_DEFAULT_SERVICES
+	bool "install default service definitions"
+	depends on BR2_PACKAGE_AVAHI_DAEMON
+	default y

If kept as an Option: default this to n?

Quoted 6 lines

To make it easy to upgrade Buildroot, we want as much as possible to make sure
that existing configurations still work. If you have an existing configuration that actually relies on these services to be installed, then it would be very annoying if they just disappear under your feet... So in general, we want the default to reflect the old situation. That means that adding an option that removes something will generally have to default y.

An option that defaults to 'y' will have to do so forever and ever...

Quoted 3 lines

This policy is far from ideal, because it means people will often have to
explicitly unset this option. In many cases, even for existing configs, unsetting it is in fact the right thing to do.

And for new, from-scratch configurations, this is not nice either, because most options default to 'n', while only a bunch default to 'y', and this is not very consistent...

Quoted 1 line

So maybe we should consider changing this policy.

I would very well be in favour of dropping the policy to be backward-compatible in such a situation.

Quoted 1 line

I think we should only do that if we also add a prominent file in the root,

Did you mean: s/root/top-directory of the Buildroot tree/ ?

Quoted 3 lines

e.g. UPGRADING, that makes explicit note of such changes. Some time ago, I tried to keep something like that going by editing CHANGES, but it didn't amount to much, and that file is so full that it's hard to find the relevant bits.

This is going to bit-rot eventually... :-/

Quoted 8 lines

I've added a bunch of random people in Cc whom I think might have a relevant
opinion about this. I hope nobody will feel offended because I didn't include them :-)

If this idea gains traction, I volunteer to write a skeleton UPGRADING file,
and refer to it from the manual. I've been thinking for a long time already that I really should add a section to the manual about what to do when you upgrade Buildroot, and this would be the ideal push for me.

What about the existing section, then:
https://buildroot.org/downloads/manual/manual.html#migrating-from-ol-versions

(notice the typo in the anchor, giving away who wrote it ;-] And even then, that typo is still fitting my ol' little me... ;-] )

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 package/avahi: allow disabling default services

Quoted 3 lines · Yann E. MORIN

Arnout, All,

On 2021-04-15 21:02 +0200, Arnout Vandecappelle spake thusly:

[snip]

Quoted 5 lines
Quoted 3 lines

e.g. UPGRADING, that makes explicit note of such changes. Some time ago, I tried to keep something like that going by editing CHANGES, but it didn't amount to much, and that file is so full that it's hard to find the relevant bits.

This is going to bit-rot eventually... :-/

It's similar to Config.in.legacy, for all the things that can't be expressed in
Kconfig. So how is it going to bitrot?

It could also be put in the manual directly, but I actually think it's harder
to find there.

Quoted 5 lines
Quoted 5 lines

I've added a bunch of random people in Cc whom I think might have a relevant
opinion about this. I hope nobody will feel offended because I didn't include them :-)

Quoted 7 lines
Quoted 4 lines

If this idea gains traction, I volunteer to write a skeleton UPGRADING file,
and refer to it from the manual. I've been thinking for a long time already that I really should add a section to the manual about what to do when you upgrade Buildroot, and this would be the ideal push for me.

What about the existing section, then:
https://buildroot.org/downloads/manual/manual.html#migrating-from-ol-versions

Heh, I searched for variations of upgrade and update, not for migrate :-)

Goes to show that it's not very discoverable!

Regards,
Arnout

Quoted 7 lines

(notice the typo in the anchor, giving away who wrote it ;-] And even then, that typo is still fitting my ol' little me... ;-] )

Regards,
Yann E. MORIN.

#5 lore raw
In reply to Florian Larysch

Hello Florian,

Quoted 8 lines · On Fri, 4 Dec 2020 18:45:08 +0100 Florian Larysch <[email protected]> wrote:

By default, Avahi installs service definitions for SSH and SFTP, but those might not be present on all systems. Add an option for disabling them.

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.

Quoted 5 lines
---
 package/avahi/Config.in | 8 ++++++++
 package/avahi/avahi.mk  | 9 +++++++++
 2 files changed, 17 insertions(+)

I have finally applied this patch! With some changes:

* I made the option default to disabled, following the discussion that took place

* Fixed some formatting issues reported by "make check-package"

* Used a make foreach loop instead of a shell for loop

* Used $(...) to refer to the make variable instead of ${...}

Thanks a lot, and sorry for the long delay!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot