#!/bin/sh # Install wsbx from a release: curl -fsSL https://git.nhaiden.io/niklas/woiken-sandboxes/raw/branch/main/install.sh | sh # Env: WSBX_VERSION (tag, default: latest release), WSBX_INSTALL_DIR (default: ~/.local/bin) set -eu REPO=https://git.nhaiden.io/niklas/woiken-sandboxes DIR=${WSBX_INSTALL_DIR:-$HOME/.local/bin} [ "$(uname -s)-$(uname -m)" = Darwin-arm64 ] || { echo "wsbx needs macOS on Apple Silicon" >&2; exit 1; } TAG=${WSBX_VERSION:-$(curl -fsSL https://git.nhaiden.io/api/v1/repos/niklas/woiken-sandboxes/releases/latest | sed -n 's/.*"tag_name":"\([^"]*\)".*/\1/p')} [ -n "$TAG" ] || { echo "could not determine the latest release" >&2; exit 1; } F="wsbx-$TAG-darwin-arm64.tar.gz" TMP=$(mktemp -d) trap 'rm -rf "$TMP"' EXIT cd "$TMP" echo "downloading $F" curl -fsSLO "$REPO/releases/download/$TAG/$F" curl -fsSLO "$REPO/releases/download/$TAG/$F.sha256" shasum -a 256 -c "$F.sha256" >/dev/null || { echo "checksum mismatch for $F" >&2; exit 1; } tar -xzf "$F" wsbx mkdir -p "$DIR" install -m 755 wsbx "$DIR/wsbx" echo "installed $("$DIR/wsbx" --version) to $DIR/wsbx" case ":$PATH:" in *":$DIR:"*) ;; *) echo "note: $DIR is not on your PATH" ;; esac command -v vfkit >/dev/null || echo "note: wsbx needs vfkit and e2fsprogs: brew install vfkit e2fsprogs"