allow passing version to install.sh (#837)

* allow passing version to install.sh

* add echo
This commit is contained in:
Evgeny Poberezkin 2022-07-23 17:02:05 +01:00 committed by GitHub
parent 589f560dd6
commit 13b236f754
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View file

@ -1,3 +1,5 @@
#!/bin/sh
set -eu
APP_NAME="simplex-chat"
@ -5,13 +7,23 @@ BIN_DIR="$HOME/.local/bin"
BIN_PATH="$BIN_DIR/$APP_NAME"
PLATFORM="$(uname)"
if [ -n "$1" ]; then
RELEASE="tag/$1"
DOWNLOAD="download/$1"
echo "downloading SimpleX Chat $1 ..."
else
RELEASE=latest
DOWNLOAD="latest/download"
echo "downloading the latest version of SimpleX Chat ..."
fi
if [ $PLATFORM == "Darwin" ]; then
PLATFORM="macos-x86-64"
elif [ $PLATFORM == "Linux" ]; then
PLATFORM="ubuntu-20_04-x86-64"
else
echo "Scripted installation on your platform is not supported."
echo "See compiled binaries in the latest release: https://github.com/$APP_NAME/$APP_NAME/releases/latest"
echo "See compiled binaries in the ${1:-latest} release: https://github.com/$APP_NAME/$APP_NAME/releases/$RELEASE"
exit 1
fi
@ -67,9 +79,9 @@ fi
[[ ! -d $BIN_DIR ]] && mkdir -p $BIN_DIR
if [ -n "$(command -v curl)" ]; then
curl -L -o $BIN_PATH "https://github.com/$APP_NAME/$APP_NAME/releases/latest/download/$APP_NAME-$PLATFORM"
curl -L -o $BIN_PATH "https://github.com/$APP_NAME/$APP_NAME/releases/$DOWNLOAD/$APP_NAME-$PLATFORM"
elif [ -n "$(command -v wget)" ]; then
wget -O $BIN_PATH "https://github.com/$APP_NAME/$APP_NAME/releases/latest/download/$APP_NAME-$PLATFORM"
wget -O $BIN_PATH "https://github.com/$APP_NAME/$APP_NAME/releases/$DOWNLOAD/$APP_NAME-$PLATFORM"
else
echo "Cannot download $APP_NAME - please install curl or wget"
exit 1