Merge branch 'master' of git.wrede.ca:andreas/heartbeat
This commit is contained in:
+25
-8
@@ -1,5 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# install the heartbeat client, hbc. The server is installed when the arg 'server' is passed
|
||||||
# install the heartbeat client, hbc. The server is installed when the arg 'server' is passed
|
# install the heartbeat client, hbc. The server is installed when the arg 'server' is passed
|
||||||
# to the script. The script will install the heartbeat tools in a python
|
# to the script. The script will install the heartbeat tools in a python
|
||||||
# virtual environment in ~/venvs/hbd. The hbd and hbc commands will be
|
# virtual environment in ~/venvs/hbd. The hbd and hbc commands will be
|
||||||
@@ -14,11 +15,27 @@
|
|||||||
set -e
|
set -e
|
||||||
what=$1
|
what=$1
|
||||||
|
|
||||||
for where in ~/.local/bin ~/bin; do
|
if [ -d /homeassistant ]; then
|
||||||
if echo ":$PATH:" | grep -q ":$where:" ; then
|
echo "cannot install in HA, run \"docker exec -it homeassistant $0 $@\""
|
||||||
break
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -d /config ]; then
|
||||||
|
echo "Installing on HA"
|
||||||
|
where="/config/bin"
|
||||||
|
venv="/config/venvs"
|
||||||
|
else
|
||||||
|
if [ ! -d ~/.local/bin ] && [ ! -d ~/bin ]; then
|
||||||
|
echo "No suitable bin directory found in PATH, please add either ~/.local/bin or ~/bin to your PATH"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
for where in ~/bin ~/.local/bin; do
|
||||||
|
if echo ":$PATH:" | grep -q ":$where:" ; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
venv="~/venvs"
|
||||||
|
fi
|
||||||
|
python3 -m pip --version > /dev/null 2>&1 || { echo "pip is not installed, please install pip for python3"; exit 1; }
|
||||||
|
|
||||||
if [ "$what" = "server" ]; then
|
if [ "$what" = "server" ]; then
|
||||||
echo "Installing heartbeat server (hbd)"
|
echo "Installing heartbeat server (hbd)"
|
||||||
@@ -26,11 +43,11 @@ else
|
|||||||
what="client"
|
what="client"
|
||||||
echo "Installing heartbeat client (hbc)"
|
echo "Installing heartbeat client (hbc)"
|
||||||
fi
|
fi
|
||||||
if [ ! -d ~/venvs/hbd ]; then
|
if [ ! -d $venv/hbd ]; then
|
||||||
mkdir -p ~/venvs
|
mkdir -p $venv
|
||||||
python3 -m venv ~/venvs/hbd --system-site-packages
|
python3 -m venv $venv/hbd --system-site-packages
|
||||||
fi
|
fi
|
||||||
. ~/venvs/hbd/bin/activate
|
. $venv/hbd/bin/activate
|
||||||
pip install --index-url https://git.wrede.ca/api/packages/andreas/pypi/simple/ --extra-index-url https://pypi.org/simple hbd[$what]
|
pip install --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
|
||||||
|
|||||||
Reference in New Issue
Block a user