-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
34 lines (27 loc) · 935 Bytes
/
install.sh
File metadata and controls
34 lines (27 loc) · 935 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
33
34
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
if ! command -v go >/dev/null 2>&1; then
echo "[!] Go is not installed. Install Go 1.22+ and rerun."
exit 1
fi
mkdir -p "$HOME/.local/bin"
echo "[macaron] building binary..."
go mod tidy
go build -o "$HOME/.local/bin/macaron" ./cmd/macaron
chmod +x "$HOME/.local/bin/macaron"
PATH_LINE='export PATH="$HOME/.local/bin:$PATH"'
add_to_profile() {
local profile="$1"
if [ -f "$profile" ] && ! grep -qF 'HOME/.local/bin' "$profile" 2>/dev/null; then
echo "$PATH_LINE" >> "$profile"
echo "[macaron] added PATH entry to $profile"
fi
}
add_to_profile "$HOME/.bashrc"
add_to_profile "$HOME/.zshrc"
add_to_profile "$HOME/.profile"
echo "[macaron] installed to $HOME/.local/bin/macaron"
echo "[macaron] restart your shell or run: export PATH=\"\$HOME/.local/bin:\$PATH\""
echo "[macaron] then run: macaron --version"