From 8d3de011173d27416624e7bcc66a3cbfacc897b8 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Sat, 11 Apr 2026 16:19:41 -0400 Subject: [PATCH] Update install script --- scripts/install.sh | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index f9e5fbc..4badeac 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,7 +1,6 @@ #!/bin/sh -# install the heartbeat tools. By default, this will install the hbc -# client only. 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 # 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 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 mkdir -p ~/venvs python3 -m venv ~/venvs/hbd --system-site-packages fi . ~/venvs/hbd/bin/activate -pip install 'git+ssh://git@git.wrede.ca/andreas/heartbeat.git' -rm -f ~/bin/hbd -rm -f ~/bin/hbc -ln -sf $(which hbd) ~/bin/hbd -ln -sf $(which hbc) ~/bin/hbc +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 + ln -sf $(which hbd) $where/hbd +else + rm -f $where/hbc + ln -sf $(which hbc) $where/hbc +fi