Stabilitätsverbesserungen
This commit is contained in:
parent
621a633bf3
commit
5844b0b535
@ -1,10 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash -e
|
||||||
|
|
||||||
COLOR_RED=`tput setaf 1`
|
### Von Tim Peters
|
||||||
COLOR_GREEN=`tput setaf 2`
|
### https://git.tim-peters.org/Tim/Logseq-Installer
|
||||||
COLOR_YELLOW=`tput setaf 3`
|
|
||||||
COLOR_BLUE=`tput setaf 4`
|
COLOR_RED=$( tput setaf 1 )
|
||||||
COLOR_RESET=`tput sgr0`
|
COLOR_GREEN=$( tput setaf 2 )
|
||||||
|
COLOR_YELLOW=$( tput setaf 3 )
|
||||||
|
COLOR_RESET=$( tput sgr0 )
|
||||||
|
|
||||||
|
trap 'handleError' ERR
|
||||||
|
|
||||||
|
handleError() {
|
||||||
|
cat <<-EOT
|
||||||
|
Leider ist ein Fehler aufgetreten.
|
||||||
|
Bitte hilf mit dieses Skript zu verbessern und sende einen
|
||||||
|
Fehlerbericht per EMail an installer@logseq.eu
|
||||||
|
EOT
|
||||||
|
}
|
||||||
|
|
||||||
showLogo() {
|
showLogo() {
|
||||||
echo -n "${COLOR_GREEN}"
|
echo -n "${COLOR_GREEN}"
|
||||||
@ -36,32 +48,44 @@ getVersionLatest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getVersionCurrent() {
|
getVersionCurrent() {
|
||||||
local FILENAME="$( ls -1rt ~/.local/bin/Logseq-*AppImage 2>/dev/null | head -n1 )"
|
local FILENAME
|
||||||
|
|
||||||
|
FILENAME="$( ls -1rt ~/.local/bin/Logseq-*AppImage 2>/dev/null | 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
|
||||||
VERSION_CURRENT=
|
VERSION_CURRENT=
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
getLatest() {
|
getLatest() {
|
||||||
local URL="https://github.com$( wget -qO - https://github.com/logseq/logseq/releases/latest | grep -Poi "/logseq.*AppImage" )"
|
local URL
|
||||||
local DIR_DEST=~/.local/bin
|
URL="https://github.com$( wget -qO - https://github.com/logseq/logseq/releases/latest | grep -Poi "/logseq.*AppImage" )"
|
||||||
local FILE_DELETE=
|
local DIR_DEST
|
||||||
|
DIR_DEST=~/.local/bin
|
||||||
|
local FILE_LINK
|
||||||
|
FILE_LINK=~/.local/bin/Logseq
|
||||||
|
local FILE_TMP
|
||||||
|
FILE_TMP="$( mktemp )"
|
||||||
|
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 "$FILE_TMP"
|
||||||
chmod u+x $DIR_DEST/$FILENAME_LOGSEQ
|
mv "$FILE_TMP" "$DIR_DEST/$FILENAME_LOGSEQ"
|
||||||
|
chmod u+x "$DIR_DEST/$FILENAME_LOGSEQ"
|
||||||
|
|
||||||
# Veraltete Versionen löschen
|
# Veraltete Versionen löschen
|
||||||
FILE_DELETE="$( find ~/.local/bin -iname Logseq-\*AppImage | grep -v $FILENAME_LOGSEQ )"
|
FILE_DELETE="$( find ~/.local/bin -iname Logseq-\*AppImage | grep -v "$FILENAME_LOGSEQ" )" || true
|
||||||
[ -n "$FILE_DELETE" ] && rm -f $FILE_DELETE
|
[ -n "$FILE_DELETE" ] && rm -f "$FILE_DELETE"
|
||||||
|
[ -L "$FILE_LINK" ] && rm -f "$FILE_LINK"
|
||||||
|
|
||||||
|
ln -s "$DIR_DEST/$FILENAME_LOGSEQ" "$FILE_LINK"
|
||||||
}
|
}
|
||||||
|
|
||||||
createDesktop() {
|
createDesktop() {
|
||||||
local FILE_PNG=${HOME}/.local/share/applications/logseq.png
|
local FILE_PNG=${HOME}/.local/share/applications/logseq.png
|
||||||
[ -f $FILE_PNG ] || wget https://raw.githubusercontent.com/logseq/logseq/master/resources/icons/logseq.png -qO $FILE_PNG
|
[ -f "$FILE_PNG" ] || wget https://raw.githubusercontent.com/logseq/logseq/master/resources/icons/logseq.png -qO "$FILE_PNG"
|
||||||
|
|
||||||
cat > ~/.local/share/applications/logseq.desktop <<-EOF
|
cat > ~/.local/share/applications/logseq.desktop <<-EOF
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
@ -80,10 +104,11 @@ createDesktop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showLogo
|
showLogo
|
||||||
|
echo "Ermitteln der verfügbaren Versionen"
|
||||||
getVersionLatest
|
getVersionLatest
|
||||||
getVersionCurrent
|
getVersionCurrent
|
||||||
echo "Neuste verfügbare Version...... $COLOR_GREEN$VERSION_LATEST$COLOR_RESET"
|
echo "Neuste verfügbare Version...... $COLOR_GREEN$VERSION_LATEST$COLOR_RESET"
|
||||||
echo "Derzeit installierte Version... $COLOR_GREEN${VERSION_CURRENT:-${COLOR_RED}Keine installiert}$COLOR_RESET"
|
echo "Derzeit installierte Version... $COLOR_GREEN${VERSION_CURRENT:-${COLOR_RED}Logseq ist nicht installiert}$COLOR_RESET"
|
||||||
|
|
||||||
[ "$VERSION_CURRENT" != "$VERSION_LATEST" ] || exit
|
[ "$VERSION_CURRENT" != "$VERSION_LATEST" ] || exit
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user