Merge branch 'master' of git.wrede.ca:andreas/heartbeat
This commit is contained in:
+25
-8
@@ -1,5 +1,6 @@
|
||||
#!/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
|
||||
# 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
|
||||
@@ -14,11 +15,27 @@
|
||||
set -e
|
||||
what=$1
|
||||
|
||||
for where in ~/.local/bin ~/bin; do
|
||||
if echo ":$PATH:" | grep -q ":$where:" ; then
|
||||
break
|
||||
if [ -d /homeassistant ]; then
|
||||
echo "cannot install in HA, run \"docker exec -it homeassistant $0 $@\""
|
||||
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
|
||||
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
|
||||
echo "Installing heartbeat server (hbd)"
|
||||
@@ -26,11 +43,11 @@ else
|
||||
what="client"
|
||||
echo "Installing heartbeat client (hbc)"
|
||||
fi
|
||||
if [ ! -d ~/venvs/hbd ]; then
|
||||
mkdir -p ~/venvs
|
||||
python3 -m venv ~/venvs/hbd --system-site-packages
|
||||
if [ ! -d $venv/hbd ]; then
|
||||
mkdir -p $venv
|
||||
python3 -m venv $venv/hbd --system-site-packages
|
||||
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]
|
||||
if [ "$what" = "server" ]; then
|
||||
rm -f ~$where/hbd
|
||||
|
||||
Reference in New Issue
Block a user