Update install script

This commit is contained in:
Andreas Wrede
2026-04-11 16:19:41 -04:00
parent daf5277507
commit 5bedf026b1
+23 -7
View File
@@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
# install the heartbeat tools. By default, this will install the hbc # install the heartbeat client, hbc. The server is installed when the arg 'server' is passed
# client only. 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
# installed from the wheel and symlinked to ~/bin/hbd and ~/bin/hbc, # installed from the wheel and symlinked to ~/bin/hbd and ~/bin/hbc,
@@ -13,13 +12,30 @@
# hbd/hbc from wheel and create symlinks for hbd and hbc in ~/bin # hbd/hbc from wheel and create symlinks for hbd and hbc in ~/bin
set -e set -e
what=$1
for where in ~/.local/bin ~/bin; do
if echo ":$PATH:" | grep -q ":$where:" ]; then
break
fi
done
if [ "$what" = "server" ]; then
echo "Installing heartbeat server (hbd)"
else
what="client"
echo "Installing heartbeat client (hbc)"
fi
if [ ! -d ~/venvs/hbd ]; then if [ ! -d ~/venvs/hbd ]; then
mkdir -p ~/venvs mkdir -p ~/venvs
python3 -m venv ~/venvs/hbd --system-site-packages python3 -m venv ~/venvs/hbd --system-site-packages
fi fi
. ~/venvs/hbd/bin/activate . ~/venvs/hbd/bin/activate
pip install 'git+ssh://git@git.wrede.ca/andreas/heartbeat.git' pip install --index-url https://git.wrede.ca/api/packages/andreas/pypi/simple/ --extra-index-url https://pypi.org/simple hbd[$what]
rm -f ~/bin/hbd if [ "$what" = "server" ]; then
rm -f ~/bin/hbc rm -f ~$where/hbd
ln -sf $(which hbd) ~/bin/hbd ln -sf $(which hbd) $where/hbd
ln -sf $(which hbc) ~/bin/hbc else
rm -f $where/hbc
ln -sf $(which hbc) $where/hbc
fi