Löschen veralteter Logseq Versionen

This commit is contained in:
Tim Peters 2022-08-14 23:39:45 +02:00
parent e7f61e9120
commit d89cea4e70

View File

@ -48,7 +48,7 @@ getVersionLatest() {
} }
getVersionCurrent() { getVersionCurrent() {
local FILENAME="$( find ~/.local/bin/ -iname Logseq-\*AppImage )" local FILENAME="$( ls -1rt ~/.local/bin/Logseq-*AppImage | head -n1 )"
if [ -n "$FILENAME" ]; then if [ -n "$FILENAME" ]; then
VERSION_CURRENT="$( echo $FILENAME | grep -Poi "Logseq-linux-x64-\K\d\.\d\.\d" | head -n 1 )" VERSION_CURRENT="$( echo $FILENAME | grep -Poi "Logseq-linux-x64-\K\d\.\d\.\d" | head -n 1 )"
else else
@ -59,11 +59,16 @@ getVersionCurrent() {
getLatest() { getLatest() {
local URL="https://github.com$( wget -qO - https://github.com/logseq/logseq/releases/latest | grep -Poi "/logseq.*AppImage" )" local URL="https://github.com$( wget -qO - https://github.com/logseq/logseq/releases/latest | grep -Poi "/logseq.*AppImage" )"
local DIR_DEST=~/.local/bin local DIR_DEST=~/.local/bin
local FILE_DELETE=
FILENAME_LOGSEQ="$( basename "$URL" )" FILENAME_LOGSEQ="$( basename "$URL" )"
mkdir -p $DIR_DEST mkdir -p $DIR_DEST
wget $URL --show-progress -qO $DIR_DEST/$FILENAME_LOGSEQ wget $URL --show-progress -qO $DIR_DEST/$FILENAME_LOGSEQ
chmod u+x $DIR_DEST/$FILENAME_LOGSEQ chmod u+x $DIR_DEST/$FILENAME_LOGSEQ
# Veraltete Versionen löschen
FILE_DELETE="$( find ~/.local/bin -iname Logseq-\*AppImage | grep -v $FILENAME_LOGSEQ )"
[ -n "$FILE_DELETE" ] && rm -f $FILE_DELETE
} }
createDesktop() { createDesktop() {