From 1cd4c3c2953f8e7ea474bfe77046065cb51293a6 Mon Sep 17 00:00:00 2001 From: Miguel Mota Date: Tue, 4 Aug 2020 01:03:41 -0700 Subject: [PATCH] Add install script to download from binary release --- README.md | 12 +++++------- install.sh | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100755 install.sh diff --git a/README.md b/README.md index 59aba48..4530ff0 100644 --- a/README.md +++ b/README.md @@ -96,16 +96,14 @@ cointop ### Binary (all platforms) -You can download the binary from the [releases](https://github.com/miguelmota/cointop/releases) page +You can download the binary from the [releases](https://github.com/miguelmota/cointop/releases) page. ```bash -# replace x.x.x with the latest version -wget https://github.com/miguelmota/cointop/releases/download/x.x.x/cointop_x.x.x_linux_amd64.tar.gz -tar -xvzf cointop_x.x.x_linux_amd64.tar.gz cointop -./cointop +curl -o- https://raw.githubusercontent.com/miguelmota/cointop/master/install.sh | bash +``` -# optionally move to bin path -sudo mv cointop /usr/local/bin/cointop +```bash +wget -qO- https://raw.githubusercontent.com/miguelmota/cointop/master/install.sh | bash ``` ### Homebrew (macOS) diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..aa4ac18 --- /dev/null +++ b/install.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +VERSION=$(curl --silent "https://api.github.com/repos/miguelmota/cointop/releases/latest" | grep -Po --color=never '"tag_name": "\K.*?(?=")') + +OSNAME="linux" +if [[ $(uname) == 'Darwin' ]]; then + OSNAME="darwin" +fi + +( + cd /tmp + wget https://github.com/miguelmota/cointop/releases/download/${VERSION}/cointop_${VERSION}_${OSNAME}_amd64.tar.gz + tar -xvzf cointop_${VERSION}_${OSNAME}_amd64.tar.gz cointop + + sudo mv cointop /usr/local/bin/cointop + cointop --version +)