-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
37 lines (32 loc) · 1.04 KB
/
Copy pathinstall.sh
File metadata and controls
37 lines (32 loc) · 1.04 KB
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
#!/bin/sh
# tzo installer (Linux/macOS). Downloads the latest release binary and sets it up.
# Usage: curl -fsSL https://raw.githubusercontent.com/2008wbbv/tzo/main/install.sh | sh
set -eu
REPO="2008wbbv/tzo"
os="$(uname -s)"
arch="$(uname -m)"
case "$os-$arch" in
Linux-x86_64) target="x86_64-unknown-linux-gnu" ;;
Darwin-arm64) target="aarch64-apple-darwin" ;;
Darwin-x86_64) target="x86_64-apple-darwin" ;;
*)
echo "tzo: no prebuilt binary for $os-$arch." >&2
echo "Build from source: https://github.com/$REPO#build-from-source" >&2
exit 1
;;
esac
url="https://github.com/$REPO/releases/latest/download/tzo-$target.tar.gz"
dest="${TZO_INSTALL_DIR:-$HOME/.local/bin}"
mkdir -p "$dest"
echo "Downloading $url"
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
curl -fsSL "$url" -o "$tmp/tzo.tar.gz"
tar -C "$tmp" -xzf "$tmp/tzo.tar.gz"
install -m 0755 "$tmp/tzo" "$dest/tzo"
echo "Installed to $dest/tzo"
case ":$PATH:" in
*":$dest:"*) : ;;
*) echo "Note: add $dest to your PATH to run 'tzo' directly." ;;
esac
"$dest/tzo" setup