Erweiterte Funktionalitäten
- Programmaufruf mit Optionen möglich - Logseq kann deinstalliert werden - Warnung, wenn Logseq als root installiert wird
This commit is contained in:
parent
5844b0b535
commit
362714817d
19
README.md
19
README.md
@ -1,11 +1,26 @@
|
|||||||
# Logseq Installer
|
# Logseq Installer
|
||||||
|
|
||||||
Das Skript vereinfacht den Installations- bzw. Aktualisierungprozess von Logseq und fügt einen Eintrag ins Startmenü hinzu, wodurch sich die Anwendung auf herkömmliche Weise starten lässt.
|
Das Skript vereinfacht den Installations- bzw. Aktualisierungprozess von Logseq unter Linux und reiht die Applikation ins Startmenü ein.
|
||||||
|
|
||||||
Zum einfachen Starten des Logseq Installers die folgende Zeile in ein Terminal einfügen:
|
Den Logseq Installer startest Du mit folgendem Aufruf in einem Terminal:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
wget -qO - https://git.tim-peters.org/Tim/Logseq-Installer/raw/branch/main/logseq-install.sh | bash
|
wget -qO - https://git.tim-peters.org/Tim/Logseq-Installer/raw/branch/main/logseq-install.sh | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Programmaufruf
|
||||||
|
|
||||||
|
```
|
||||||
|
Logseq Installer
|
||||||
|
================
|
||||||
|
Erlaubte Optionen:
|
||||||
|
|
||||||
|
-h | --hilfe --- Zeigt diese Hilfe an
|
||||||
|
-e | --entfernen --- Deinstalliert Logseq
|
||||||
|
-r | --root --- Erlaubt die Installation als root
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
![](./Screenshot.png)
|
![](./Screenshot.png)
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
### Von Tim Peters
|
|
||||||
### https://git.tim-peters.org/Tim/Logseq-Installer
|
|
||||||
|
|
||||||
COLOR_RED=$( tput setaf 1 )
|
COLOR_RED=$( tput setaf 1 )
|
||||||
COLOR_GREEN=$( tput setaf 2 )
|
COLOR_GREEN=$( tput setaf 2 )
|
||||||
COLOR_YELLOW=$( tput setaf 3 )
|
COLOR_YELLOW=$( tput setaf 3 )
|
||||||
COLOR_RESET=$( tput sgr0 )
|
COLOR_RESET=$( tput sgr0 )
|
||||||
|
ALLOW_ROOT=false
|
||||||
|
|
||||||
trap 'handleError' ERR
|
trap 'handleError' ERR
|
||||||
|
|
||||||
@ -43,6 +41,26 @@ showLogo() {
|
|||||||
echo -n "${COLOR_RESET}"
|
echo -n "${COLOR_RESET}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showHelp() {
|
||||||
|
[ $# -gt 0 ] && echo "$*" && echo ""
|
||||||
|
|
||||||
|
cat <<-EOT
|
||||||
|
Logseq Installer
|
||||||
|
================
|
||||||
|
Erlaubte Optionen:
|
||||||
|
|
||||||
|
-h | --hilfe --- Zeigt diese Hilfe an
|
||||||
|
-e | --entfernen --- Deinstalliert Logseq
|
||||||
|
-r | --root --- Erlaubt die Installation als root
|
||||||
|
|
||||||
|
Geschrieben von Tim Peters
|
||||||
|
---> https://git.tim-peters.org/Tim/Logseq-Installer
|
||||||
|
|
||||||
|
EOT
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
getVersionLatest() {
|
getVersionLatest() {
|
||||||
VERSION_LATEST="$( wget -qO - https://github.com/logseq/logseq/releases/latest | grep -Poi "Logseq-linux-x64-\K\d\.\d\.\d" | head -n 1 )"
|
VERSION_LATEST="$( wget -qO - https://github.com/logseq/logseq/releases/latest | grep -Poi "Logseq-linux-x64-\K\d\.\d\.\d" | head -n 1 )"
|
||||||
}
|
}
|
||||||
@ -83,6 +101,14 @@ getLatest() {
|
|||||||
ln -s "$DIR_DEST/$FILENAME_LOGSEQ" "$FILE_LINK"
|
ln -s "$DIR_DEST/$FILENAME_LOGSEQ" "$FILE_LINK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doUninstall() {
|
||||||
|
rm -f ~/.local/bin/Logseq* "${HOME}"/.local/share/applications/logseq.*
|
||||||
|
update-desktop-database ~/.local/share/applications
|
||||||
|
|
||||||
|
echo "Logseq wurde deinstalliert"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
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"
|
||||||
@ -103,6 +129,29 @@ createDesktop() {
|
|||||||
update-desktop-database ~/.local/share/applications
|
update-desktop-database ~/.local/share/applications
|
||||||
}
|
}
|
||||||
|
|
||||||
|
optspec=":her-:"
|
||||||
|
while getopts "${optspec}" OPT; do
|
||||||
|
[ "${OPT}" = " " ] && continue
|
||||||
|
if [ "${OPT}" = "-" ]; then
|
||||||
|
OPT="${OPTARG%%=*}"
|
||||||
|
OPTARG="${OPTARG#$OPT}"
|
||||||
|
OPTARG="${OPTARG#=}"
|
||||||
|
fi
|
||||||
|
case "${OPT}" in
|
||||||
|
h | hilfe ) showHelp ;;
|
||||||
|
e | entfernen ) doUninstall ;;
|
||||||
|
r | root ) ALLOW_ROOT=true ;;
|
||||||
|
[^\?]* ) showHelp "Unbekannte Option: --${OPT}"; exit 2 ;;
|
||||||
|
\? ) showHelp "Unbekannte Option: -${OPTARG}"; exit 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
if [ "$( whoami )" = root -a "$ALLOW_ROOT" = false ]; then
|
||||||
|
showHelp "Die Installation sollte nicht als root erfolgen"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
showLogo
|
showLogo
|
||||||
echo "Ermitteln der verfügbaren Versionen"
|
echo "Ermitteln der verfügbaren Versionen"
|
||||||
getVersionLatest
|
getVersionLatest
|
||||||
|
Loading…
Reference in New Issue
Block a user