-
Notifications
You must be signed in to change notification settings - Fork 189
/
install.sh
54 lines (46 loc) · 1.45 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
#!/bin/sh
# Copyright 2019 the Deno authors. All rights reserved. MIT license.
# Copyright 2022 the Backpack authors. All rights reserved. MIT license.
# TODO(everyone): Keep this script simple and easily auditable.
set -e
# assumes bin name same as project name
project="teller"
bin_name="teller"
repo="tellerops/teller"
if [ "$OS" = "Windows_NT" ]; then
target="x86_64-windows"
else
case $(uname -sm) in
"Darwin x86_64") target="x86_64-macos" ;;
"Darwin arm64") target="aarch64-macos" ;;
*) target="x86_64-linux" ;;
esac
fi
if [ $# -eq 0 ]; then
uri="https://github.com/${repo}/releases/latest/download/${project}-${target}.tar.xz"
else
uri="https://github.com/${repo}/releases/download/${1}/${project}-${target}.tar.xz"
fi
install="${PROJ_INSTALL:-$HOME/.$project-bin}"
bin_dir="$install"
exe="$bin_dir/$bin_name"
if [ ! -d "$bin_dir" ]; then
mkdir -p "$bin_dir"
fi
curl --fail --location --progress-bar --output "$exe.tar.xz" "$uri"
tar zxf "$exe.tar.xz" -C "$bin_dir" --strip-components 1
chmod +x "$exe"
rm "$exe.tar.xz"
echo "$project was installed successfully to $exe"
if command -v $exe >/dev/null; then
echo "Run '$exe --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 PROJ_INSTALL=\"$install\""
echo " export PATH=\"\$PROJ_INSTALL:\$PATH\""
echo "Run '$exe --help' to get started"
fi