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:
@@ -5,7 +5,7 @@
|
|||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from logging import getLogger
|
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
|
from ..dbus_helper import DbusInterface
|
||||||
|
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
@@ -85,6 +85,6 @@ AVAILABLE_FEATURES = {
|
|||||||
"revpipyload": FeatureFunction(simple_systemd, ["revpipyload.service"]),
|
"revpipyload": FeatureFunction(simple_systemd, ["revpipyload.service"]),
|
||||||
"bluetooth": False,
|
"bluetooth": False,
|
||||||
"ieee80211": False,
|
"ieee80211": False,
|
||||||
"avahi": False,
|
"avahi": FeatureFunction(configure_avahi_daemon, []),
|
||||||
"external-antenna": False,
|
"external-antenna": False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,18 @@ class RevPiConfig:
|
|||||||
return self._cm_with_wifi
|
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):
|
def configure_gui(action: ConfigActions):
|
||||||
gui_available = access("/usr/bin/startx", X_OK)
|
gui_available = access("/usr/bin/startx", X_OK)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user