-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
58 lines (50 loc) · 1.64 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
# Copyright 2019 the Deno authors. All rights reserved. MIT license.
# Copyright 2023 Jo Bates. All rights reserved. MIT license.
# TODO(everyone): Keep this script simple and easily auditable.
set -e
if ! command -v unzip >/dev/null; then
echo "Error: unzip is required to install Denog (see: https://github.com/denoland/deno_install#unzip-is-required)." 1>&2
exit 1
fi
if [ "$OS" = "Windows_NT" ]; then
target="x86_64-pc-windows-msvc"
else
case $(uname -sm) in
"Darwin x86_64") target="x86_64-apple-darwin" ;;
"Darwin arm64") target="aarch64-apple-darwin" ;;
"Linux aarch64")
echo "Error: Official Denog builds for Linux aarch64 are not available." 1>&2
exit 1
;;
*) target="x86_64-unknown-linux-gnu" ;;
esac
fi
if [ $# -eq 0 ]; then
deno_uri="https://github.com/denogdev/denog/releases/latest/download/denog-${target}.zip"
else
deno_uri="https://github.com/denogdev/denog/releases/download/${1}/denog-${target}.zip"
fi
deno_install="${DENO_INSTALL:-$HOME/.deno}"
bin_dir="$deno_install/bin"
exe="$bin_dir/denog"
if [ ! -d "$bin_dir" ]; then
mkdir -p "$bin_dir"
fi
curl --fail --location --progress-bar --output "$exe.zip" "$deno_uri"
unzip -d "$bin_dir" -o "$exe.zip"
chmod +x "$exe"
rm "$exe.zip"
echo "Denog was installed successfully to $exe"
if command -v denog >/dev/null; then
echo "Run 'denog --help' to get started"
else
case $SHELL in
/bin/zsh) shell_profile=".zshrc" ;;
*) shell_profile=".bashrc" ;;
esac
echo "Manually add the directory to your \$HOME/$shell_profile (or similar)"
echo " export DENO_INSTALL=\"$deno_install\""
echo " export PATH=\"\$DENO_INSTALL/bin:\$PATH\""
echo "Run '$exe --help' to get started"
fi