1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Useless and error prone VERSION file removed & warn use of root (#989)

* Don't create unused VERSION file

It will throw an error if the script is run from a non-writable directory

* Warn user if running as root

This will write files as root:root

* Clearer root warning
This commit is contained in:
rhtenhove 2018-11-20 22:54:58 +01:00 committed by Laurent Cozic
parent 58b68cab0c
commit c24135577c

View File

@ -11,6 +11,14 @@ echo " | | "
echo " |_| " echo " |_| "
echo "" echo ""
# Check and warn if running as root.
if [[ $EUID = 0 ]] ; then
if [[ $* != *--allow-root* ]] ; then
echo "It is not recommended (nor necessary) to run this script as root. To do so anyway, please use '--allow-root'"
exit 1
fi
fi
#----------------------------------------------------- #-----------------------------------------------------
# Download Joplin # Download Joplin
#----------------------------------------------------- #-----------------------------------------------------
@ -19,7 +27,6 @@ echo ""
version=$(curl --silent "https://api.github.com/repos/laurent22/joplin/releases/latest" | grep -Po '"tag_name": "v\K.*?(?=")') version=$(curl --silent "https://api.github.com/repos/laurent22/joplin/releases/latest" | grep -Po '"tag_name": "v\K.*?(?=")')
# Check if it's in the latest version # Check if it's in the latest version
touch VERSION
if [[ $(< ~/.joplin/VERSION) != "$version" ]]; then if [[ $(< ~/.joplin/VERSION) != "$version" ]]; then
# Delete previous version # Delete previous version