-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·55 lines (46 loc) · 1.38 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
#!/usr/bin/env bash
# NOTE: This file is generated by chored
_main() {
set -euo pipefail
if [ -z "${DENO:-}" ]; then
DENO="$(which deno 2>/dev/null || true)"
fi
if [ -z "${DENO:-}" ]; then
CHORED_CACHE="${CHORED_CACHE:-$HOME/.cache/chored}"
DENO_VERSION="${DENO_VERSION:-1.22.0}"
PLATFORM_ARCH=""
# Add more as needed
UNAME="$(uname -sm)"
case "$UNAME" in
"Darwin x86_64")
PLATFORM_ARCH="x86_64-apple-darwin"
;;
"Linux x86_64")
PLATFORM_ARCH="x86_64-unknown-linux-gnu"
;;
"Darwin arm64")
PLATFORM_ARCH="aarch64-apple-darwin"
;;
*)
echo >&2 "Error: Unknown platform/arch: $UNAME"
exit 1
;;
esac
[ -n "$PLATFORM_ARCH" ]
DENO_DIR="$CHORED_CACHE/$PLATFORM_ARCH-$DENO_VERSION/"
mkdir -p "$DENO_DIR"
DENO="$DENO_DIR/deno"
if [ ! -e "$DENO" ]; then
ZIP_FILE="$DENO_DIR/deno.zip"
curl -sSL "https://github.com/denoland/deno/releases/download/v$DENO_VERSION/deno-$PLATFORM_ARCH.zip" > "$ZIP_FILE"
unzip -d "$DENO_DIR" "$ZIP_FILE"
rm "$ZIP_FILE"
fi
fi
DENO_ARGV=(--unstable --allow-all --check=local)
REPO="https://github.com/timbertson/chored.git"
VERSION="$(git ls-remote --refs --tags --sort=-v:refname "$REPO" 'refs/tags/v*' | head -n 1 | sed -e 's@.*/@@')"
BOOTSTRAP="https://deno.land/x/chored@$VERSION/lib/bootstrap.ts"
exec "$DENO" run "${DENO_ARGV[@]}" "${BOOTSTRAP_OVERRIDE:-$BOOTSTRAP}"
}
_main "$@"