-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·56 lines (47 loc) · 1.53 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
# This script is adapted from the deno project's deno_install repo:
# https://github.com/qri-io/qri_install/blob/master/install.sh
# Deno is a great project, you should check it out.
set -e
case $(uname -s) in
Darwin) os="darwin" ;;
*) os="linux" ;;
esac
case $(uname -m) in
x86_64) arch="amd64" ;;
*) arch="other" ;;
esac
if [ "$arch" = "other" ]; then
# TODO (b5) - support other archs. We do.
echo "Unsupported architecture for install script: $(uname -m). Please download manually from github.com/qri-io/qri/releases"
exit
fi
if [ $# -eq 0 ]; then
qri_asset_path=$(
command curl -sSf https://github.com/qri-io/qri/releases |
command grep -o "/qri-io/qri/releases/download/.*/qri_${os}_amd64\\.zip" |
command head -n 1
)
if [ ! "$qri_asset_path" ]; then exit 1; fi
qri_uri="https://github.com${qri_asset_path}"
else
qri_uri="https://github.com/qri-io/qri/releases/download/${1}/qri_${os}_amd64.zip"
fi
qri_install="${QRI_INSTALL:-/usr/local}"
bin_dir="$qri_install/bin"
exe="$bin_dir/qri"
if [ ! -d "$bin_dir" ]; then
mkdir -p "$bin_dir"
fi
curl --fail --location --progress-bar --output "$exe.zip" "$qri_uri"
unzip -d "$bin_dir" "$exe.zip"
chmod +x "$exe"
rm "$bin_dir/readme.md" "$exe.zip"
echo "Qri was installed successfully to $exe"
if command -v qri >/dev/null; then
echo "Run 'qri --help' to get started"
else
echo "Manually add the directory to your \$HOME/.bash_profile (or similar)"
echo " export QRI_INSTALL=\"$qri_install\""
echo " export PATH=\"\$QRI_INSTALL/bin:\$PATH\""
echo "Run '$exe --help' to get started"
fi