-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·43 lines (35 loc) · 1.33 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·43 lines (35 loc) · 1.33 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
#!/usr/bin/env sh
set -eu
REF="${JUMPYBRAIN_INSTALL_REF:-master}"
RAW_BASE="${JUMPYBRAIN_RAW_BASE:-https://raw.githubusercontent.com/nikoatwork/jumpyBrain/${REF}}"
SCRIPT_URL="$RAW_BASE/scripts/public-install.mjs"
ORIGIN_HELPER_URL="$RAW_BASE/scripts/remote-target-origin.mjs"
if [ -n "${JUMPYBRAIN_INSTALL_REF+x}" ]; then
set -- --ref "$REF" "$@"
fi
if ! command -v node >/dev/null 2>&1; then
echo "Node >=22 is required. Install Node, then rerun this installer." >&2
exit 1
fi
NODE_MAJOR=$(node -p "Number(process.versions.node.split('.')[0])")
if [ "$NODE_MAJOR" -lt 22 ]; then
echo "Node >=22 is required. Current: $(node -v)" >&2
exit 1
fi
if [ -f "scripts/public-install.mjs" ]; then
exec node scripts/public-install.mjs "$@"
fi
TMP_DIR=$(mktemp -d 2>/dev/null || mktemp -d -t jumpybrain-install)
cleanup() { rm -rf "$TMP_DIR"; }
trap cleanup EXIT INT TERM
if command -v curl >/dev/null 2>&1; then
curl -fsSL "$SCRIPT_URL" -o "$TMP_DIR/public-install.mjs"
curl -fsSL "$ORIGIN_HELPER_URL" -o "$TMP_DIR/remote-target-origin.mjs"
elif command -v wget >/dev/null 2>&1; then
wget -qO "$TMP_DIR/public-install.mjs" "$SCRIPT_URL"
wget -qO "$TMP_DIR/remote-target-origin.mjs" "$ORIGIN_HELPER_URL"
else
echo "curl or wget is required to download the jumpyBrain installer." >&2
exit 1
fi
exec node "$TMP_DIR/public-install.mjs" "$@"