From d9b3742f629dbb05096d45c0e3a28a73e2a6f9c6 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sun, 28 Nov 2021 10:08:26 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20add=20install.sh=20script=20(#129)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :sparkles: add script installer * Update install.sh Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com> * :recycle: Update * :pencil2: Typos * :recycle: Move export to .profile * :recycle: Update * :recycle: Update * Update install.sh * Update install.sh * Update install.sh * Update install.sh * install.sh: add simplex-chat folder to path conditionally Co-authored-by: Eliaz Bobadilla Co-authored-by: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com> --- install.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 000000000..7ac5dd500 --- /dev/null +++ b/install.sh @@ -0,0 +1,37 @@ +APP_NAME="simplex-chat" +TARGET_DIR="$HOME/.local/bin" +PLATFORM="$(uname)" + +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/simplex-chat/simplex-chat/releases/latest" + exit 1 +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 + +echo "$APP_NAME installed sucesfully!" + +if [ -z "$(which simplex-chat)" ]; then + if [ -n "$($SHELL -c 'echo $ZSH_VERSION')" ]; then + SHELL_FILE="$HOME/.zshrc" + elif [ -n "$($SHELL -c 'echo $BASH_VERSION')" ]; then + SHELL_FILE="$HOME/.bashrc" + else + echo "Unknown shell - cannot add simplex-chat folder to PATH" + echo "Please add $TARGET_DIR to PATH variable" + echo "Or you can run simplex-chat via full path: $TARGET_DIR/simplex-chat" + fi + if [ -n "$SHELL_FILE" ]; then + echo "export PATH=\$PATH:$TARGET_DIR" >> $SHELL_FILE + echo "Source your $SHELL_FILE or open a new shell and type simplex-chat to run it" + fi +else + echo "Type simplex-chat in your terminal to run it" +fi