Skip to content

Commit bfad3af

Browse files
paoloanznclaude
andcommitted
feat: add one-liner install script for Linux/macOS
Downloads the latest release binary for the detected OS/arch and installs to ~/.local/bin. Updated README with install instructions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 99b6e89 commit bfad3af

2 files changed

Lines changed: 84 additions & 3 deletions

File tree

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,20 @@ flare serve docker:container --image nginx:alpine --container-port 80 --subdomai
5757

5858
## Install
5959

60-
### From source
60+
**One-liner (Linux / macOS):**
61+
62+
```bash
63+
curl -fsSL https://raw.githubusercontent.com/Gladium-AI/flare-cli/main/install.sh | sh
64+
```
65+
66+
Downloads the latest release for your OS/arch and installs to `~/.local/bin`.
67+
68+
**Build from source:**
6169

6270
```bash
6371
git clone https://github.com/Gladium-AI/flare-cli.git
6472
cd flare-cli
65-
make build
66-
sudo mv flare /usr/local/bin/
73+
make install # installs to ~/.local/bin
6774
```
6875

6976
### Prerequisites

install.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/sh
2+
set -e
3+
4+
REPO="Gladium-AI/flare-cli"
5+
INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}"
6+
BINARY="flare"
7+
8+
# Detect OS.
9+
OS="$(uname -s)"
10+
case "$OS" in
11+
Linux*) GOOS="linux" ;;
12+
Darwin*) GOOS="darwin" ;;
13+
*) echo "Unsupported OS: $OS" >&2; exit 1 ;;
14+
esac
15+
16+
# Detect architecture.
17+
ARCH="$(uname -m)"
18+
case "$ARCH" in
19+
x86_64|amd64) GOARCH="amd64" ;;
20+
arm64|aarch64) GOARCH="arm64" ;;
21+
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
22+
esac
23+
24+
echo "Detected platform: ${GOOS}/${GOARCH}"
25+
26+
# Get the latest release tag.
27+
if command -v curl >/dev/null 2>&1; then
28+
TAG="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//')"
29+
elif command -v wget >/dev/null 2>&1; then
30+
TAG="$(wget -qO- "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//')"
31+
else
32+
echo "Error: curl or wget is required" >&2
33+
exit 1
34+
fi
35+
36+
if [ -z "$TAG" ]; then
37+
echo "Error: could not determine latest release" >&2
38+
exit 1
39+
fi
40+
41+
echo "Latest release: ${TAG}"
42+
43+
ARCHIVE="${BINARY}-${TAG}-${GOOS}-${GOARCH}.tar.gz"
44+
URL="https://github.com/${REPO}/releases/download/${TAG}/${ARCHIVE}"
45+
46+
# Download and extract.
47+
TMPDIR="$(mktemp -d)"
48+
trap 'rm -rf "$TMPDIR"' EXIT
49+
50+
echo "Downloading ${URL}..."
51+
if command -v curl >/dev/null 2>&1; then
52+
curl -fsSL "$URL" -o "${TMPDIR}/${ARCHIVE}"
53+
else
54+
wget -q "$URL" -O "${TMPDIR}/${ARCHIVE}"
55+
fi
56+
57+
tar -xzf "${TMPDIR}/${ARCHIVE}" -C "$TMPDIR"
58+
59+
# Install.
60+
mkdir -p "$INSTALL_DIR"
61+
mv "${TMPDIR}/${BINARY}" "${INSTALL_DIR}/${BINARY}"
62+
chmod +x "${INSTALL_DIR}/${BINARY}"
63+
64+
echo "Installed ${BINARY} ${TAG} to ${INSTALL_DIR}/${BINARY}"
65+
66+
# Check if INSTALL_DIR is in PATH.
67+
case ":$PATH:" in
68+
*":${INSTALL_DIR}:"*) ;;
69+
*)
70+
echo ""
71+
echo "Add ${INSTALL_DIR} to your PATH:"
72+
echo " export PATH=\"${INSTALL_DIR}:\$PATH\""
73+
;;
74+
esac

0 commit comments

Comments
 (0)