-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·50 lines (41 loc) · 1.48 KB
/
release.sh
File metadata and controls
executable file
·50 lines (41 loc) · 1.48 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
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
set -euo pipefail
# Default output directory
DEFAULT_DIR="$HOME/.agman/bin"
OUTPUT_DIR="${1:-$DEFAULT_DIR}"
# Ensure output directory exists (auto-create for default, error for custom)
if [[ ! -d "$OUTPUT_DIR" ]]; then
if [[ -z "${1:-}" ]]; then
mkdir -p "$OUTPUT_DIR"
else
echo "Error: $OUTPUT_DIR does not exist."
exit 1
fi
fi
# Build in release mode
echo "Building agman in release mode..."
cargo build --release
# Copy binary to output directory
echo "Installing to $OUTPUT_DIR/agman..."
cp target/release/agman "$OUTPUT_DIR/agman"
# Remove quarantine attributes and ad-hoc sign (macOS)
if [[ "$(uname)" == "Darwin" ]]; then
echo "Signing binary for macOS..."
xattr -cr "$OUTPUT_DIR/agman" 2>/dev/null || true
codesign -s - "$OUTPUT_DIR/agman" 2>/dev/null || true
fi
# Signal running TUI to restart with the new binary.
# This is done BEFORE `agman init` so the TUI gets the restart signal even
# if init fails (the restarted TUI will run its own init anyway).
touch "$HOME/.agman/.restart-tui"
# Reinitialize agman config files
echo "Running agman init --force..."
agman init --force
# Check if the default install dir is in $PATH (only for default dir)
if [[ -z "${1:-}" ]] && [[ ":$PATH:" != *":$OUTPUT_DIR:"* ]]; then
echo ""
echo "NOTE: $OUTPUT_DIR is not in your \$PATH. Add this to your shell profile:"
echo " export PATH=\"$OUTPUT_DIR:\$PATH\""
echo ""
fi
echo "Done! agman installed at $OUTPUT_DIR/agman"