dotfiles/wrappers/bruno
2025-01-09 11:14:13 -06:00

34 lines
728 B
Bash
Executable file

#!/bin/sh
BRUNO_PATH="$HOME/.local/share/bruno"
INSTALLED=
for v in "$BRUNO_PATH"/*.AppImage ; do
if [ -f "$v" ] && [ -x "$v" ] ; then
INSTALLED="${v##*/}"
fi
unset v
done
if [ -z "$INSTALLED" ] ; then
echo "Installing bruno..."
if ! [ -d "$BRUNO_PATH" ] ; then
mkdir -p "$BRUNO_PATH"
fi
LATEST="$(curl -s https://api.github.com/repos/usebruno/bruno/releases/latest |
grep '"name":.*\.AppImage' | cut -d'"' -f 4)"
if ! curl -L --progress-bar -o "$BRUNO_PATH/$LATEST" \
https://github.com/usebruno/bruno/releases/latest/download/"$LATEST" ; then
echo "Error installing bruno"
exit 1
fi
chmod +x "$BRUNO_PATH/$LATEST"
INSTALLED="$LATEST"
fi
exec "$BRUNO_PATH/$INSTALLED"