feat(dbus): Add avahi-daemon configuration to system services

Introduce a `configure_avahi_daemon` function to manage the avahi-daemon
service and socket with proper post actions. Update the interface
configuration to enable avahi management using the new function.
This commit is contained in:
2025-04-20 16:16:51 +02:00
parent ffdb27049e
commit 1ae661a5e9
2 changed files with 14 additions and 2 deletions

View File

@@ -5,7 +5,7 @@
from collections import namedtuple
from logging import getLogger
from .revpi_config import ConfigActions, configure_gui, simple_systemd
from .revpi_config import ConfigActions, configure_avahi_daemon, configure_gui, simple_systemd
from ..dbus_helper import DbusInterface
log = getLogger(__name__)
@@ -85,6 +85,6 @@ AVAILABLE_FEATURES = {
"revpipyload": FeatureFunction(simple_systemd, ["revpipyload.service"]),
"bluetooth": False,
"ieee80211": False,
"avahi": False,
"avahi": FeatureFunction(configure_avahi_daemon, []),
"external-antenna": False,
}

View File

@@ -93,6 +93,18 @@ class RevPiConfig:
return self._cm_with_wifi
def configure_avahi_daemon(action: ConfigActions):
return_value = simple_systemd(action, "avahi-daemon.service")
# Post actions for avahi-daemon
if action in (ConfigActions.ENABLE, ConfigActions.DISABLE):
# Apply the enable/disable action to the avahi socket AFTER the service
# unit, because a connected socket could interrupt stop
simple_systemd(action, "avahi-daemon.socket")
return return_value
def configure_gui(action: ConfigActions):
gui_available = access("/usr/bin/startx", X_OK)