mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-14 12:46:32 +00:00
Append devlinks to serial dev_list (#1131)
* append devlinks to dev_list * replace eudev-libs with eudev * include only devlinks starting with /dev/serial/by-id * add missing package, move udev init to entry.sh * fix mode on entry.sh * Update homeassistant.py * Update homeassistant.py
This commit is contained in:
parent
69151b962a
commit
7bd77c6e99
@ -12,6 +12,7 @@ RUN apk add --no-cache \
|
|||||||
socat \
|
socat \
|
||||||
glib \
|
glib \
|
||||||
libstdc++ \
|
libstdc++ \
|
||||||
|
eudev \
|
||||||
eudev-libs
|
eudev-libs
|
||||||
|
|
||||||
# Install requirements
|
# Install requirements
|
||||||
@ -25,4 +26,8 @@ RUN export MAKEFLAGS="-j$(nproc)" \
|
|||||||
COPY . /usr/src/hassio
|
COPY . /usr/src/hassio
|
||||||
RUN pip3 install --no-cache-dir -e /usr/src/hassio
|
RUN pip3 install --no-cache-dir -e /usr/src/hassio
|
||||||
|
|
||||||
|
# Initialize udev daemon, handle CMD
|
||||||
|
COPY entry.sh /bin/
|
||||||
|
ENTRYPOINT ["/bin/entry.sh"]
|
||||||
|
|
||||||
CMD [ "python3", "-m", "hassio" ]
|
CMD [ "python3", "-m", "hassio" ]
|
||||||
|
13
entry.sh
Executable file
13
entry.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
udevd --daemon
|
||||||
|
udevadm trigger
|
||||||
|
|
||||||
|
if CMD="$(command -v "$1")"; then
|
||||||
|
shift
|
||||||
|
exec "$CMD" "$@"
|
||||||
|
else
|
||||||
|
echo "Command not found: $1"
|
||||||
|
exit 1
|
||||||
|
fi
|
@ -40,14 +40,6 @@ class DockerHomeAssistant(DockerInterface):
|
|||||||
"""Return timeout for Docker actions."""
|
"""Return timeout for Docker actions."""
|
||||||
return 60
|
return 60
|
||||||
|
|
||||||
@property
|
|
||||||
def devices(self):
|
|
||||||
"""Create list of special device to map into Docker."""
|
|
||||||
devices = []
|
|
||||||
for device in self.sys_hardware.serial_devices:
|
|
||||||
devices.append(f"{device}:{device}:rwm")
|
|
||||||
return devices or None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ip_address(self) -> IPv4Address:
|
def ip_address(self) -> IPv4Address:
|
||||||
"""Return IP address of this container."""
|
"""Return IP address of this container."""
|
||||||
@ -73,7 +65,6 @@ class DockerHomeAssistant(DockerInterface):
|
|||||||
detach=True,
|
detach=True,
|
||||||
privileged=True,
|
privileged=True,
|
||||||
init=True,
|
init=True,
|
||||||
devices=self.devices,
|
|
||||||
network_mode="host",
|
network_mode="host",
|
||||||
environment={
|
environment={
|
||||||
"HASSIO": self.sys_docker.network.supervisor,
|
"HASSIO": self.sys_docker.network.supervisor,
|
||||||
@ -106,7 +97,6 @@ class DockerHomeAssistant(DockerInterface):
|
|||||||
command,
|
command,
|
||||||
privileged=True,
|
privileged=True,
|
||||||
init=True,
|
init=True,
|
||||||
devices=self.devices,
|
|
||||||
detach=True,
|
detach=True,
|
||||||
stdout=True,
|
stdout=True,
|
||||||
stderr=True,
|
stderr=True,
|
||||||
|
@ -39,6 +39,15 @@ class Hardware:
|
|||||||
if "ID_VENDOR" in device or RE_TTY.search(device.device_node):
|
if "ID_VENDOR" in device or RE_TTY.search(device.device_node):
|
||||||
dev_list.add(device.device_node)
|
dev_list.add(device.device_node)
|
||||||
|
|
||||||
|
# Add /dev/serial/by-id devlink for current device
|
||||||
|
if "DEVLINKS" in device and device["DEVLINKS"]:
|
||||||
|
devlinks = [
|
||||||
|
symlink
|
||||||
|
for symlink in device["DEVLINKS"].split(" ")
|
||||||
|
if symlink.startswith("/dev/serial/by-id")
|
||||||
|
]
|
||||||
|
dev_list.update(devlinks)
|
||||||
|
|
||||||
return dev_list
|
return dev_list
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user