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