-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·42 lines (37 loc) · 1.38 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·42 lines (37 loc) · 1.38 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
#!/usr/bin/env bash
# kernel-radar one-line installer (Linux / macOS / WSL).
#
# Local clone: ./install.sh --target claude
# One-liner: curl -fsSL https://raw.githubusercontent.com/RL-Align/kernel-radar/main/install.sh | bash -s -- --target all
#
# Override the source repo/ref with KERNEL_RADAR_REPO / KERNEL_RADAR_REF.
# All arguments after `--` are forwarded to install.py.
set -euo pipefail
REPO="${KERNEL_RADAR_REPO:-https://github.com/RL-Align/kernel-radar}"
REF="${KERNEL_RADAR_REF:-main}"
PY="$(command -v python3 || command -v python || true)"
if [ -z "$PY" ]; then
echo "kernel-radar: Python 3.8+ is required but was not found on PATH." >&2
exit 1
fi
# Prefer a local checkout (this script sitting next to install.py); otherwise
# fetch a shallow clone into a temp dir.
SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" 2>/dev/null && pwd || true)"
CLEANUP=""
if [ -n "$SELF_DIR" ] && [ -f "$SELF_DIR/install.py" ]; then
SRC="$SELF_DIR"
else
if ! command -v git >/dev/null 2>&1; then
echo "kernel-radar: git is required to fetch the project." >&2
exit 1
fi
SRC="$(mktemp -d)"
CLEANUP="$SRC"
echo "Fetching kernel-radar ($REF) from $REPO ..."
git clone --quiet --depth 1 --branch "$REF" "$REPO" "$SRC" 2>/dev/null \
|| git clone --quiet --depth 1 "$REPO" "$SRC"
fi
"$PY" "$SRC/install.py" "$@"
status=$?
[ -n "$CLEANUP" ] && rm -rf "$CLEANUP"
exit $status