Skip to content

Commit

Permalink
detect bt and add necessary caps
Browse files Browse the repository at this point in the history
  • Loading branch information
aptalca committed Dec 15, 2023
1 parent eb4c043 commit 175d8e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion root/etc/s6-overlay/s6-rc.d/svc-homeassistant/run
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

setcap 'cap_net_bind_service=+ep cap_net_raw,cap_net_admin+eip' /usr/bin/python3.11
if [[ -d "/var/run/dbus" ]] && capsh --current | grep "Current:" | grep -q "cap_net_admin" && capsh --current | grep "Current:" | grep -q "cap_net_raw"; then
echo "**** Bluetooth detected, setting the necessary caps for HA ****"
setcap 'cap_net_bind_service=+ep cap_net_raw,cap_net_admin+eip' /usr/bin/python3.11
else
setcap 'cap_net_bind_service=+ep' /usr/bin/python3.11
fi

exec \
s6-notifyoncheck -d -n 60 -w 5000 -c "nc -z localhost 8123" \
Expand Down

0 comments on commit 175d8e4

Please sign in to comment.