/
install.sh
executable file
·40 lines (33 loc) · 1.02 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# Copyright 2018 the Deno authors. All rights reserved. MIT license.
# TODO(everyone): Keep this script simple and easily auditable.
set -e
case $(uname -s) in
Darwin) os="osx" ;;
*) os="linux" ;;
esac
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)
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"
exe="$bin_dir/deno"
if [ ! -d "$bin_dir" ]; then
mkdir -p "$bin_dir"
fi
curl -fL# -o "$exe.gz" "$deno_uri"
gunzip -df "$exe.gz"
chmod +x "$exe"
echo "Deno was installed successfully to $exe"
if command -v deno >/dev/null; then
echo "Run 'deno --help' to get started"
else
echo "Manually add the directory to your \$HOME/.bash_profile (or similar)"
echo " export PATH=\"$bin_dir:\$PATH\""
echo "Run '$exe --help' to get started"
fi