-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
32 lines (26 loc) · 930 Bytes
/
Copy pathinstall.sh
File metadata and controls
32 lines (26 loc) · 930 Bytes
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
#!/usr/bin/env bash
# Installs the latest gai release binary from GitHub Releases.
#
# Usage on the VPS:
# curl -fsSL https://raw.githubusercontent.com/casablanque-code/gai/main/install.sh | sudo bash
#
# Or pin a version:
# curl -fsSL .../install.sh | sudo bash -s -- v0.1.0
set -euo pipefail
REPO="casablanque-code/gai"
TARGET="x86_64-unknown-linux-musl"
INSTALL_DIR="/usr/local/bin"
VERSION="${1:-latest}"
if [ "$VERSION" = "latest" ]; then
URL="https://github.com/${REPO}/releases/latest/download/gai-${TARGET}.tar.gz"
else
URL="https://github.com/${REPO}/releases/download/${VERSION}/gai-${TARGET}.tar.gz"
fi
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
echo "downloading ${URL}"
curl -fsSL "$URL" -o "${TMP_DIR}/gai.tar.gz"
tar xzf "${TMP_DIR}/gai.tar.gz" -C "$TMP_DIR"
install -m 0755 "${TMP_DIR}/gai" "${INSTALL_DIR}/gai"
echo "installed to ${INSTALL_DIR}/gai"
"${INSTALL_DIR}/gai" --version || true