2018-09-10 22:54:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
2018-09-14 19:03:09 +02:00
|
|
|
# Title
|
|
|
|
echo " _ _ _ _ _ _ "
|
|
|
|
echo " | | (_) (_) | | | | | "
|
|
|
|
echo " | | ___ _ __ _ _ __ _ _ __ ___| |_ __ _| | | ___ _ __ "
|
|
|
|
echo " _ | |/ _ \\\| '_ \| | '_ \\ | | '_ \\\/ __| __/ _\` | | |/ _ \ '__|"
|
|
|
|
echo " | |__| | (_) | |_) | | | | | | | | | \__ \ || (_| | | | __/ | "
|
|
|
|
echo " \____/ \___/| .__/|_|_| |_| |_|_| |_|___/\__\__,_|_|_|\___|_| "
|
|
|
|
echo " | | "
|
|
|
|
echo " |_| "
|
|
|
|
# Get the latest version to download
|
2018-09-09 21:08:23 +02:00
|
|
|
version=$(curl --silent "https://api.github.com/repos/laurent22/joplin/releases/latest" | grep -Po '"tag_name": "v\K.*?(?=")')
|
2018-09-14 19:03:09 +02:00
|
|
|
# Delete previous version
|
2018-09-21 12:55:01 +02:00
|
|
|
rm -f ~/.joplin/*.AppImage ~/.local/share/applications/joplin.desktop
|
2018-09-14 19:03:09 +02:00
|
|
|
# Creates the folder where the binary will be stored
|
2018-09-09 21:08:23 +02:00
|
|
|
mkdir -p ~/.joplin/
|
2018-09-14 19:03:09 +02:00
|
|
|
# Download the latest version
|
2018-09-09 21:08:23 +02:00
|
|
|
wget -O ~/.joplin/Joplin-$version-x86_64.AppImage https://github.com/laurent22/joplin/releases/download/v$version/Joplin-$version-x86_64.AppImage
|
2018-09-14 19:03:09 +02:00
|
|
|
# Gives execution privileges
|
2018-09-09 21:08:23 +02:00
|
|
|
chmod +x ~/.joplin/Joplin-$version-x86_64.AppImage
|
2018-09-14 19:03:09 +02:00
|
|
|
# Download icon
|
2018-09-09 21:08:23 +02:00
|
|
|
wget -O ~/.joplin/Icon512.png https://joplin.cozic.net/images/Icon512.png
|
2018-09-14 19:03:09 +02:00
|
|
|
# Create icon for Gnome
|
2018-09-09 21:08:23 +02:00
|
|
|
echo -e "[Desktop Entry]\nEncoding=UTF-8\nName=Joplin\nExec=/home/$USER/.joplin/Joplin-$version-x86_64.AppImage\nIcon=/home/$USER/.joplin/Icon512.png\nType=Application\nCategories=Application;" >> ~/.local/share/applications/joplin.desktop
|
2018-09-14 19:03:09 +02:00
|
|
|
# Informs the user that it has been installed and cleans variables
|
|
|
|
echo 'Joplin installed in the version' $version
|
|
|
|
unset version
|