1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Linux: Allow downloading pre-release versions from install script (#3335)

This commit is contained in:
TheOnlyTrueJonathanHeard 2020-06-07 11:00:06 +02:00 committed by GitHub
parent 005bfe799c
commit 3f7390d104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ COLOR_RESET=`tput sgr0`
SILENT=false SILENT=false
ALLOW_ROOT=false ALLOW_ROOT=false
SHOW_CHANGELOG=false SHOW_CHANGELOG=false
INCLUDE_PRE_RELEASE=false
print() { print() {
if [[ "${SILENT}" == false ]] ; then if [[ "${SILENT}" == false ]] ; then
@ -40,6 +41,7 @@ showHelp() {
print "\t" "--changelog" "\t" "Show the changelog after installation" print "\t" "--changelog" "\t" "Show the changelog after installation"
print "\t" "--force" "\t" "Always download the latest version" print "\t" "--force" "\t" "Always download the latest version"
print "\t" "--silent" "\t" "Don't print any output" print "\t" "--silent" "\t" "Don't print any output"
print "\t" "--prerelease" "\t" "Check for new Versions including Pre-Releases"
if [[ ! -z $1 ]]; then if [[ ! -z $1 ]]; then
print "\n" "${COLOR_RED}ERROR: " "$*" "${COLOR_RESET}" "\n" print "\n" "${COLOR_RED}ERROR: " "$*" "${COLOR_RESET}" "\n"
@ -67,6 +69,7 @@ while getopts "${optspec}" OPT; do
silent ) SILENT=true ;; silent ) SILENT=true ;;
force ) FORCE=true ;; force ) FORCE=true ;;
changelog ) SHOW_CHANGELOG=true ;; changelog ) SHOW_CHANGELOG=true ;;
prerelease ) INCLUDE_PRE_RELEASE=true ;;
[^\?]* ) showHelp "Illegal option --${OPT}"; exit 2 ;; [^\?]* ) showHelp "Illegal option --${OPT}"; exit 2 ;;
\? ) showHelp "Illegal option -${OPTARG}"; exit 2 ;; \? ) showHelp "Illegal option -${OPTARG}"; exit 2 ;;
esac esac
@ -104,7 +107,11 @@ fi
#----------------------------------------------------- #-----------------------------------------------------
# Get the latest version to download # Get the latest version to download
RELEASE_VERSION=$(wget -qO - "https://api.github.com/repos/laurent22/joplin/releases/latest" | grep -Po '"tag_name": ?"v\K.*?(?=")') if [[ "$INCLUDE_PRE_RELEASE" == true ]]; then
RELEASE_VERSION=$(wget -qO - "https://api.github.com/repos/laurent22/joplin/releases" | grep -Po '"tag_name": ?"v\K.*?(?=")' | head -1)
else
RELEASE_VERSION=$(wget -qO - "https://api.github.com/repos/laurent22/joplin/releases/latest" | grep -Po '"tag_name": ?"v\K.*?(?=")')
fi
# Check if it's in the latest version # Check if it's in the latest version
if [[ -e ~/.joplin/VERSION ]] && [[ $(< ~/.joplin/VERSION) == "${RELEASE_VERSION}" ]]; then if [[ -e ~/.joplin/VERSION ]] && [[ $(< ~/.joplin/VERSION) == "${RELEASE_VERSION}" ]]; then