bruno auto updates

This commit is contained in:
tavo 2025-01-09 11:14:13 -06:00
parent ea9acaaded
commit 7771a697ac
Signed by: tavo
GPG key ID: D490F27B624CECB0

View file

@ -2,6 +2,17 @@
BRUNO_PATH="$HOME/.local/share/bruno" 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 if ! [ -d "$BRUNO_PATH" ] ; then
mkdir -p "$BRUNO_PATH" mkdir -p "$BRUNO_PATH"
fi fi
@ -9,20 +20,9 @@ fi
LATEST="$(curl -s https://api.github.com/repos/usebruno/bruno/releases/latest | LATEST="$(curl -s https://api.github.com/repos/usebruno/bruno/releases/latest |
grep '"name":.*\.AppImage' | cut -d'"' -f 4)" grep '"name":.*\.AppImage' | cut -d'"' -f 4)"
for v in "$BRUNO_PATH"/*.AppImage ; do
INSTALLED="${v##*/}"
unset v
done
if [ "$INSTALLED" != "$LATEST" ] ; then
opt="$(printf 'Yes\nNo\n' | menu "Newer bruno version available, update?")"
if [ "$opt" = "Yes" ] ; then
echo "Updating bruno..."
if ! curl -L --progress-bar -o "$BRUNO_PATH/$LATEST" \ if ! curl -L --progress-bar -o "$BRUNO_PATH/$LATEST" \
https://github.com/usebruno/bruno/releases/latest/download/"$LATEST" ; then https://github.com/usebruno/bruno/releases/latest/download/"$LATEST" ; then
echo "Error updating bruno" echo "Error installing bruno"
exit 1 exit 1
fi fi
@ -30,7 +30,5 @@ if [ "$INSTALLED" != "$LATEST" ] ; then
INSTALLED="$LATEST" INSTALLED="$LATEST"
fi fi
unset opt
fi
exec "$BRUNO_PATH/$INSTALLED" exec "$BRUNO_PATH/$INSTALLED"