Skip to content

Commit f694b47

Browse files
committed
add caps only when available
1 parent 121d483 commit f694b47

File tree

1 file changed

+6
-1
lines changed
  • root/etc/s6-overlay/s6-rc.d/svc-homeassistant

1 file changed

+6
-1
lines changed

root/etc/s6-overlay/s6-rc.d/svc-homeassistant/run

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33

44
PY_LOCAL_PATH=$(find /usr/local/lib -maxdepth 1 -name python* -type d)
55
PY_LOCAL_BIN=$(basename "${PY_LOCAL_PATH}")
6-
setcap 'cap_net_raw,cap_net_admin,cap_net_bind_service=+ep' "/usr/local/bin/${PY_LOCAL_BIN}"
6+
if capsh --has-p=cap_net_admin 2>/dev/null && capsh --has-p=cap_net_raw 2>/dev/null; then
7+
echo "Adding cap_net_admin and cap_net_raw to python binary for bt access"
8+
setcap 'cap_net_bind_service,cap_net_raw,cap_net_admin=+ep' "/usr/local/bin/${PY_LOCAL_BIN}"
9+
else
10+
setcap 'cap_net_bind_service=+ep' "/usr/local/bin/${PY_LOCAL_BIN}"
11+
fi
712

813
if [[ -z "${DISABLE_JEMALLOC+x}" ]]; then
914
export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"

0 commit comments

Comments
 (0)