feat: update hbc via hb_install.sh instead of code patching

Server now sends a bare UPD command; client runs hb_install.sh to
reinstall from the package registry, then restarts. hb_install.sh
also copies itself alongside hbc on client installs.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andreas Wrede
2026-04-30 13:55:15 -04:00
parent 26ca0c095f
commit c5ce41762e
3 changed files with 49 additions and 49 deletions
+11 -2
View File
@@ -15,8 +15,14 @@ on_ha=0
[ -z "$what" ] && what="client"
if [ -d /homeassistant ]; then
echo "cannot install in HA, run \"docker exec -it homeassistant $0 $@\""
exit 1
echo "cannot install in HA, running \"docker exec homeassistant $0 $@\""
docker exec homeassistant $0 $@
rc=$?
if [ $rc -ne 0 ]; then
echo "Failed to install heartbeat in HA, please check the logs for more details"
exit 1
fi
exit 0
fi
if [ -d /config ]; then
echo "Installing on HA"
@@ -78,6 +84,9 @@ if [ "$what" = "server" ]; then
else
rm -f $where/hbc
ln -sf $(which hbc) $where/hbc
rm -f $where/hb_install.sh
cp "$0" $where/hb_install.sh
chmod +x $where/hb_install.sh
if [ $on_ha -eq 1 ]; then
echo "restarting hbc "
job=$(grep run_hbc configuration.yaml | sed 's/run_hbc://')