mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-25 18:16:32 +00:00
Allow Core access to dbus for bluetooth (#1883)
This commit is contained in:
parent
7deed55c2d
commit
19ca485c28
@ -19,6 +19,7 @@ from .const import (
|
|||||||
ENV_SUPERVISOR_MACHINE,
|
ENV_SUPERVISOR_MACHINE,
|
||||||
ENV_SUPERVISOR_NAME,
|
ENV_SUPERVISOR_NAME,
|
||||||
ENV_SUPERVISOR_SHARE,
|
ENV_SUPERVISOR_SHARE,
|
||||||
|
MACHINE_ID,
|
||||||
SOCKET_DOCKER,
|
SOCKET_DOCKER,
|
||||||
SUPERVISOR_VERSION,
|
SUPERVISOR_VERSION,
|
||||||
CoreStates,
|
CoreStates,
|
||||||
@ -48,9 +49,6 @@ from .utils.dt import fetch_timezone
|
|||||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
MACHINE_ID = Path("/etc/machine-id")
|
|
||||||
|
|
||||||
|
|
||||||
async def initialize_coresys() -> CoreSys:
|
async def initialize_coresys() -> CoreSys:
|
||||||
"""Initialize supervisor coresys/objects."""
|
"""Initialize supervisor coresys/objects."""
|
||||||
coresys = CoreSys()
|
coresys = CoreSys()
|
||||||
|
@ -30,6 +30,7 @@ FILE_HASSIO_AUDIO = Path(SUPERVISOR_DATA, "audio.json")
|
|||||||
FILE_HASSIO_CLI = Path(SUPERVISOR_DATA, "cli.json")
|
FILE_HASSIO_CLI = Path(SUPERVISOR_DATA, "cli.json")
|
||||||
FILE_HASSIO_MULTICAST = Path(SUPERVISOR_DATA, "multicast.json")
|
FILE_HASSIO_MULTICAST = Path(SUPERVISOR_DATA, "multicast.json")
|
||||||
|
|
||||||
|
MACHINE_ID = Path("/etc/machine-id")
|
||||||
SOCKET_DOCKER = Path("/run/docker.sock")
|
SOCKET_DOCKER = Path("/run/docker.sock")
|
||||||
|
|
||||||
DOCKER_NETWORK = "hassio"
|
DOCKER_NETWORK = "hassio"
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from ..const import ENV_TIME
|
from ..const import ENV_TIME, MACHINE_ID
|
||||||
from ..coresys import CoreSysAttributes
|
from ..coresys import CoreSysAttributes
|
||||||
from ..exceptions import DockerAPIError
|
from ..exceptions import DockerAPIError
|
||||||
from .interface import DockerInterface
|
from .interface import DockerInterface
|
||||||
@ -35,6 +35,10 @@ class DockerAudio(DockerInterface, CoreSysAttributes):
|
|||||||
"/run/dbus": {"bind": "/run/dbus", "mode": "ro"},
|
"/run/dbus": {"bind": "/run/dbus", "mode": "ro"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Machine ID
|
||||||
|
if MACHINE_ID.exists():
|
||||||
|
volumes.update({str(MACHINE_ID): {"bind": str(MACHINE_ID), "mode": "ro"}})
|
||||||
|
|
||||||
# SND support
|
# SND support
|
||||||
if Path("/dev/snd").exists():
|
if Path("/dev/snd").exists():
|
||||||
volumes.update({"/dev/snd": {"bind": "/dev/snd", "mode": "rw"}})
|
volumes.update({"/dev/snd": {"bind": "/dev/snd", "mode": "rw"}})
|
||||||
|
@ -6,7 +6,7 @@ from typing import Awaitable, Dict, Optional
|
|||||||
|
|
||||||
import docker
|
import docker
|
||||||
|
|
||||||
from ..const import ENV_TIME, ENV_TOKEN, ENV_TOKEN_OLD, LABEL_MACHINE
|
from ..const import ENV_TIME, ENV_TOKEN, ENV_TOKEN_OLD, LABEL_MACHINE, MACHINE_ID
|
||||||
from ..exceptions import DockerAPIError
|
from ..exceptions import DockerAPIError
|
||||||
from .interface import CommandReturn, DockerInterface
|
from .interface import CommandReturn, DockerInterface
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ class DockerHomeAssistant(DockerInterface):
|
|||||||
@property
|
@property
|
||||||
def volumes(self) -> Dict[str, Dict[str, str]]:
|
def volumes(self) -> Dict[str, Dict[str, str]]:
|
||||||
"""Return Volumes for the mount."""
|
"""Return Volumes for the mount."""
|
||||||
volumes = {}
|
volumes = {"/run/dbus": {"bind": "/run/dbus", "mode": "ro"}}
|
||||||
|
|
||||||
# Add folders
|
# Add folders
|
||||||
volumes.update(
|
volumes.update(
|
||||||
@ -65,6 +65,10 @@ class DockerHomeAssistant(DockerInterface):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Machine ID
|
||||||
|
if MACHINE_ID.exists():
|
||||||
|
volumes.update({str(MACHINE_ID): {"bind": str(MACHINE_ID), "mode": "ro"}})
|
||||||
|
|
||||||
# Configuration Audio
|
# Configuration Audio
|
||||||
volumes.update(
|
volumes.update(
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user