-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
install.sh
executable file
·79 lines (66 loc) · 2 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
set -e
case $(uname -s) in
Darwin) os="macos" ;;
*) os="linux" ;;
esac
if [ "$os" = "linux" ]; then
if [ $(cat /etc/os-release | grep "NAME=" | grep -ic "Alpine") != "0" ]; then
# alpine variant
os="alpine"
fi
fi
case $(uname -m) in
x86_64) arch="x86_64" ;;
arm64) arch="arm64" ;;
*) arch="other" ;;
esac
if [ "$arch" = "other" ]; then
echo "Unsupported architecture $(uname -m). Only x64 binaries are available."
exit
fi
if [ $# -eq 0 ]; then
# locize_asset_path=$(
# command curl -sSf https://github.com/locize/locize-cli/releases |
# command grep -o "/locize/locize-cli/releases/download/.*/locize-${os}" |
# command head -n 1
# )
# locize_asset_path_for_lazy=$(
# command curl -sSf https://github.com/locize/locize-cli/releases |
# command grep -o "https://github.com/locize/locize-cli/releases/expanded_assets/.*\" " |
# command head -n 1 |
# command rev |
# command cut -c3- |
# command rev
# )
# locize_asset_path=$(
# command curl -sSf ${locize_asset_path_for_lazy} |
# command grep -o "/locize/locize-cli/releases/download/.*/locize-${os}" |
# command head -n 1
# )
locize_asset_path="/locize/locize-cli/releases/latest/download/locize-${os}"
if [ ! "$locize_asset_path" ]; then
echo "failed to find a release on github"
exit 1;
fi
locize_uri="https://github.com${locize_asset_path}"
else
locize_uri="https://github.com/locize/locize-cli/releases/download/${1}/locize-${os}"
fi
locize_install=${locize_INSTALL:-$HOME/.locize-cli}
bin_dir="${locize_install}/bin"
exe="$bin_dir/locize"
if [ ! -d "$bin_dir" ]; then
mkdir -p "$bin_dir"
fi
curl -fL# -o "$exe" "$locize_uri"
chmod +x "$exe"
echo "locize-cli (locize) was installed successfully to $exe"
if command -v deno >/dev/null; then
echo "Run 'locize --help' to get started"
else
echo "Manually add the directory to your \$HOME/.bash_profile (or similar)"
echo " export locize_INSTALL=\"$locize_install\""
echo " export PATH=\"\$locize_INSTALL/bin:\$PATH\""
echo "Run '$exe --help' to get started"
fi