mirror of
https://github.com/danbulant/deno_install
synced 2026-06-20 23:11:13 +00:00
Add support for DENO_DIR in installer (#69)
This commit is contained in:
parent
d0cc73eff6
commit
1a0c1ec328
2 changed files with 11 additions and 8 deletions
13
install.sh
13
install.sh
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
||||
# Copyright 2019 the Deno authors. All rights reserved. MIT license.
|
||||
# TODO(everyone): Keep this script simple and easily auditable.
|
||||
|
||||
set -e
|
||||
|
|
@ -20,16 +20,19 @@ if [ "$arch" = "other" ]; then
|
|||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
deno_asset_path=$(curl -sSf https://github.com/denoland/deno/releases |
|
||||
grep -o "/denoland/deno/releases/download/.*/deno_${os}_x64\\.gz" |
|
||||
head -n 1)
|
||||
deno_asset_path=$(
|
||||
command curl -sSf https://github.com/denoland/deno/releases |
|
||||
command grep -o "/denoland/deno/releases/download/.*/deno_${os}_x64\\.gz" |
|
||||
command head -n 1
|
||||
)
|
||||
if [ ! "$deno_asset_path" ]; then exit 1; fi
|
||||
deno_uri="https://github.com${deno_asset_path}"
|
||||
else
|
||||
deno_uri="https://github.com/denoland/deno/releases/download/${1}/deno_${os}_x64.gz"
|
||||
fi
|
||||
|
||||
bin_dir="$HOME/.deno/bin"
|
||||
deno_dir=${DENO_DIR:-$HOME/.deno}
|
||||
bin_dir="${deno_dir}/bin"
|
||||
exe="$bin_dir/deno"
|
||||
|
||||
if [ ! -d "$bin_dir" ]; then
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ shfmt -d .
|
|||
|
||||
# Test we can install a specific version.
|
||||
rm -rf ~/.deno
|
||||
./install.sh v0.3.10
|
||||
DENO_DIR='' ./install.sh v0.3.10
|
||||
~/.deno/bin/deno version | grep 0.3.10
|
||||
|
||||
# Test we can install the latest version.
|
||||
rm -rf ~/.deno
|
||||
sh ./install.sh
|
||||
~/.deno/bin/deno version
|
||||
DENO_DIR="$HOME/.deno-test" sh ./install.sh
|
||||
~/.deno-test/bin/deno version
|
||||
|
|
|
|||
Loading…
Reference in a new issue