open-standards/wai/quickstart/install.sh
Transaction Science 15d6a51e9d CI: the examples run on every leg that hosts them, and the release builds the archive
.github/workflows/wai-examples.yml runs each example through wai create and
wai dev: the portable ones on linux, the archive as the release builds it,
the quickstart's readiness check (wai dev --check from the unpacked archive),
the browser examples and apple-app on macos, android-app on linux-arm64.
wai-conformance.yml runs tests/floor.rs and tests/cli_dx.rs, and fires on
wai/examples/ (the templates are compiled into wai). wai-release.yml, on a
tag wai-v<version>, builds the room client once and the archive on each
runner, attaches them with their SHA-256, and writes the Homebrew formula
and the Scoop manifest; wai/quickstart/install.sh installs a release.

Two clippy notes of the new code fixed (a type alias for a template's files;
hex only where hello and verify are built).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 22:58:39 -04:00

43 lines
2 KiB
Shell
Executable file

#!/bin/sh
# Install the WAI command line, and what `wai dev` runs, from the forge's releases:
#
# curl -fsSL https://wai.transaction.science/install.sh | sh
#
# It picks the archive for this system (macOS or Linux, arm64 or x86_64), checks it against the
# SHA-256 the release states, and unpacks it into $WAI_HOME (default ~/.wai): bin/ and
# share/wai/web/ side by side. Then it says which line puts ~/.wai/bin on your PATH. Nothing
# else is changed. WAI_VERSION picks a release (default: the one below).
set -eu
VERSION="${WAI_VERSION:-0.3.0}"
DEST="${WAI_HOME:-$HOME/.wai}"
BASE="https://git.transaction.science/Transaction-Science/open-standards/releases/download/wai-v$VERSION"
case "$(uname -s)" in
Darwin) os=apple-darwin ;;
Linux) os=unknown-linux-musl ;;
*) echo "wai: no archive for $(uname -s); build from source: https://wai.transaction.science/docs/quickstart/" >&2; exit 1 ;;
esac
case "$(uname -m)" in
arm64 | aarch64) cpu=aarch64 ;;
x86_64 | amd64) cpu=x86_64 ;;
*) echo "wai: no archive for $(uname -m)" >&2; exit 1 ;;
esac
NAME="wai-$VERSION-$cpu-$os"
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT
echo "wai: fetching $NAME"
curl -fsSL -o "$TMP/$NAME.tar.gz" "$BASE/$NAME.tar.gz"
curl -fsSL -o "$TMP/$NAME.tar.gz.sha256" "$BASE/$NAME.tar.gz.sha256"
want="$(cut -d' ' -f1 "$TMP/$NAME.tar.gz.sha256")"
if command -v sha256sum > /dev/null 2>&1; then got="$(sha256sum "$TMP/$NAME.tar.gz" | cut -d' ' -f1)"; else got="$(shasum -a 256 "$TMP/$NAME.tar.gz" | cut -d' ' -f1)"; fi
[ "$got" = "$want" ] || { echo "wai: the archive's SHA-256 is $got, not the release's $want; nothing installed" >&2; exit 1; }
tar -xzf "$TMP/$NAME.tar.gz" -C "$TMP"
mkdir -p "$DEST"
rm -rf "$DEST/bin" "$DEST/share/wai"
mkdir -p "$DEST/share"
mv "$TMP/$NAME/bin" "$DEST/bin"
mv "$TMP/$NAME/share/wai" "$DEST/share/wai"
cp "$TMP/$NAME/README.md" "$TMP/$NAME/LICENSE" "$DEST/"
"$DEST/bin/wai" create --list > /dev/null
echo "wai: installed in $DEST. Put it on your PATH:"
echo " export PATH=\"$DEST/bin:\$PATH\""
echo "then: wai hello"