-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·70 lines (61 loc) · 2.12 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·70 lines (61 loc) · 2.12 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# MFCQI CLI installer — downloads the prebuilt GraalVM native binary for your platform.
# No Java required. Usage:
# curl -fsSL https://raw.githubusercontent.com/integrallis/mfcqi-java/main/install.sh | sh
# Environment overrides:
# MFCQI_VERSION version to install (default: latest), e.g. 0.2.0
# MFCQI_INSTALL_DIR target directory (default: $HOME/.local/bin)
set -eu
REPO="integrallis/mfcqi-java"
INSTALL_DIR="${MFCQI_INSTALL_DIR:-$HOME/.local/bin}"
VERSION="${MFCQI_VERSION:-latest}"
os="$(uname -s)"
arch="$(uname -m)"
case "$os" in
Linux) os_name="linux" ;;
Darwin) os_name="macos" ;;
*)
echo "Unsupported OS: $os. On Windows, use Scoop or download the .exe from the releases page." >&2
exit 1
;;
esac
case "$arch" in
x86_64 | amd64) arch_name="x86_64" ;;
arm64 | aarch64) arch_name="aarch64" ;;
*)
echo "Unsupported architecture: $arch" >&2
exit 1
;;
esac
if [ "$os_name" = "linux" ] && [ "$arch_name" = "aarch64" ]; then
echo "No prebuilt linux-aarch64 binary yet — build from source (see the README)." >&2
exit 1
fi
asset="mfcqi-${os_name}-${arch_name}"
if [ "$VERSION" = "latest" ]; then
url="https://github.com/${REPO}/releases/latest/download/${asset}"
else
url="https://github.com/${REPO}/releases/download/v${VERSION}/${asset}"
fi
echo "Installing mfcqi (${os_name}-${arch_name}, version: ${VERSION})..."
mkdir -p "$INSTALL_DIR"
tmp="$(mktemp)"
if ! curl -fsSL "$url" -o "$tmp"; then
rm -f "$tmp"
# Intel macOS native binaries are maintainer-built and may not be attached to every release.
if [ "$os_name" = "macos" ] && [ "$arch_name" = "x86_64" ]; then
echo "No Intel-macOS native binary on this release. Use the JVM distribution" >&2
echo "(mfcqi-${VERSION}.zip, needs a JRE 11+) or build from source — see the README." >&2
else
echo "Download failed: $url" >&2
fi
exit 1
fi
chmod +x "$tmp"
mv "$tmp" "$INSTALL_DIR/mfcqi"
echo "Installed: $INSTALL_DIR/mfcqi"
case ":$PATH:" in
*":$INSTALL_DIR:"*) ;;
*) echo "Note: $INSTALL_DIR is not on your PATH. Add it, e.g.: export PATH=\"$INSTALL_DIR:\$PATH\"" ;;
esac
"$INSTALL_DIR/mfcqi" --version || true