-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
install
executable file
·44 lines (33 loc) · 1.04 KB
/
install
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
#!/usr/bin/env bash
set -euo pipefail
default_install_dir="/usr/local/bin"
install_dir=$default_install_dir
install_dir_opt=${1:-}
if [ "$install_dir_opt" ]; then
install_dir="$install_dir_opt"
fi
download_dir=/tmp
latest_release="$(curl -sL https://raw.githubusercontent.com/borkdude/jet/master/resources/JET_RELEASED_VERSION)"
case "$(uname -m)" in
aarch64) arch=aarch64;;
arm64) arch="aarch64"
;;
*) arch=amd64
esac
case "$(uname -s)" in
Linux*) platform=linux;;
Darwin*) platform=macos;;
esac
download_url="https://github.com/borkdude/jet/releases/download/v$latest_release/jet-$latest_release-$platform-$arch.tar.gz"
download_file="jet-$latest_release-$platform-$arch.tar.gz"
cd "$download_dir"
echo -e "Downloading $download_url."
curl -o "$download_file" -sL "$download_url"
tar -xzf "$download_file"
rm "$download_file"
cd "$install_dir"
if [ -f jet ]; then
echo "Moving $install_dir/jet to $install_dir/jet.old"
fi
mv -f "$download_dir/jet" "$PWD/jet"
echo "Successfully installed jet in $install_dir."