From c7057cce2d42af630a0358d16fb1cba31057dc95 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Sun, 15 Dec 2019 08:58:00 +0700 Subject: [PATCH] Add install.sh --- install.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..4de267d --- /dev/null +++ b/install.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +set -e +set -u +set -o pipefail + +put() { + echo -e "\e[1;32m$1\e[0m" +} + +do_install() { + cat <<'EOM' + + ______ _____ _ _ _ + | ____| |_ _| | | | | | + | |____ __ | | _ __ ___| |_ __ _| | | ___ _ __ + | __\ \/ / | | | '_ \/ __| __/ _` | | |/ _ \ '__| + | | > < _| |_| | | \__ \ || (_| | | | __/ | + |_| /_/\_\ |_____|_| |_|___/\__\__,_|_|_|\___|_| + +EOM + + platform='' + if [[ "$OSTYPE" == "linux"* ]]; then + platform='linux' + elif [[ "$OSTYPE" == "darwin"* ]]; then + platform='macos' + elif [[ "$OSTYPE" == "win"* ]]; then + platform='win.exe' + fi + + if test "x$platform" = "x"; then + cat < "fx-$platform.zip" + + put "Extracting fx-$platform.zip" + unzip "fx-$platform.zip" + rm "fx-$platform.zip" + mv "fx-$platform" fx + + name='' + read -p $'\e[1;35mWhould you like to move fx binary to /usr/local/bin?\e[0m [Y/n] ' -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + mv fx /usr/local/bin/fx + name='fx' + else + name='./fx' + fi + + cat <