Files
vm/install.sh
T
zeekayandHanzo Dev 19b5c996fc release: 0.1.2, per-arch cold start
Every platform can now bootstrap from the release: install.sh learns
linux-x86_64, and the OS asset set ships per-arch so assets.rs finds a
tarball on both Linux architectures instead of 404ing on x86_64.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-01 16:44:41 -07:00

88 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
set -eu
REPO="hanzoai/vm"
INSTALL_DIR="$HOME/.local/bin"
PLATFORM=""
##### Platform checks
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Darwin)
if [ "$ARCH" != "arm64" ]; then
echo "Error: hanzo-vm requires Apple Silicon (arm64) on macOS. Detected: $ARCH" >&2
exit 1
fi
PLATFORM="darwin-aarch64"
;;
Linux)
case "$ARCH" in
aarch64|arm64)
PLATFORM="linux-aarch64"
;;
x86_64)
PLATFORM="linux-x86_64"
;;
*)
echo "Error: hanzo-vm Linux builds support aarch64 and x86_64. Detected: $ARCH" >&2
exit 1
;;
esac
;;
*)
echo "Error: hanzo-vm only supports macOS and Linux. Detected: $OS" >&2
exit 1
;;
esac
##### Fetch latest release tag
echo "Fetching latest release..."
TAG=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p')
if [ -z "$TAG" ]; then
echo "Error: could not determine latest release." >&2
exit 1
fi
VERSION="${TAG#v}"
echo "Latest version: $VERSION"
##### Download and extract
TARBALL="hanzo-vm-v${VERSION}-${PLATFORM}.tar.gz"
URL="https://github.com/${REPO}/releases/download/${TAG}/${TARBALL}"
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
echo "Downloading ${TARBALL}..."
curl -fsSL "$URL" -o "$TMPDIR/$TARBALL"
mkdir -p "$INSTALL_DIR"
tar -xzf "$TMPDIR/$TARBALL" -C "$INSTALL_DIR"
chmod +x "$INSTALL_DIR/hanzo-vm"
if [ "$OS" = "Darwin" ]; then
xattr -d com.apple.quarantine "$INSTALL_DIR/hanzo-vm" 2>/dev/null || true
fi
echo ""
echo "Installed hanzo-vm $VERSION to $INSTALL_DIR/hanzo-vm"
##### PATH check
case ":$PATH:" in
*":$INSTALL_DIR:"*) ;;
*)
echo ""
echo "Add $INSTALL_DIR to your PATH:"
echo ""
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
echo ""
echo "Add the line above to your ~/.zshrc to make it permanent."
;;
esac