diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 475d955..a3b8df4 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -1,11 +1,19 @@ # Installing Maestro -The fastest way to get `maestrod` (per-host daemon) and `maestro` (CLI) onto a -host is the install wizard: +One command, used for both first install and subsequent updates: ```sh -cargo install --git https://git.naps.pt/naps62/maestro maestro-installer -maestro-install +curl -sSf https://git.naps.pt/naps62/maestro/raw/branch/main/install.sh | sh +``` + +The bootstrap script builds `maestro-installer` into a temp directory, runs the +wizard, and cleans up — only `maestrod` and `maestro` end up persisted in +`~/.cargo/bin`. Re-run any time to update; `cargo install` overwrites in place. + +Pass flags through to the wizard via `sh -s --`: + +```sh +curl -sSf https://git.naps.pt/naps62/maestro/raw/branch/main/install.sh | sh -s -- --yes --no-systemd ``` The wizard: @@ -60,7 +68,19 @@ systemctl --user status maestrod journalctl --user -u maestrod -f ``` -## Manual install (no wizard) +## Running the wizard without the bootstrap script + +If you'd rather not pipe a script: + +```sh +cargo install --git https://git.naps.pt/naps62/maestro maestro-installer +maestro-install +``` + +This leaves `maestro-installer` permanently in `~/.cargo/bin` — the bootstrap +script avoids that by installing to a scratch dir. + +## Fully manual install (no wizard) ```sh cargo install --git https://git.naps.pt/naps62/maestro --locked maestro-daemon diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..3b16d4e --- /dev/null +++ b/install.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Bootstrap installer for maestro. Builds the `maestro-installer` crate into a +# scratch dir, runs the wizard, and cleans up — leaving only the binaries the +# wizard installs (`maestrod`, `maestro`) in `~/.cargo/bin`. +# +# Usage: +# curl -sSf https://git.naps.pt/naps62/maestro/raw/branch/main/install.sh | sh +# +# Pass flags through to the wizard with `sh -s --`: +# curl -sSf <...>/install.sh | sh -s -- --yes --no-systemd +# +# Re-run any time to update — `cargo install` overwrites the existing binaries. + +set -eu + +REPO_URL=${MAESTRO_REPO_URL:-https://git.naps.pt/naps62/maestro} +REPO_BRANCH=${MAESTRO_REPO_BRANCH:-} + +if ! command -v cargo >/dev/null 2>&1; then + echo "maestro install: \`cargo\` not found on PATH." >&2 + echo "Install Rust first: https://rustup.rs" >&2 + exit 1 +fi + +tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t maestro-install) +trap 'rm -rf "$tmpdir"' EXIT INT TERM + +echo "==> building maestro-installer in $tmpdir" +if [ -n "$REPO_BRANCH" ]; then + cargo install --git "$REPO_URL" --branch "$REPO_BRANCH" \ + --root "$tmpdir" --locked maestro-installer +else + cargo install --git "$REPO_URL" \ + --root "$tmpdir" --locked maestro-installer +fi + +exec "$tmpdir/bin/maestro-install" "$@"