From ade6c5a90528bfee343fb1da3ff5d0099a1aed64 Mon Sep 17 00:00:00 2001 From: tteckster Date: Fri, 4 Nov 2022 05:27:17 -0400 Subject: [PATCH] Update podman-homeassistant-v4.sh If the LXC is created Privileged, the script will automatically set up USB passthrough. --- ct/podman-homeassistant-v4.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ct/podman-homeassistant-v4.sh b/ct/podman-homeassistant-v4.sh index df926cb6..87bf6dea 100644 --- a/ct/podman-homeassistant-v4.sh +++ b/ct/podman-homeassistant-v4.sh @@ -259,11 +259,26 @@ export PCT_OPTIONS=" $PW " bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit + +if [ "$CT_TYPE" == "0" ]; then LXC_CONFIG=/etc/pve/lxc/${CTID}.conf -cat <>$LXC_CONFIG + cat <>$LXC_CONFIG +lxc.cgroup2.devices.allow: a +lxc.cap.drop: +lxc.cgroup2.devices.allow: c 188:* rwm +lxc.cgroup2.devices.allow: c 189:* rwm +lxc.mount.entry: /dev/serial/by-id dev/serial/by-id none bind,optional,create=dir +lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file +lxc.mount.entry: /dev/ttyUSB1 dev/ttyUSB1 none bind,optional,create=file +lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file +lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file +EOF +else + cat <>$LXC_CONFIG lxc.cgroup2.devices.allow: a lxc.cap.drop: EOF +fi msg_info "Starting LXC Container" pct start $CTID msg_ok "Started LXC Container"