Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6aae2a1dab | |||
| 85ee0e1040 |
+1
-1
@@ -14,4 +14,4 @@ Install options:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__all__ = ["__version__"]
|
__all__ = ["__version__"]
|
||||||
__version__ = "5.1.8"
|
__version__ = "5.1.9"
|
||||||
|
|||||||
+4
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "hbd"
|
name = "hbd"
|
||||||
version = "5.1.8"
|
version = "5.1.9"
|
||||||
description = "Heartbeat monitoring system — client (hbc) and server (hbd)"
|
description = "Heartbeat monitoring system — client (hbc) and server (hbd)"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
@@ -34,6 +34,9 @@ server = [
|
|||||||
"matrix-nio>=0.24",
|
"matrix-nio>=0.24",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Minimal client — hbc_mini only, no external dependencies
|
||||||
|
mini = []
|
||||||
|
|
||||||
# Install both client and server
|
# Install both client and server
|
||||||
all = [
|
all = [
|
||||||
"hbd[client,server]",
|
"hbd[client,server]",
|
||||||
|
|||||||
+36
-9
@@ -12,11 +12,14 @@
|
|||||||
set -e
|
set -e
|
||||||
what=$1
|
what=$1
|
||||||
on_ha=0
|
on_ha=0
|
||||||
|
where=""
|
||||||
|
venv=""
|
||||||
|
[ "$2" = "HA" ] && on_ha=1
|
||||||
[ -z "$what" ] && what="client"
|
[ -z "$what" ] && what="client"
|
||||||
|
|
||||||
if [ -d /homeassistant ]; then
|
if [ -d /homeassistant ]; then
|
||||||
echo "cannot install in HA, running \"docker exec homeassistant $0 $@\""
|
echo "HA, running \"docker exec homeassistant $0 $@\""
|
||||||
docker exec homeassistant $0 $@
|
docker exec homeassistant $0 $@ HA
|
||||||
rc=$?
|
rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
if [ $rc -ne 0 ]; then
|
||||||
echo "Failed to install heartbeat in HA, please check the logs for more details"
|
echo "Failed to install heartbeat in HA, please check the logs for more details"
|
||||||
@@ -24,11 +27,11 @@ if [ -d /homeassistant ]; then
|
|||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if [ -d /config ]; then
|
|
||||||
echo "Installing on HA"
|
if [ $on_ha -eq 1 ]; then
|
||||||
|
echo "Installing under docker on Home Assistant OS, using /config/bin for executables and /config/venvs for virtual environments "
|
||||||
where="/config/bin"
|
where="/config/bin"
|
||||||
venv="/config/venvs"
|
venv="/config/venvs"
|
||||||
on_ha=1
|
|
||||||
else
|
else
|
||||||
if [ ! -d $HOME/.local/bin ] && [ ! -d $HOME/bin ]; then
|
if [ ! -d $HOME/.local/bin ] && [ ! -d $HOME/bin ]; then
|
||||||
echo "No suitable bin directory found in PATH, please add either $HOME/.local/bin or $HOME/bin to your PATH"
|
echo "No suitable bin directory found in PATH, please add either $HOME/.local/bin or $HOME/bin to your PATH"
|
||||||
@@ -43,18 +46,23 @@ else
|
|||||||
echo "No suitable bin directory found in PATH, please add either $HOME/.local/bin or $HOME/bin to your PATH"
|
echo "No suitable bin directory found in PATH, please add either $HOME/.local/bin or $HOME/bin to your PATH"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ "$what" = "mini" ]; then
|
||||||
|
venv=""
|
||||||
|
else
|
||||||
venv="$HOME/venvs"
|
venv="$HOME/venvs"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Installing heartbeat $what"
|
echo "Installing heartbeat $what"
|
||||||
|
|
||||||
if [ ! -d $venv/hbd ]; then
|
if [ "$venv" != "" ] && [ ! -d $venv/hbd ]; then
|
||||||
set +e
|
set +e
|
||||||
python3 -m pip --version > /dev/null 2>&1
|
python3 -m pip --version > /dev/null 2>&1
|
||||||
rc=$?
|
rc=$?
|
||||||
set -e
|
set -e
|
||||||
|
arg=""
|
||||||
if [ $rc -ne 0 ]; then
|
if [ $rc -ne 0 ]; then
|
||||||
# truenas does not have pip installed by default, so we need to fetch get-pip.py and install pip
|
# some systems do not have pip installed by default, so we need to fetch get-pip.py and install pip
|
||||||
echo "pip is not installed, fetching get-pip.py and installing pip"
|
echo "pip is not installed, fetching get-pip.py and installing pip"
|
||||||
arg="--without-pip"
|
arg="--without-pip"
|
||||||
fi
|
fi
|
||||||
@@ -74,19 +82,32 @@ if [ ! -d $venv/hbd ]; then
|
|||||||
deactivate
|
deactivate
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$venv" ]; then
|
||||||
|
echo "Installing heartbeat $what globally"
|
||||||
|
else
|
||||||
|
echo "Installing heartbeat $what in virtual environment $venv/hbd"
|
||||||
. $venv/hbd/bin/activate
|
. $venv/hbd/bin/activate
|
||||||
|
fi
|
||||||
python3 -mpip install --upgrade --index-url https://git.wrede.ca/api/packages/andreas/pypi/simple/ --extra-index-url https://pypi.org/simple hbd[$what]
|
python3 -mpip install --upgrade --index-url https://git.wrede.ca/api/packages/andreas/pypi/simple/ --extra-index-url https://pypi.org/simple hbd[$what]
|
||||||
|
|
||||||
if [ "$what" = "server" ]; then
|
if [ "$what" = "server" ]; then
|
||||||
rm -f $where/hbd
|
rm -f $where/hbd
|
||||||
ln -sf $(which hbd) $where/hbd
|
ln -sf $(which hbd) $where/hbd
|
||||||
echo "hbd installed, you can run it with \"$where/hbd\" or \"hbd\" if $where is in your PATH"
|
echo "hbd installed, you can run it with \"$where/hbd\" or \"hbd\" if $where is in your PATH"
|
||||||
else
|
elif [ "$what" = "client" ]; then
|
||||||
|
hbc_path=$(which hbc)
|
||||||
|
if [ -z "$hbc_path" ]; then
|
||||||
|
echo "hbc not found in PATH, installation failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "$hbc_path" != "$where/hbc" ]; then
|
||||||
rm -f $where/hbc
|
rm -f $where/hbc
|
||||||
ln -sf $(which hbc) $where/hbc
|
ln -sf $(which hbc) $where/hbc
|
||||||
# rm -f $where/hb_install.sh
|
fi
|
||||||
|
if [ "$0" != "$where/hb_install.sh" ]; then
|
||||||
cp "$0" $where/hb_install.sh
|
cp "$0" $where/hb_install.sh
|
||||||
chmod +x $where/hb_install.sh
|
chmod +x $where/hb_install.sh
|
||||||
|
fi
|
||||||
if [ $on_ha -eq 1 ]; then
|
if [ $on_ha -eq 1 ]; then
|
||||||
echo "restarting hbc "
|
echo "restarting hbc "
|
||||||
job=$(grep run_hbc configuration.yaml | sed 's/run_hbc://')
|
job=$(grep run_hbc configuration.yaml | sed 's/run_hbc://')
|
||||||
@@ -94,4 +115,10 @@ else
|
|||||||
else
|
else
|
||||||
echo "hbc installed, you can run it with \"$where/hbc\" or \"hbc\" if $where is in your PATH"
|
echo "hbc installed, you can run it with \"$where/hbc\" or \"hbc\" if $where is in your PATH"
|
||||||
fi
|
fi
|
||||||
|
elif [ "$what" = "mini" ]; then
|
||||||
|
hbc_path=$(which hbc_mini)
|
||||||
|
if [ "$hbc_path" != "$where/hbc_mini" ]; then
|
||||||
|
ln -sf $(which hbc) $where/hbc_mini
|
||||||
|
fi
|
||||||
|
echo "hbc mini installed, you can run it with \"$where/hbc_mini\" or \"hbc_mini\" if $where is in your PATH"
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -875,7 +875,7 @@ async def _handle_update(conn: AsyncConnection):
|
|||||||
log.info("running installer: %s", installer)
|
log.info("running installer: %s", installer)
|
||||||
try:
|
try:
|
||||||
proc = await asyncio.create_subprocess_exec(
|
proc = await asyncio.create_subprocess_exec(
|
||||||
installer, "client",
|
installer, "miniclient",
|
||||||
stdout=asyncio.subprocess.PIPE,
|
stdout=asyncio.subprocess.PIPE,
|
||||||
stderr=asyncio.subprocess.STDOUT,
|
stderr=asyncio.subprocess.STDOUT,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user