From 1b9738eeb326b6c1f6fe423fb682030a7aad60a8 Mon Sep 17 00:00:00 2001 From: Mark Tiedemann Date: Fri, 18 Jan 2019 20:51:19 +0100 Subject: [PATCH] sh: Remove hardcoded version (#29) --- install.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/install.sh b/install.sh index e70760e..e833d53 100755 --- a/install.sh +++ b/install.sh @@ -4,10 +4,19 @@ set -e +case $(uname -s) in +Darwin) os="osx" ;; +*) os="linux" ;; +esac + if [ $# -eq 0 ]; then - version="v0.2.7" + deno_asset_path=$(curl -sSf https://github.com/denoland/deno/releases | + grep -o "/denoland/deno/releases/download/.*/deno_${os}_x64\.gz" | + head -n 1) + if [ ! "$deno_asset_path" ]; then exit 1; fi + deno_uri="https://github.com${deno_asset_path}" else - version=$1 + deno_uri="https://github.com/denoland/deno/releases/download/${1}/deno_${os}_x64.gz" fi bin_dir="$HOME/.deno/bin" @@ -17,13 +26,6 @@ if [ ! -d "$bin_dir" ]; then mkdir -p "$bin_dir" fi -case $(uname -s) in -Darwin) os="osx" ;; -*) os="linux" ;; -esac - -deno_uri="https://github.com/denoland/deno/releases/download/${version}/deno_${os}_x64.gz" - curl -fL# -o "$exe.gz" "$deno_uri" gunzip -df "$exe.gz" chmod +x "$exe"