From a4593c3b1980f59208f70ad79a26d095b0b52aa2 Mon Sep 17 00:00:00 2001 From: naps62-yolo Date: Mon, 25 May 2026 14:37:52 +0000 Subject: [PATCH] feat(maestro): add `install.sh` bootstrap for one-line install/update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Single command for both first install and subsequent updates: curl -sSf https://git.naps.pt/naps62/maestro/raw/branch/main/install.sh | sh Builds `maestro-installer` into a temp `--root`, runs the wizard, cleans up — so only `maestrod` and `maestro` persist in `~/.cargo/bin`. Re-running updates in place via cargo install's overwrite semantics. Wizard flags pass through with `sh -s --`. Docs updated to lead with the one-liner. Refs NAP-225. --- docs/INSTALL.md | 30 +++++++++++++++++++++++++----- install.sh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 5 deletions(-) create mode 100755 install.sh 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" "$@"