Skip to content

Commit

Permalink
install script: exit on failure, conditional curl/wget (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
spaced4ndy committed Dec 5, 2021
1 parent e4328cb commit 2ce3cd2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
set -eu

APP_NAME="simplex-chat"
TARGET_DIR="$HOME/.local/bin"
PLATFORM="$(uname)"
Expand All @@ -14,11 +16,20 @@ fi

[ ! -d $TARGET_DIR ] && mkdir -p $TARGET_DIR

wget -O $TARGET_DIR/$APP_NAME "https://github.com/$APP_NAME/$APP_NAME/releases/latest/download/$APP_NAME-$PLATFORM" && chmod +x $TARGET_DIR/$APP_NAME
if [ -n "$(command -v curl)" ]; then
curl -L -o $TARGET_DIR/$APP_NAME "https://github.com/$APP_NAME/$APP_NAME/releases/latest/download/$APP_NAME-$PLATFORM"
elif [ -n "$(command -v wget)" ]; then
wget -O $TARGET_DIR/$APP_NAME "https://github.com/$APP_NAME/$APP_NAME/releases/latest/download/$APP_NAME-$PLATFORM"
else
echo "Cannot download simplex-chat - please install curl or wget"
exit 1
fi

chmod +x $TARGET_DIR/$APP_NAME

echo "$APP_NAME installed sucesfully!"

if [ -z "$(which simplex-chat)" ]; then
if [ -z "$(command -v simplex-chat)" ]; then
if [ -n "$($SHELL -c 'echo $ZSH_VERSION')" ]; then
SHELL_FILE="$HOME/.zshrc"
elif [ -n "$($SHELL -c 'echo $BASH_VERSION')" ]; then
Expand Down

0 comments on commit 2ce3cd2

Please sign in to comment.