mirror of
https://github.com/danbulant/deno_install
synced 2026-07-07 12:10:38 +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
|
#!/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.
|
# TODO(everyone): Keep this script simple and easily auditable.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
@ -20,16 +20,19 @@ if [ "$arch" = "other" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
deno_asset_path=$(curl -sSf https://github.com/denoland/deno/releases |
|
deno_asset_path=$(
|
||||||
grep -o "/denoland/deno/releases/download/.*/deno_${os}_x64\\.gz" |
|
command curl -sSf https://github.com/denoland/deno/releases |
|
||||||
head -n 1)
|
command grep -o "/denoland/deno/releases/download/.*/deno_${os}_x64\\.gz" |
|
||||||
|
command head -n 1
|
||||||
|
)
|
||||||
if [ ! "$deno_asset_path" ]; then exit 1; fi
|
if [ ! "$deno_asset_path" ]; then exit 1; fi
|
||||||
deno_uri="https://github.com${deno_asset_path}"
|
deno_uri="https://github.com${deno_asset_path}"
|
||||||
else
|
else
|
||||||
deno_uri="https://github.com/denoland/deno/releases/download/${1}/deno_${os}_x64.gz"
|
deno_uri="https://github.com/denoland/deno/releases/download/${1}/deno_${os}_x64.gz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bin_dir="$HOME/.deno/bin"
|
deno_dir=${DENO_DIR:-$HOME/.deno}
|
||||||
|
bin_dir="${deno_dir}/bin"
|
||||||
exe="$bin_dir/deno"
|
exe="$bin_dir/deno"
|
||||||
|
|
||||||
if [ ! -d "$bin_dir" ]; then
|
if [ ! -d "$bin_dir" ]; then
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ shfmt -d .
|
||||||
|
|
||||||
# Test we can install a specific version.
|
# Test we can install a specific version.
|
||||||
rm -rf ~/.deno
|
rm -rf ~/.deno
|
||||||
./install.sh v0.3.10
|
DENO_DIR='' ./install.sh v0.3.10
|
||||||
~/.deno/bin/deno version | grep 0.3.10
|
~/.deno/bin/deno version | grep 0.3.10
|
||||||
|
|
||||||
# Test we can install the latest version.
|
# Test we can install the latest version.
|
||||||
rm -rf ~/.deno
|
rm -rf ~/.deno
|
||||||
sh ./install.sh
|
DENO_DIR="$HOME/.deno-test" sh ./install.sh
|
||||||
~/.deno/bin/deno version
|
~/.deno-test/bin/deno version
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue