Open benfrancis opened 3 months ago
this should be trivial to achieve through the avahi-control interface that allows you to talk to the avahi daemon on the OS (either directly on classic installs or through the snap interface to the avahi snap on UbuntuCore (which you'd indeed need to bundle in the image))
Looking at the existing code you linked above it would indeed need some patching though since it extensively hacks directly into system files (like /etc/hosts and /etc/hostname) and uses long obsoleted tools (like iwlist instead of iw) but looking at the code it would surely benefit from some cleanup and abstraction anyway :)
In the web interface at Settings -> Domain there is a check box to toggle mDNS/DNS-SD broadcasts on and off, and a text field to set the local hostname.
On other platforms this allows users to enable and configure a .local domain.
E.g. see https://github.com/WebThingsIO/gateway/blob/master/src/platforms/linux-raspbian.ts#L492