bots-garden/razorbillpublic Fork
⑂ 09353c8
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

🛟 Updated.

k33g committed 2026-11-27T10:14:46+01:00 Browse files
09353c8 parent: cb5dd12
modified .claude/skills/release/SKILL.md +2 -2
@@ -75,7 +75,7 @@ Rules:
7575
7676 ## 6. The install guides
7777
78-Set `VERSION=$VERSION` (no `v`) in every command block of `INSTALL.MACOS.md` and `INSTALL.MACOS.fr.md` (the short version and the checked one). Leave the section about archives before 1.0.0 alone. Check that the names the guides use (`razorbill-${VERSION}-macos-arm64.tar.gz`, its folder, `SHA256SUMS`, `com.bots-garden.rzb`) still match what `local-ci-02-build.sh` and `scripts/release.sh` produce. The download links only work once the release is published: say so to the user.
78+Set `VERSION=$VERSION` (no `v`) in every command block of `INSTALL.MACOS.md` and `INSTALL.MACOS.fr.md` ("By hand" and the checked one), and the `--version X.Y.Z` example of the install script section. `install-rzb.sh` itself names no version (it reads `/releases/latest`): check that the asset names and the Team ID it expects still match the release. Leave the section about archives before 1.0.0 alone. Check that the names the guides use (`razorbill-${VERSION}-macos-arm64.tar.gz`, its folder, `SHA256SUMS`, `com.bots-garden.rzb`) still match what `local-ci-02-build.sh` and `scripts/release.sh` produce. The download links only work once the release is published: say so to the user.
7979
8080 ## 7. .release.env
8181
@@ -85,7 +85,7 @@ Set `TAG="$TAG"` in `.release.env` (git-ignored; with the `v`). If the file is m
8585
8686 Run what the project relies on and report the results honestly (counts, failures with their output):
8787
88-- Linux: `scripts/test.sh`, `swiftlint lint --quiet Sources Tests` and `swift format lint -r Sources Tests` (both must print nothing), `shellcheck -x local-ci-*.sh scripts/*.sh`.
88+- Linux: `scripts/test.sh`, `swiftlint lint --quiet Sources Tests` and `swift format lint -r Sources Tests` (both must print nothing), `shellcheck -x local-ci-*.sh install-rzb.sh scripts/*.sh Tests/Installer/*.sh`, `Tests/Installer/test-install-rzb.sh`.
8989 - Mac, when the host runner is up: `tools/host-runner/host.sh test . razorbill` (a 502 means it is down: ask the user to start it, or leave it to `local-ci-01` on the Mac).
9090 - The quality gate: `python3 .claude/skills/quality/scripts/quality_report.py --workspace .`.
9191 - `LOCAL_CI_SKIP_GIT_CHECK=1 LOCAL_CI_PRINT_NOTES=1 ./local-ci-03-create-draft.sh` needs `release/$TAG/SHA256SUMS`, which only step 02 makes: skip it before the build, or point it at a throwaway `LOCAL_CI_ENV_FILE`.
@@ -75,7 +75,7 @@ Rules:
75 75
76 ## 6. The install guides76 ## 6. The install guides
77 77
78-Set `VERSION=$VERSION` (no `v`) in every command block of `INSTALL.MACOS.md` and `INSTALL.MACOS.fr.md` (the short version and the checked one). Leave the section about archives before 1.0.0 alone. Check that the names the guides use (`razorbill-${VERSION}-macos-arm64.tar.gz`, its folder, `SHA256SUMS`, `com.bots-garden.rzb`) still match what `local-ci-02-build.sh` and `scripts/release.sh` produce. The download links only work once the release is published: say so to the user.78+Set `VERSION=$VERSION` (no `v`) in every command block of `INSTALL.MACOS.md` and `INSTALL.MACOS.fr.md` ("By hand" and the checked one), and the `--version X.Y.Z` example of the install script section. `install-rzb.sh` itself names no version (it reads `/releases/latest`): check that the asset names and the Team ID it expects still match the release. Leave the section about archives before 1.0.0 alone. Check that the names the guides use (`razorbill-${VERSION}-macos-arm64.tar.gz`, its folder, `SHA256SUMS`, `com.bots-garden.rzb`) still match what `local-ci-02-build.sh` and `scripts/release.sh` produce. The download links only work once the release is published: say so to the user.
79 79
80 ## 7. .release.env80 ## 7. .release.env
81 81
@@ -85,7 +85,7 @@ Set `TAG="$TAG"` in `.release.env` (git-ignored; with the `v`). If the file is m
85 85
86 Run what the project relies on and report the results honestly (counts, failures with their output):86 Run what the project relies on and report the results honestly (counts, failures with their output):
87 87
88-- Linux: `scripts/test.sh`, `swiftlint lint --quiet Sources Tests` and `swift format lint -r Sources Tests` (both must print nothing), `shellcheck -x local-ci-*.sh scripts/*.sh`.88+- Linux: `scripts/test.sh`, `swiftlint lint --quiet Sources Tests` and `swift format lint -r Sources Tests` (both must print nothing), `shellcheck -x local-ci-*.sh install-rzb.sh scripts/*.sh Tests/Installer/*.sh`, `Tests/Installer/test-install-rzb.sh`.
89 - Mac, when the host runner is up: `tools/host-runner/host.sh test . razorbill` (a 502 means it is down: ask the user to start it, or leave it to `local-ci-01` on the Mac).89 - Mac, when the host runner is up: `tools/host-runner/host.sh test . razorbill` (a 502 means it is down: ask the user to start it, or leave it to `local-ci-01` on the Mac).
90 - The quality gate: `python3 .claude/skills/quality/scripts/quality_report.py --workspace .`.90 - The quality gate: `python3 .claude/skills/quality/scripts/quality_report.py --workspace .`.
91 - `LOCAL_CI_SKIP_GIT_CHECK=1 LOCAL_CI_PRINT_NOTES=1 ./local-ci-03-create-draft.sh` needs `release/$TAG/SHA256SUMS`, which only step 02 makes: skip it before the build, or point it at a throwaway `LOCAL_CI_ENV_FILE`.91 - `LOCAL_CI_SKIP_GIT_CHECK=1 LOCAL_CI_PRINT_NOTES=1 ./local-ci-03-create-draft.sh` needs `release/$TAG/SHA256SUMS`, which only step 02 makes: skip it before the build, or point it at a throwaway `LOCAL_CI_ENV_FILE`.
modified .memory/handoffs/2026-11-27-v1-0-0-local-ci.md +10 -0
@@ -14,3 +14,13 @@
1414 - Unverified: Rickub Actions for the razorbill repo (step 04 needs a CI job), CI_TOKEN rights on razorbill, notarization of the folder (bundles signed without runtime).
1515 - Sandbox: Swift toolchain broken (libxml2.so.16), no swiftlint/qlty. The swift-format warnings the user hit in 01 are fixed (5 files); swiftlint on those edits not run yet — 01 on the Mac will tell.
1616 - Never `git stash` here (sbxenv.yaml busy mount).
17+
18+## Update: 1.0.0 published (08:18 UTC)
19+- Public + promoted on Rickub, assets verified by download (checksum OK). Rickub shows assets only on `/releases/<tag>`, not on the `/releases` list.
20+- Left: `git fetch --tags`; ask whether `scripts/check-hardened-runtime.sh` ran / the signed rzb ran a model, then close #52 (task 2) and milestone v1.0.0.
21+- Ticket #65 (installer) written with proposals A/B/C/D; waiting for the user's choices (task 1).
22+
23+## Update: #65 option A done (uncommitted)
24+- `install-rzb.sh` + `Tests/Installer/test-install-rzb.sh` (26/26 Linux). Milestone v1.1.0 holds #65; task 5 = run `curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash` on the Mac after the push (real signature check never exercised yet).
25+- `--no-xattrs` added to release.sh: the next signed build (1.1.0) must show "signatures intact in the unpacked archive" in 02 — if not, xattrs were needed after all.
26+- Next release 1.1.0: run the `release` skill (notes: installer, --no-xattrs).
@@ -14,3 +14,13 @@
14 - Unverified: Rickub Actions for the razorbill repo (step 04 needs a CI job), CI_TOKEN rights on razorbill, notarization of the folder (bundles signed without runtime).14 - Unverified: Rickub Actions for the razorbill repo (step 04 needs a CI job), CI_TOKEN rights on razorbill, notarization of the folder (bundles signed without runtime).
15 - Sandbox: Swift toolchain broken (libxml2.so.16), no swiftlint/qlty. The swift-format warnings the user hit in 01 are fixed (5 files); swiftlint on those edits not run yet — 01 on the Mac will tell.15 - Sandbox: Swift toolchain broken (libxml2.so.16), no swiftlint/qlty. The swift-format warnings the user hit in 01 are fixed (5 files); swiftlint on those edits not run yet — 01 on the Mac will tell.
16 - Never `git stash` here (sbxenv.yaml busy mount).16 - Never `git stash` here (sbxenv.yaml busy mount).
17+
18+## Update: 1.0.0 published (08:18 UTC)
19+- Public + promoted on Rickub, assets verified by download (checksum OK). Rickub shows assets only on `/releases/<tag>`, not on the `/releases` list.
20+- Left: `git fetch --tags`; ask whether `scripts/check-hardened-runtime.sh` ran / the signed rzb ran a model, then close #52 (task 2) and milestone v1.0.0.
21+- Ticket #65 (installer) written with proposals A/B/C/D; waiting for the user's choices (task 1).
22+
23+## Update: #65 option A done (uncommitted)
24+- `install-rzb.sh` + `Tests/Installer/test-install-rzb.sh` (26/26 Linux). Milestone v1.1.0 holds #65; task 5 = run `curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash` on the Mac after the push (real signature check never exercised yet).
25+- `--no-xattrs` added to release.sh: the next signed build (1.1.0) must show "signatures intact in the unpacked archive" in 02 — if not, xattrs were needed after all.
26+- Next release 1.1.0: run the `release` skill (notes: installer, --no-xattrs).
modified .memory/history.md +3 -0
@@ -572,3 +572,6 @@ open, a comment on each. main fast-forwarded.
572572 - **Trap**: `git stash` breaks here — `sbxenv.yaml` is a busy mount, stash saved but reset half-failed and reverted tracked files; recovered with `git checkout stash@{0} -- <files but sbxenv.yaml>`. Do not use stash in this sandbox.
573573 - **Next**: user commits + pushes from the Mac, then `scripts/check-hardened-runtime.sh`, `local-ci-01…05` (06 optional). Milestone v1.0.0 stays open until #52 task 2 is confirmed.
574574 - Later the same session: the user pasted the `swift format lint` warnings (6, the same as the sandbox's swift-format 6.4.2): fixed in PromptCache, MLXSession, OpenAIError, ServerConfigLoader, ServerTests (wrapped by `swift format -i`, then the test's `@Test` put on its own line and the long `#expect` split with a local, to keep swiftlint's brace rule). `swift format lint -r Sources Tests` now prints nothing; swiftlint and the tests not re-run (not available here).
575+- 2026-11-27, 08:17–08:18 UTC: the user ran the chain on the Mac. Release v1.0.0 is **public and promoted** on Rickub (draft false, prerelease false), target cb5dd12, built with Xcode 26.5, `macos-signature.txt` present (signed + notarized). Upload run #1 "local ci publish" success; assets SHA256SUMS (101 B) and razorbill-1.0.0-macos-arm64.tar.gz (20707553 B); downloaded from the sandbox, `sha256sum -c` OK and SHA256SUMS identical to release/v1.0.0/. The user thought nothing was uploaded: Rickub's /releases list page shows only the notes; the files are on the release's own page, /releases/v1.0.0 ("Assets"), same as mini-me. Not yet: `git fetch --tags` locally (no v1.0.0 tag here), whether scripts/check-hardened-runtime.sh was run (#52 task 2, milestone v1.0.0 still open).
576+- Same day, later: ticket #65 written (installer for the published release, epic Distribution, needs-decision, no milestone): proposals A `install-rzb.sh` via `curl | bash` (recommended first), B signed + notarized + stapled `.pkg` (needs a Developer ID Installer certificate), C Homebrew tap, D `rzb self-update` later; 5 decisions listed for the user. Checked without token: `raw/main/<file>` 200, `/releases/latest` 302 → `/releases/v1.0.0`, `/releases/latest/download/SHA256SUMS` 200, API 401.
577+- Same day, later: #65 option A implemented at the user's "ok pour la A": `install-rzb.sh` at the root (curl | bash from raw/main; latest from the /releases/latest 302; checksum, codesign + Team ID SNLLBZP9V9 + identifier, unpacked `rzb --version`, whole-folder replace, shared launcher marker, sudo only if needed; `--version --prefix --uninstall --dry-run --no-verify`), tests `Tests/Installer/test-install-rzb.sh` 26/26 on Linux, real-release dry run from Linux OK up to running the Mach-O. Wired into local-ci-01 (+ shellcheck if installed); docs INSTALL.MACOS(.fr), README, run-the-tests EN+FR, release skill, 02's README. `scripts/release.sh` now `tar --no-xattrs` (1.0.0 archive had com.apple.provenance pax headers). Milestone v1.1.0 created with #65 (task 5 open: run on the Mac with the signature check, after push). Defaults taken without asking: script name/place, prefix /usr/local, not attached to releases. Trap: a function named `install` shadowed /usr/bin/install → infinite recursion; and `pkill -f <pattern>` killed the tool's own shell (pattern in its command line).
@@ -572,3 +572,6 @@ open, a comment on each. main fast-forwarded.
572 - **Trap**: `git stash` breaks here — `sbxenv.yaml` is a busy mount, stash saved but reset half-failed and reverted tracked files; recovered with `git checkout stash@{0} -- <files but sbxenv.yaml>`. Do not use stash in this sandbox.572 - **Trap**: `git stash` breaks here — `sbxenv.yaml` is a busy mount, stash saved but reset half-failed and reverted tracked files; recovered with `git checkout stash@{0} -- <files but sbxenv.yaml>`. Do not use stash in this sandbox.
573 - **Next**: user commits + pushes from the Mac, then `scripts/check-hardened-runtime.sh`, `local-ci-01…05` (06 optional). Milestone v1.0.0 stays open until #52 task 2 is confirmed.573 - **Next**: user commits + pushes from the Mac, then `scripts/check-hardened-runtime.sh`, `local-ci-01…05` (06 optional). Milestone v1.0.0 stays open until #52 task 2 is confirmed.
574 - Later the same session: the user pasted the `swift format lint` warnings (6, the same as the sandbox's swift-format 6.4.2): fixed in PromptCache, MLXSession, OpenAIError, ServerConfigLoader, ServerTests (wrapped by `swift format -i`, then the test's `@Test` put on its own line and the long `#expect` split with a local, to keep swiftlint's brace rule). `swift format lint -r Sources Tests` now prints nothing; swiftlint and the tests not re-run (not available here).574 - Later the same session: the user pasted the `swift format lint` warnings (6, the same as the sandbox's swift-format 6.4.2): fixed in PromptCache, MLXSession, OpenAIError, ServerConfigLoader, ServerTests (wrapped by `swift format -i`, then the test's `@Test` put on its own line and the long `#expect` split with a local, to keep swiftlint's brace rule). `swift format lint -r Sources Tests` now prints nothing; swiftlint and the tests not re-run (not available here).
575+- 2026-11-27, 08:17–08:18 UTC: the user ran the chain on the Mac. Release v1.0.0 is **public and promoted** on Rickub (draft false, prerelease false), target cb5dd12, built with Xcode 26.5, `macos-signature.txt` present (signed + notarized). Upload run #1 "local ci publish" success; assets SHA256SUMS (101 B) and razorbill-1.0.0-macos-arm64.tar.gz (20707553 B); downloaded from the sandbox, `sha256sum -c` OK and SHA256SUMS identical to release/v1.0.0/. The user thought nothing was uploaded: Rickub's /releases list page shows only the notes; the files are on the release's own page, /releases/v1.0.0 ("Assets"), same as mini-me. Not yet: `git fetch --tags` locally (no v1.0.0 tag here), whether scripts/check-hardened-runtime.sh was run (#52 task 2, milestone v1.0.0 still open).
576+- Same day, later: ticket #65 written (installer for the published release, epic Distribution, needs-decision, no milestone): proposals A `install-rzb.sh` via `curl | bash` (recommended first), B signed + notarized + stapled `.pkg` (needs a Developer ID Installer certificate), C Homebrew tap, D `rzb self-update` later; 5 decisions listed for the user. Checked without token: `raw/main/<file>` 200, `/releases/latest` 302 → `/releases/v1.0.0`, `/releases/latest/download/SHA256SUMS` 200, API 401.
577+- Same day, later: #65 option A implemented at the user's "ok pour la A": `install-rzb.sh` at the root (curl | bash from raw/main; latest from the /releases/latest 302; checksum, codesign + Team ID SNLLBZP9V9 + identifier, unpacked `rzb --version`, whole-folder replace, shared launcher marker, sudo only if needed; `--version --prefix --uninstall --dry-run --no-verify`), tests `Tests/Installer/test-install-rzb.sh` 26/26 on Linux, real-release dry run from Linux OK up to running the Mach-O. Wired into local-ci-01 (+ shellcheck if installed); docs INSTALL.MACOS(.fr), README, run-the-tests EN+FR, release skill, 02's README. `scripts/release.sh` now `tar --no-xattrs` (1.0.0 archive had com.apple.provenance pax headers). Milestone v1.1.0 created with #65 (task 5 open: run on the Mac with the signature check, after push). Defaults taken without asking: script name/place, prefix /usr/local, not attached to releases. Trap: a function named `install` shadowed /usr/bin/install → infinite recursion; and `pkill -f <pattern>` killed the tool's own shell (pattern in its command line).
modified .memory/summary.md +2 -1
@@ -288,7 +288,8 @@ tar.gz, `SHA256SUMS`, README.md, build-info.txt, macos-signature.txt. 03–06 ta
288288 (git-ignored, the user copied it): draft prerelease + tag, upload through a temporary branch whose
289289 CI job uploads, publish (type the tag), promote. Notes text from `release-notes/<TAG>.md`.
290290 `scripts/check-hardened-runtime.sh`: compat suite against an rzb signed with the hardened runtime.
291-User install guide: `INSTALL.MACOS.md` / `.fr.md` (folder in `/usr/local/lib/razorbill` + the
291+Installer (#65, v1.1.0): `install-rzb.sh` at the root (`curl -fsSL …/raw/main/install-rzb.sh | bash`), tests
292+`Tests/Installer/test-install-rzb.sh` (run by local-ci-01). User install guide: `INSTALL.MACOS.md` / `.fr.md` (folder in `/usr/local/lib/razorbill` + the
292293 install.sh launcher). The `release` skill (.claude/skills/release) is now razorbill's.
293294 License: MIT (`LICENSE`, 2026-11-27), shipped in the archive.
294295 **Install on the Mac**: `scripts/install.sh` (incremental Release build in `.build/xcode`, copies rzb +
@@ -288,7 +288,8 @@ tar.gz, `SHA256SUMS`, README.md, build-info.txt, macos-signature.txt. 03–06 ta
288 (git-ignored, the user copied it): draft prerelease + tag, upload through a temporary branch whose288 (git-ignored, the user copied it): draft prerelease + tag, upload through a temporary branch whose
289 CI job uploads, publish (type the tag), promote. Notes text from `release-notes/<TAG>.md`.289 CI job uploads, publish (type the tag), promote. Notes text from `release-notes/<TAG>.md`.
290 `scripts/check-hardened-runtime.sh`: compat suite against an rzb signed with the hardened runtime.290 `scripts/check-hardened-runtime.sh`: compat suite against an rzb signed with the hardened runtime.
291-User install guide: `INSTALL.MACOS.md` / `.fr.md` (folder in `/usr/local/lib/razorbill` + the291+Installer (#65, v1.1.0): `install-rzb.sh` at the root (`curl -fsSL …/raw/main/install-rzb.sh | bash`), tests
292+`Tests/Installer/test-install-rzb.sh` (run by local-ci-01). User install guide: `INSTALL.MACOS.md` / `.fr.md` (folder in `/usr/local/lib/razorbill` + the
292 install.sh launcher). The `release` skill (.claude/skills/release) is now razorbill's.293 install.sh launcher). The `release` skill (.claude/skills/release) is now razorbill's.
293 License: MIT (`LICENSE`, 2026-11-27), shipped in the archive.294 License: MIT (`LICENSE`, 2026-11-27), shipped in the archive.
294 **Install on the Mac**: `scripts/install.sh` (incremental Release build in `.build/xcode`, copies rzb +295 **Install on the Mac**: `scripts/install.sh` (incremental Release build in `.build/xcode`, copies rzb +
added .tickets/issues/0065-installer-for-the-published-release.yaml +127 -0
new file mode 100644
@@ -0,0 +1,127 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 65
3+title: "Installer for the published release (rzb on a Mac without the sources)"
4+state: open
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-27T13:00:00.000Z
9+updatedAt: 2026-11-27T14:00:00.000Z
10+labels:
11+ - "kind::feature"
12+ - "area::build"
13+ - "mac-only"
14+ - "priority::medium"
15+milestone: "v1.1.0"
16+epic: "Distribution"
17+related:
18+ - 50
19+ - 52
20+body: |
21+ Asked by the user (2026-11-27, after 1.0.0 was published): an installer.
22+
23+ ## Today
24+ Installing the published release is the 9 commands of INSTALL.MACOS.md: download the tar.gz, unpack, `sudo mv` the folder to `/usr/local/lib/razorbill`, write the launcher `/usr/local/bin/rzb` by hand with `printf | sudo tee`, chmod. Checking the checksum and the signature is 5 more optional commands. Upgrading = doing it all again with a new VERSION. `scripts/install.sh` only installs from the sources (it builds with Xcode).
25+
26+ Constraints any installer must respect:
27+ - rzb is a folder (rzb + 6 resource bundles, `mlx-swift_Cmlx.bundle` holds the Metal library), never a lone binary: folder in `<prefix>/lib/razorbill`, launcher `<prefix>/bin/rzb` with the marker `# razorbill launcher (scripts/install.sh)` so that `scripts/install.sh --uninstall` and every installer recognise each other's install and never overwrite an `rzb` they did not write.
28+ - macOS 14+, Apple Silicon only: refuse anything else with a clear message.
29+ - Never touch the models (`~/.cache/huggingface`) or the settings (`~/.config/razorbill`).
30+ - Replace the whole folder on upgrade (no stale bundle).
31+
32+ Checked from the sandbox (2026-11-27), all without a token: `https://rickub.com/bots-garden/razorbill/raw/main/<file>` serves repository files (200); `/releases/latest` answers 302 to `/releases/v1.0.0` (the latest tag); `/releases/latest/download/SHA256SUMS` works (200). The API (`/api/v1/repos/.../releases`) needs a token (401): an installer must not use it.
33+
34+ ## Proposals
35+
36+ ### A. An install script, `curl … | bash` (recommended first)
37+ `install-rzb.sh` at the root of the repository, served by `raw/main`:
38+ ```
39+ curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
40+ curl -fsSL …/install-rzb.sh | bash -s -- --version 1.0.0 --prefix ~/.local
41+ ```
42+ - Finds the latest tag from the `/releases/latest` redirect (or `--version`), downloads the archive and `SHA256SUMS` into a temp folder, checks the checksum, unpacks, checks `codesign --verify --strict` and that the TeamIdentifier is ours (refuses otherwise; `--no-verify` to skip, e.g. for an unsigned pre-1.0 archive), runs the unpacked `rzb --version`, then installs folder + launcher (sudo only when the prefix is not writable, like scripts/install.sh). `--uninstall`, `--prefix`, `--version`, `--dry-run`.
43+ - Pros: one command for install and upgrade; no new certificate, no new infrastructure; reuses the existing archive and chain; works with curl (no quarantine).
44+ - Cons: `curl | bash` asks the user to trust the script (mitigation: document "download, read, run"); the script itself is not signed; it is served from `main`, so a broken commit on main breaks installs (mitigation: shellcheck + a test that runs it against a local fake release, and it is part of local-ci-01).
45+ - Cost: small (~1 day with tests and EN/FR docs). Could also be attached to each release as an asset.
46+
47+ ### B. A signed and notarized `.pkg`
48+ `razorbill-<version>-macos-arm64.pkg` built by `local-ci-02` with `pkgbuild` + `productbuild`, installing `/usr/local/lib/razorbill` and the launcher, signed with a **Developer ID Installer** certificate, notarized and **stapled** (a pkg can be stapled: works offline, no online check at first run).
49+ - Pros: double-click, the most "Mac" experience; Gatekeeper checks it fully (`spctl --assess --type install`); MDM-friendly.
50+ - Cons: needs a second certificate (Developer ID **Installer**, not Application — to check whether the team already has one); no native uninstall (ship `rzb-uninstall` or document it); a pkg always asks for an admin password and always installs to /usr/local (no per-user prefix); one more asset and one more notarization (+ a few minutes) per release; postinstall scripts to write the launcher, or the launcher shipped as a file in the payload.
51+ - Cost: medium (~2 days: build + sign + notarize + staple in 02, upload in 04, checks, docs).
52+
53+ ### C. A Homebrew tap
54+ A repository `bots-garden/homebrew-tap` (or a `Formula/` folder in this repo) with a cask or a formula `razorbill` pointing at the release archive and its sha256: `brew tap bots-garden/tap https://git.rickub.com/bots-garden/homebrew-tap.git && brew install razorbill`, then `brew upgrade razorbill`.
55+ - Pros: upgrades and uninstall for free; users who already use brew expect it; Homebrew installs the folder in its Cellar and links `bin/rzb` (wrapper), no sudo.
56+ - Cons: the tap must be updated at every release (a step `local-ci-07` that rewrites version + sha256 and pushes the tap); tapping a non-GitHub repo needs the full git URL; Homebrew's own audit rules for casks/formulae to follow; does not replace A or B for users without brew; a brew install and a /usr/local install can coexist and shadow each other on PATH (check and warn).
57+ - Cost: small to medium (~1 day + the release step), and a second repository to maintain.
58+
59+ ### D. Later: `rzb self-update`
60+ A command in rzb that checks `/releases/latest` and replaces its own folder (the logic of A, in Swift). Only worth it after A, and it needs care: replacing the running executable's folder, sudo for /usr/local. Not proposed for now.
61+
62+ ## Suggested order
63+ A now (1.1.0), since it removes almost all of the friction at low cost; then C if users ask for brew; B only if offline first run or MDM matters (or if the Installer certificate already exists).
64+
65+ ## Decisions for the user
66+ 1. Which proposals (A, B, C), and in which order / milestone?
67+ 2. A: script name (`install-rzb.sh` at the root vs `scripts/install-release.sh`), also attach it to each release?
68+ 3. A: default prefix `/usr/local` (sudo, like today) or `~/.local` (no sudo, needs PATH)?
69+ 4. B: does the team already have a Developer ID Installer certificate?
70+ 5. C: tap in its own repository or in this one?
71+tasks:
72+ - id: 1
73+ title: "Decide which installers (A script, B pkg, C Homebrew) and the milestone"
74+ state: closed
75+ closedAt: 2026-11-27T14:00:00.000Z
76+ priority: high
77+ author:
78+ name: k33g
79+ email: ph.charriere@gmail.com
80+ createdAt: 2026-11-27T13:00:00.000Z
81+ - id: 2
82+ title: "Implement the chosen installer(s), with tests against a local fake release"
83+ state: closed
84+ closedAt: 2026-11-27T14:00:00.000Z
85+ priority: medium
86+ author:
87+ name: k33g
88+ email: ph.charriere@gmail.com
89+ createdAt: 2026-11-27T13:00:00.000Z
90+ - id: 3
91+ title: "Wire them into the release chain (local-ci-01 checks, 02/04 assets, release skill)"
92+ state: closed
93+ closedAt: 2026-11-27T14:00:00.000Z
94+ priority: medium
95+ author:
96+ name: k33g
97+ email: ph.charriere@gmail.com
98+ createdAt: 2026-11-27T13:00:00.000Z
99+ - id: 4
100+ title: "INSTALL.MACOS.md / .fr.md and docs EN + FR"
101+ state: closed
102+ closedAt: 2026-11-27T14:00:00.000Z
103+ priority: medium
104+ author:
105+ name: k33g
106+ email: ph.charriere@gmail.com
107+ createdAt: 2026-11-27T13:00:00.000Z
108+ - id: 5
109+ title: "Run it on the Mac against the real release (signature check included)"
110+ state: open
111+ priority: high
112+ author:
113+ name: k33g
114+ email: ph.charriere@gmail.com
115+ createdAt: 2026-11-27T14:00:00.000Z
116+comments:
117+ - id: 1
118+ author:
119+ name: k33g
120+ email: ph.charriere@gmail.com
121+ createdAt: 2026-11-27T14:00:00.000Z
122+ body: |
123+ User: "ok pour la A". Defaults taken (decisions 2–3): `install-rzb.sh` at the root, served by `raw/main`, not attached to the releases (it reads `/releases/latest`, so one script serves every version); default prefix `/usr/local` like INSTALL.MACOS.md and scripts/install.sh (`--prefix ~/.local` for no sudo). B and C not started.
124+ Done: install-rzb.sh (`--version`, `--prefix`, `--uninstall`, `--dry-run`, `--no-verify`; checksum, codesign + TeamIdentifier SNLLBZP9V9 + identifier com.bots-garden.rzb, unpacked `rzb --version`, whole-folder replace, shared launcher marker, sudo only when needed, help as a heredoc so it works piped, everything in main()). Tests: Tests/Installer/test-install-rzb.sh, 26/26 on Linux (fake releases on 127.0.0.1 with the 302). Against the real Rickub release from Linux (`--dry-run --no-verify`): latest = 1.0.0, download + checksum OK, stops at "does not start" (Mach-O on Linux), as expected. Wired into local-ci-01 (with shellcheck when installed). Docs: INSTALL.MACOS.md / .fr.md (script first, "By hand" kept), README, run-the-tests EN+FR, release skill.
125+ Side fix: the 1.0.0 archive carries pax xattr headers (com.apple.provenance; GNU tar warns about them): scripts/release.sh now packs with `--no-xattrs` (02 re-verifies the signatures on the unpacked archive, so a signature that needed them would fail there).
126+ Trap hit: a shell function named `install` shadowed /usr/bin/install and made the script call itself forever; renamed install_rzb / remove_rzb.
127+ Left (task 5): run on the Mac against v1.0.0 with the signature check — only possible once install-rzb.sh is pushed to main.
new file mode 100644
@@ -0,0 +1,127 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 65
3+title: "Installer for the published release (rzb on a Mac without the sources)"
4+state: open
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-27T13:00:00.000Z
9+updatedAt: 2026-11-27T14:00:00.000Z
10+labels:
11+ - "kind::feature"
12+ - "area::build"
13+ - "mac-only"
14+ - "priority::medium"
15+milestone: "v1.1.0"
16+epic: "Distribution"
17+related:
18+ - 50
19+ - 52
20+body: |
21+ Asked by the user (2026-11-27, after 1.0.0 was published): an installer.
22+
23+ ## Today
24+ Installing the published release is the 9 commands of INSTALL.MACOS.md: download the tar.gz, unpack, `sudo mv` the folder to `/usr/local/lib/razorbill`, write the launcher `/usr/local/bin/rzb` by hand with `printf | sudo tee`, chmod. Checking the checksum and the signature is 5 more optional commands. Upgrading = doing it all again with a new VERSION. `scripts/install.sh` only installs from the sources (it builds with Xcode).
25+
26+ Constraints any installer must respect:
27+ - rzb is a folder (rzb + 6 resource bundles, `mlx-swift_Cmlx.bundle` holds the Metal library), never a lone binary: folder in `<prefix>/lib/razorbill`, launcher `<prefix>/bin/rzb` with the marker `# razorbill launcher (scripts/install.sh)` so that `scripts/install.sh --uninstall` and every installer recognise each other's install and never overwrite an `rzb` they did not write.
28+ - macOS 14+, Apple Silicon only: refuse anything else with a clear message.
29+ - Never touch the models (`~/.cache/huggingface`) or the settings (`~/.config/razorbill`).
30+ - Replace the whole folder on upgrade (no stale bundle).
31+
32+ Checked from the sandbox (2026-11-27), all without a token: `https://rickub.com/bots-garden/razorbill/raw/main/<file>` serves repository files (200); `/releases/latest` answers 302 to `/releases/v1.0.0` (the latest tag); `/releases/latest/download/SHA256SUMS` works (200). The API (`/api/v1/repos/.../releases`) needs a token (401): an installer must not use it.
33+
34+ ## Proposals
35+
36+ ### A. An install script, `curl … | bash` (recommended first)
37+ `install-rzb.sh` at the root of the repository, served by `raw/main`:
38+ ```
39+ curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
40+ curl -fsSL …/install-rzb.sh | bash -s -- --version 1.0.0 --prefix ~/.local
41+ ```
42+ - Finds the latest tag from the `/releases/latest` redirect (or `--version`), downloads the archive and `SHA256SUMS` into a temp folder, checks the checksum, unpacks, checks `codesign --verify --strict` and that the TeamIdentifier is ours (refuses otherwise; `--no-verify` to skip, e.g. for an unsigned pre-1.0 archive), runs the unpacked `rzb --version`, then installs folder + launcher (sudo only when the prefix is not writable, like scripts/install.sh). `--uninstall`, `--prefix`, `--version`, `--dry-run`.
43+ - Pros: one command for install and upgrade; no new certificate, no new infrastructure; reuses the existing archive and chain; works with curl (no quarantine).
44+ - Cons: `curl | bash` asks the user to trust the script (mitigation: document "download, read, run"); the script itself is not signed; it is served from `main`, so a broken commit on main breaks installs (mitigation: shellcheck + a test that runs it against a local fake release, and it is part of local-ci-01).
45+ - Cost: small (~1 day with tests and EN/FR docs). Could also be attached to each release as an asset.
46+
47+ ### B. A signed and notarized `.pkg`
48+ `razorbill-<version>-macos-arm64.pkg` built by `local-ci-02` with `pkgbuild` + `productbuild`, installing `/usr/local/lib/razorbill` and the launcher, signed with a **Developer ID Installer** certificate, notarized and **stapled** (a pkg can be stapled: works offline, no online check at first run).
49+ - Pros: double-click, the most "Mac" experience; Gatekeeper checks it fully (`spctl --assess --type install`); MDM-friendly.
50+ - Cons: needs a second certificate (Developer ID **Installer**, not Application — to check whether the team already has one); no native uninstall (ship `rzb-uninstall` or document it); a pkg always asks for an admin password and always installs to /usr/local (no per-user prefix); one more asset and one more notarization (+ a few minutes) per release; postinstall scripts to write the launcher, or the launcher shipped as a file in the payload.
51+ - Cost: medium (~2 days: build + sign + notarize + staple in 02, upload in 04, checks, docs).
52+
53+ ### C. A Homebrew tap
54+ A repository `bots-garden/homebrew-tap` (or a `Formula/` folder in this repo) with a cask or a formula `razorbill` pointing at the release archive and its sha256: `brew tap bots-garden/tap https://git.rickub.com/bots-garden/homebrew-tap.git && brew install razorbill`, then `brew upgrade razorbill`.
55+ - Pros: upgrades and uninstall for free; users who already use brew expect it; Homebrew installs the folder in its Cellar and links `bin/rzb` (wrapper), no sudo.
56+ - Cons: the tap must be updated at every release (a step `local-ci-07` that rewrites version + sha256 and pushes the tap); tapping a non-GitHub repo needs the full git URL; Homebrew's own audit rules for casks/formulae to follow; does not replace A or B for users without brew; a brew install and a /usr/local install can coexist and shadow each other on PATH (check and warn).
57+ - Cost: small to medium (~1 day + the release step), and a second repository to maintain.
58+
59+ ### D. Later: `rzb self-update`
60+ A command in rzb that checks `/releases/latest` and replaces its own folder (the logic of A, in Swift). Only worth it after A, and it needs care: replacing the running executable's folder, sudo for /usr/local. Not proposed for now.
61+
62+ ## Suggested order
63+ A now (1.1.0), since it removes almost all of the friction at low cost; then C if users ask for brew; B only if offline first run or MDM matters (or if the Installer certificate already exists).
64+
65+ ## Decisions for the user
66+ 1. Which proposals (A, B, C), and in which order / milestone?
67+ 2. A: script name (`install-rzb.sh` at the root vs `scripts/install-release.sh`), also attach it to each release?
68+ 3. A: default prefix `/usr/local` (sudo, like today) or `~/.local` (no sudo, needs PATH)?
69+ 4. B: does the team already have a Developer ID Installer certificate?
70+ 5. C: tap in its own repository or in this one?
71+tasks:
72+ - id: 1
73+ title: "Decide which installers (A script, B pkg, C Homebrew) and the milestone"
74+ state: closed
75+ closedAt: 2026-11-27T14:00:00.000Z
76+ priority: high
77+ author:
78+ name: k33g
79+ email: ph.charriere@gmail.com
80+ createdAt: 2026-11-27T13:00:00.000Z
81+ - id: 2
82+ title: "Implement the chosen installer(s), with tests against a local fake release"
83+ state: closed
84+ closedAt: 2026-11-27T14:00:00.000Z
85+ priority: medium
86+ author:
87+ name: k33g
88+ email: ph.charriere@gmail.com
89+ createdAt: 2026-11-27T13:00:00.000Z
90+ - id: 3
91+ title: "Wire them into the release chain (local-ci-01 checks, 02/04 assets, release skill)"
92+ state: closed
93+ closedAt: 2026-11-27T14:00:00.000Z
94+ priority: medium
95+ author:
96+ name: k33g
97+ email: ph.charriere@gmail.com
98+ createdAt: 2026-11-27T13:00:00.000Z
99+ - id: 4
100+ title: "INSTALL.MACOS.md / .fr.md and docs EN + FR"
101+ state: closed
102+ closedAt: 2026-11-27T14:00:00.000Z
103+ priority: medium
104+ author:
105+ name: k33g
106+ email: ph.charriere@gmail.com
107+ createdAt: 2026-11-27T13:00:00.000Z
108+ - id: 5
109+ title: "Run it on the Mac against the real release (signature check included)"
110+ state: open
111+ priority: high
112+ author:
113+ name: k33g
114+ email: ph.charriere@gmail.com
115+ createdAt: 2026-11-27T14:00:00.000Z
116+comments:
117+ - id: 1
118+ author:
119+ name: k33g
120+ email: ph.charriere@gmail.com
121+ createdAt: 2026-11-27T14:00:00.000Z
122+ body: |
123+ User: "ok pour la A". Defaults taken (decisions 2–3): `install-rzb.sh` at the root, served by `raw/main`, not attached to the releases (it reads `/releases/latest`, so one script serves every version); default prefix `/usr/local` like INSTALL.MACOS.md and scripts/install.sh (`--prefix ~/.local` for no sudo). B and C not started.
124+ Done: install-rzb.sh (`--version`, `--prefix`, `--uninstall`, `--dry-run`, `--no-verify`; checksum, codesign + TeamIdentifier SNLLBZP9V9 + identifier com.bots-garden.rzb, unpacked `rzb --version`, whole-folder replace, shared launcher marker, sudo only when needed, help as a heredoc so it works piped, everything in main()). Tests: Tests/Installer/test-install-rzb.sh, 26/26 on Linux (fake releases on 127.0.0.1 with the 302). Against the real Rickub release from Linux (`--dry-run --no-verify`): latest = 1.0.0, download + checksum OK, stops at "does not start" (Mach-O on Linux), as expected. Wired into local-ci-01 (with shellcheck when installed). Docs: INSTALL.MACOS.md / .fr.md (script first, "By hand" kept), README, run-the-tests EN+FR, release skill.
125+ Side fix: the 1.0.0 archive carries pax xattr headers (com.apple.provenance; GNU tar warns about them): scripts/release.sh now packs with `--no-xattrs` (02 re-verifies the signatures on the unpacked archive, so a signature that needed them would fail there).
126+ Trap hit: a shell function named `install` shadowed /usr/bin/install and made the script call itself forever; renamed install_rzb / remove_rzb.
127+ Left (task 5): run on the Mac against v1.0.0 with the signature check — only possible once install-rzb.sh is pushed to main.
modified .tickets/milestones.yaml +3 -0
@@ -14,3 +14,6 @@ milestones:
1414 - title: "v1.0.0"
1515 state: open
1616 description: "First stable release: signed and notarized rzb (#52)."
17+ - title: "v1.1.0"
18+ state: open
19+ description: "Install from the published release with one command: install-rzb.sh (#65)."
@@ -14,3 +14,6 @@ milestones:
14 - title: "v1.0.0"14 - title: "v1.0.0"
15 state: open15 state: open
16 description: "First stable release: signed and notarized rzb (#52)."16 description: "First stable release: signed and notarized rzb (#52)."
17+ - title: "v1.1.0"
18+ state: open
19+ description: "Install from the published release with one command: install-rzb.sh (#65)."
modified INSTALL.MACOS.fr.md +25 -5
@@ -4,7 +4,27 @@
44
55 razorbill fonctionne uniquement sur **macOS 14 ou plus récent, sur Apple Silicon** (M1 ou plus récent) : il fait tourner ses modèles sur le GPU avec MLX.
66
7-Version courte :
7+## Avec le script d'installation
8+
9+```bash
10+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
11+rzb version
12+```
13+
14+Le script installe la dernière release : il télécharge l'archive et son `SHA256SUMS`, vérifie l'empreinte, vérifie que `rzb` et ses bundles sont signés par le Developer ID de bots-garden (Team ID `SNLLBZP9V9`), lance le `rzb --version` téléchargé, puis place le dossier dans `/usr/local/lib/razorbill` et le lanceur dans `/usr/local/bin/rzb`. Il ne demande votre mot de passe (sudo) que si `/usr/local` n'est pas accessible en écriture. Relancez-le pour mettre à jour.
15+
16+Les options se placent après `bash -s --` :
17+
18+```bash
19+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --version 1.0.0
20+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --prefix ~/.local # sans sudo
21+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --dry-run # vérifier seulement
22+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --uninstall
23+```
24+
25+`--no-verify` saute la vérification de la signature (pour les archives d'avant la 1.0.0, qui ne sont pas signées). Pour lire le script avant de le lancer : `curl -fsSLO https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh`, lisez `install-rzb.sh`, puis `bash install-rzb.sh`.
26+
27+## À la main
828
929 ```bash
1030 VERSION=1.0.0
@@ -22,7 +42,7 @@ rzb version
2242
2343 L'archive contient un dossier, pas un binaire seul : `rzb` et les bundles de ressources qu'il charge à l'exécution depuis son propre dossier (`mlx-swift_Cmlx.bundle` est la bibliothèque Metal de MLX ; sans lui, aucun modèle ne se charge). Le dossier va donc entier dans `/usr/local/lib/razorbill`, et `/usr/local/bin/rzb` est un script de deux lignes qui lance `rzb` depuis là. Copier `rzb` seul dans `/usr/local/bin` ne fonctionne pas.
2444
25-Le lanceur est le même que celui qu'écrit `scripts/install.sh` depuis les sources, avec la même ligne repère : `scripts/install.sh --uninstall` retire l'une ou l'autre installation.
45+Le lanceur est le même que celui qu'écrivent `install-rzb.sh` et `scripts/install.sh` (depuis les sources), avec la même ligne repère : chacun reconnaît et remplace l'installation des autres, et aucun n'écrase un `rzb` qu'il n'a pas écrit.
2646
2747 ## Vérifier le téléchargement d'abord
2848
@@ -48,7 +68,7 @@ for bundle in *.bundle; do codesign --verify --strict "$bundle" && echo "$bundle
4868 cd ..
4969 ```
5070
51-Installez ensuite le dossier comme dans la version courte (à partir de `sudo mkdir`).
71+Installez ensuite le dossier comme dans [À la main](#à-la-main) (à partir de `sudo mkdir`).
5272
5373 La vérification de la signature doit afficher :
5474
@@ -78,8 +98,8 @@ chmod 755 ~/.local/bin/rzb
7898
7999 ## Mettre à jour et désinstaller
80100
81-- **Mettre à jour** : relancez la version courte avec la nouvelle `VERSION`. Elle remplace le dossier entier : aucun bundle de l'ancienne version ne reste. Vos modèles (`~/.cache/huggingface`) et réglages (`~/.config/razorbill`) ne sont pas touchés.
82-- **Désinstaller** : `sudo rm -rf /usr/local/lib/razorbill /usr/local/bin/rzb`. Les modèles restent dans le cache Hugging Face : retirez-les d'abord avec `rzb models rm <modèle>` pour récupérer la place.
101+- **Mettre à jour** : relancez le script d'installation (ou les commandes de [À la main](#à-la-main) avec la nouvelle `VERSION`). Elle remplace le dossier entier : aucun bundle de l'ancienne version ne reste. Vos modèles (`~/.cache/huggingface`) et réglages (`~/.config/razorbill`) ne sont pas touchés.
102+- **Désinstaller** : `install-rzb.sh --uninstall` (voir plus haut), ou `sudo rm -rf /usr/local/lib/razorbill /usr/local/bin/rzb`. Les modèles restent dans le cache Hugging Face : retirez-les d'abord avec `rzb models rm <modèle>` pour récupérer la place.
83103
84104 ## Ensuite
85105
@@ -4,7 +4,27 @@
4 4
5 razorbill fonctionne uniquement sur **macOS 14 ou plus récent, sur Apple Silicon** (M1 ou plus récent) : il fait tourner ses modèles sur le GPU avec MLX.5 razorbill fonctionne uniquement sur **macOS 14 ou plus récent, sur Apple Silicon** (M1 ou plus récent) : il fait tourner ses modèles sur le GPU avec MLX.
6 6
7-Version courte :7+## Avec le script d'installation
8+
9+```bash
10+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
11+rzb version
12+```
13+
14+Le script installe la dernière release : il télécharge l'archive et son `SHA256SUMS`, vérifie l'empreinte, vérifie que `rzb` et ses bundles sont signés par le Developer ID de bots-garden (Team ID `SNLLBZP9V9`), lance le `rzb --version` téléchargé, puis place le dossier dans `/usr/local/lib/razorbill` et le lanceur dans `/usr/local/bin/rzb`. Il ne demande votre mot de passe (sudo) que si `/usr/local` n'est pas accessible en écriture. Relancez-le pour mettre à jour.
15+
16+Les options se placent après `bash -s --` :
17+
18+```bash
19+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --version 1.0.0
20+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --prefix ~/.local # sans sudo
21+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --dry-run # vérifier seulement
22+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --uninstall
23+```
24+
25+`--no-verify` saute la vérification de la signature (pour les archives d'avant la 1.0.0, qui ne sont pas signées). Pour lire le script avant de le lancer : `curl -fsSLO https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh`, lisez `install-rzb.sh`, puis `bash install-rzb.sh`.
26+
27+## À la main
8 28
9 ```bash29 ```bash
10 VERSION=1.0.030 VERSION=1.0.0
@@ -22,7 +42,7 @@ rzb version
22 42
23 L'archive contient un dossier, pas un binaire seul : `rzb` et les bundles de ressources qu'il charge à l'exécution depuis son propre dossier (`mlx-swift_Cmlx.bundle` est la bibliothèque Metal de MLX ; sans lui, aucun modèle ne se charge). Le dossier va donc entier dans `/usr/local/lib/razorbill`, et `/usr/local/bin/rzb` est un script de deux lignes qui lance `rzb` depuis là. Copier `rzb` seul dans `/usr/local/bin` ne fonctionne pas.43 L'archive contient un dossier, pas un binaire seul : `rzb` et les bundles de ressources qu'il charge à l'exécution depuis son propre dossier (`mlx-swift_Cmlx.bundle` est la bibliothèque Metal de MLX ; sans lui, aucun modèle ne se charge). Le dossier va donc entier dans `/usr/local/lib/razorbill`, et `/usr/local/bin/rzb` est un script de deux lignes qui lance `rzb` depuis là. Copier `rzb` seul dans `/usr/local/bin` ne fonctionne pas.
24 44
25-Le lanceur est le même que celui qu'écrit `scripts/install.sh` depuis les sources, avec la même ligne repère : `scripts/install.sh --uninstall` retire l'une ou l'autre installation.45+Le lanceur est le même que celui qu'écrivent `install-rzb.sh` et `scripts/install.sh` (depuis les sources), avec la même ligne repère : chacun reconnaît et remplace l'installation des autres, et aucun n'écrase un `rzb` qu'il n'a pas écrit.
26 46
27 ## Vérifier le téléchargement d'abord47 ## Vérifier le téléchargement d'abord
28 48
@@ -48,7 +68,7 @@ for bundle in *.bundle; do codesign --verify --strict "$bundle" && echo "$bundle
48 cd ..68 cd ..
49 ```69 ```
50 70
51-Installez ensuite le dossier comme dans la version courte (à partir de `sudo mkdir`).71+Installez ensuite le dossier comme dans [À la main](#à-la-main) (à partir de `sudo mkdir`).
52 72
53 La vérification de la signature doit afficher :73 La vérification de la signature doit afficher :
54 74
@@ -78,8 +98,8 @@ chmod 755 ~/.local/bin/rzb
78 98
79 ## Mettre à jour et désinstaller99 ## Mettre à jour et désinstaller
80 100
81-- **Mettre à jour** : relancez la version courte avec la nouvelle `VERSION`. Elle remplace le dossier entier : aucun bundle de l'ancienne version ne reste. Vos modèles (`~/.cache/huggingface`) et réglages (`~/.config/razorbill`) ne sont pas touchés.101+- **Mettre à jour** : relancez le script d'installation (ou les commandes de [À la main](#à-la-main) avec la nouvelle `VERSION`). Elle remplace le dossier entier : aucun bundle de l'ancienne version ne reste. Vos modèles (`~/.cache/huggingface`) et réglages (`~/.config/razorbill`) ne sont pas touchés.
82-- **Désinstaller** : `sudo rm -rf /usr/local/lib/razorbill /usr/local/bin/rzb`. Les modèles restent dans le cache Hugging Face : retirez-les d'abord avec `rzb models rm <modèle>` pour récupérer la place.102+- **Désinstaller** : `install-rzb.sh --uninstall` (voir plus haut), ou `sudo rm -rf /usr/local/lib/razorbill /usr/local/bin/rzb`. Les modèles restent dans le cache Hugging Face : retirez-les d'abord avec `rzb models rm <modèle>` pour récupérer la place.
83 103
84 ## Ensuite104 ## Ensuite
85 105
modified INSTALL.MACOS.md +25 -5
@@ -4,7 +4,27 @@
44
55 razorbill runs on **macOS 14 or later, on Apple Silicon** (M1 or newer) only: it runs its models on the GPU with MLX.
66
7-Short version:
7+## With the install script
8+
9+```bash
10+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
11+rzb version
12+```
13+
14+The script installs the latest release: it downloads the archive and its `SHA256SUMS`, checks the checksum, checks that `rzb` and its bundles are signed by the bots-garden Developer ID (Team ID `SNLLBZP9V9`), runs the downloaded `rzb --version`, then puts the folder in `/usr/local/lib/razorbill` and the launcher in `/usr/local/bin/rzb`. It asks for your password (sudo) only when `/usr/local` is not writable. Run it again to upgrade.
15+
16+Options go after `bash -s --`:
17+
18+```bash
19+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --version 1.0.0
20+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --prefix ~/.local # no sudo
21+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --dry-run # check only
22+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --uninstall
23+```
24+
25+`--no-verify` skips the signature check (for the archives before 1.0.0, which are not signed). To read the script before running it: `curl -fsSLO https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh`, read `install-rzb.sh`, then `bash install-rzb.sh`.
26+
27+## By hand
828
929 ```bash
1030 VERSION=1.0.0
@@ -22,7 +42,7 @@ rzb version
2242
2343 The archive holds a folder, not a lone binary: `rzb` and the resource bundles it loads at run time from its own folder (`mlx-swift_Cmlx.bundle` is the MLX Metal library; without it no model loads). So the folder goes to `/usr/local/lib/razorbill` as a whole, and `/usr/local/bin/rzb` is a two-line script that runs `rzb` from there. Copying `rzb` alone into `/usr/local/bin` does not work.
2444
25-The launcher is the same as the one `scripts/install.sh` writes from the sources, with the same marker line: `scripts/install.sh --uninstall` removes either install.
45+The launcher is the same as the one `install-rzb.sh` and `scripts/install.sh` (from the sources) write, with the same marker line: each of them recognises and replaces the others' install, and none overwrites an `rzb` it did not write.
2646
2747 ## Checking the download first
2848
@@ -48,7 +68,7 @@ for bundle in *.bundle; do codesign --verify --strict "$bundle" && echo "$bundle
4868 cd ..
4969 ```
5070
51-Then install the folder as in the short version (from `sudo mkdir` on).
71+Then install the folder as in [By hand](#by-hand) (from `sudo mkdir` on).
5272
5373 The signature check should print:
5474
@@ -78,8 +98,8 @@ chmod 755 ~/.local/bin/rzb
7898
7999 ## Upgrading and uninstalling
80100
81-- **Upgrade**: run the short version again with the new `VERSION`. It replaces the whole folder, so no bundle of the old version stays behind. Your models (`~/.cache/huggingface`) and settings (`~/.config/razorbill`) are not touched.
82-- **Uninstall**: `sudo rm -rf /usr/local/lib/razorbill /usr/local/bin/rzb`. The models stay in the Hugging Face cache: remove them first with `rzb models rm <model>` if you want the disk space back.
101+- **Upgrade**: run the install script again (or the commands of [By hand](#by-hand) with the new `VERSION`). It replaces the whole folder, so no bundle of the old version stays behind. Your models (`~/.cache/huggingface`) and settings (`~/.config/razorbill`) are not touched.
102+- **Uninstall**: `install-rzb.sh --uninstall` (see above), or `sudo rm -rf /usr/local/lib/razorbill /usr/local/bin/rzb`. The models stay in the Hugging Face cache: remove them first with `rzb models rm <model>` if you want the disk space back.
83103
84104 ## Next
85105
@@ -4,7 +4,27 @@
4 4
5 razorbill runs on **macOS 14 or later, on Apple Silicon** (M1 or newer) only: it runs its models on the GPU with MLX.5 razorbill runs on **macOS 14 or later, on Apple Silicon** (M1 or newer) only: it runs its models on the GPU with MLX.
6 6
7-Short version:7+## With the install script
8+
9+```bash
10+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
11+rzb version
12+```
13+
14+The script installs the latest release: it downloads the archive and its `SHA256SUMS`, checks the checksum, checks that `rzb` and its bundles are signed by the bots-garden Developer ID (Team ID `SNLLBZP9V9`), runs the downloaded `rzb --version`, then puts the folder in `/usr/local/lib/razorbill` and the launcher in `/usr/local/bin/rzb`. It asks for your password (sudo) only when `/usr/local` is not writable. Run it again to upgrade.
15+
16+Options go after `bash -s --`:
17+
18+```bash
19+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --version 1.0.0
20+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --prefix ~/.local # no sudo
21+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --dry-run # check only
22+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash -s -- --uninstall
23+```
24+
25+`--no-verify` skips the signature check (for the archives before 1.0.0, which are not signed). To read the script before running it: `curl -fsSLO https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh`, read `install-rzb.sh`, then `bash install-rzb.sh`.
26+
27+## By hand
8 28
9 ```bash29 ```bash
10 VERSION=1.0.030 VERSION=1.0.0
@@ -22,7 +42,7 @@ rzb version
22 42
23 The archive holds a folder, not a lone binary: `rzb` and the resource bundles it loads at run time from its own folder (`mlx-swift_Cmlx.bundle` is the MLX Metal library; without it no model loads). So the folder goes to `/usr/local/lib/razorbill` as a whole, and `/usr/local/bin/rzb` is a two-line script that runs `rzb` from there. Copying `rzb` alone into `/usr/local/bin` does not work.43 The archive holds a folder, not a lone binary: `rzb` and the resource bundles it loads at run time from its own folder (`mlx-swift_Cmlx.bundle` is the MLX Metal library; without it no model loads). So the folder goes to `/usr/local/lib/razorbill` as a whole, and `/usr/local/bin/rzb` is a two-line script that runs `rzb` from there. Copying `rzb` alone into `/usr/local/bin` does not work.
24 44
25-The launcher is the same as the one `scripts/install.sh` writes from the sources, with the same marker line: `scripts/install.sh --uninstall` removes either install.45+The launcher is the same as the one `install-rzb.sh` and `scripts/install.sh` (from the sources) write, with the same marker line: each of them recognises and replaces the others' install, and none overwrites an `rzb` it did not write.
26 46
27 ## Checking the download first47 ## Checking the download first
28 48
@@ -48,7 +68,7 @@ for bundle in *.bundle; do codesign --verify --strict "$bundle" && echo "$bundle
48 cd ..68 cd ..
49 ```69 ```
50 70
51-Then install the folder as in the short version (from `sudo mkdir` on).71+Then install the folder as in [By hand](#by-hand) (from `sudo mkdir` on).
52 72
53 The signature check should print:73 The signature check should print:
54 74
@@ -78,8 +98,8 @@ chmod 755 ~/.local/bin/rzb
78 98
79 ## Upgrading and uninstalling99 ## Upgrading and uninstalling
80 100
81-- **Upgrade**: run the short version again with the new `VERSION`. It replaces the whole folder, so no bundle of the old version stays behind. Your models (`~/.cache/huggingface`) and settings (`~/.config/razorbill`) are not touched.101+- **Upgrade**: run the install script again (or the commands of [By hand](#by-hand) with the new `VERSION`). It replaces the whole folder, so no bundle of the old version stays behind. Your models (`~/.cache/huggingface`) and settings (`~/.config/razorbill`) are not touched.
82-- **Uninstall**: `sudo rm -rf /usr/local/lib/razorbill /usr/local/bin/rzb`. The models stay in the Hugging Face cache: remove them first with `rzb models rm <model>` if you want the disk space back.102+- **Uninstall**: `install-rzb.sh --uninstall` (see above), or `sudo rm -rf /usr/local/lib/razorbill /usr/local/bin/rzb`. The models stay in the Hugging Face cache: remove them first with `rzb models rm <model>` if you want the disk space back.
83 103
84 ## Next104 ## Next
85 105
modified README.md +6 -1
@@ -8,7 +8,11 @@ razorbill is a model server for the Mac. Its command is **`rzb`**. It runs langu
88
99 ## Install
1010
11-Download the archive of the [latest release](https://rickub.com/bots-garden/razorbill/releases/latest) and follow [INSTALL.MACOS.md](INSTALL.MACOS.md) ([en français](INSTALL.MACOS.fr.md)). From the sources: `scripts/install.sh` ([Build on the Mac](#build-on-the-mac)).
11+```bash
12+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
13+```
14+
15+It installs the [latest release](https://rickub.com/bots-garden/razorbill/releases/latest) after checking its checksum and signature. Options, and installing by hand: [INSTALL.MACOS.md](INSTALL.MACOS.md) ([en français](INSTALL.MACOS.fr.md)). From the sources: `scripts/install.sh` ([Build on the Mac](#build-on-the-mac)).
1216
1317 ## Quick start
1418
@@ -137,6 +141,7 @@ Step by step: [Develop from a Linux sandbox](docs/en/how-to/develop-from-a-sandb
137141 | `experiments/01-query-model` | Development experiment, standalone package: sends one prompt to one MLX model with mlx-swift-lm, no server; first check of MLX on the Mac (#1). |
138142 | `experiments/02-kv-cache-reuse` | Development experiment, standalone package: measures KV-cache reuse between stateless requests (#47), which led to the server's prompt cache (#48). |
139143 | `tools/host-runner` | Build, test and run on the Mac from the sandbox. |
144+| `install-rzb.sh` | Installs or upgrades rzb from the published release (`curl … \| bash`); tests in `Tests/Installer`. |
140145 | `local-ci-*.sh` | The release chain: checks, build + signature + notarization, draft, upload, publication on Rickub. |
141146 | `scripts/` | `test.sh`, `compat.sh`, `install.sh`, `release.sh`, `check-hardened-runtime.sh`. |
142147 | `.tickets/` | Issues, epics and milestones (IssueSpec YAML format). |
@@ -8,7 +8,11 @@ razorbill is a model server for the Mac. Its command is **`rzb`**. It runs langu
8 8
9 ## Install9 ## Install
10 10
11-Download the archive of the [latest release](https://rickub.com/bots-garden/razorbill/releases/latest) and follow [INSTALL.MACOS.md](INSTALL.MACOS.md) ([en français](INSTALL.MACOS.fr.md)). From the sources: `scripts/install.sh` ([Build on the Mac](#build-on-the-mac)).11+```bash
12+curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
13+```
14+
15+It installs the [latest release](https://rickub.com/bots-garden/razorbill/releases/latest) after checking its checksum and signature. Options, and installing by hand: [INSTALL.MACOS.md](INSTALL.MACOS.md) ([en français](INSTALL.MACOS.fr.md)). From the sources: `scripts/install.sh` ([Build on the Mac](#build-on-the-mac)).
12 16
13 ## Quick start17 ## Quick start
14 18
@@ -137,6 +141,7 @@ Step by step: [Develop from a Linux sandbox](docs/en/how-to/develop-from-a-sandb
137 | `experiments/01-query-model` | Development experiment, standalone package: sends one prompt to one MLX model with mlx-swift-lm, no server; first check of MLX on the Mac (#1). |141 | `experiments/01-query-model` | Development experiment, standalone package: sends one prompt to one MLX model with mlx-swift-lm, no server; first check of MLX on the Mac (#1). |
138 | `experiments/02-kv-cache-reuse` | Development experiment, standalone package: measures KV-cache reuse between stateless requests (#47), which led to the server's prompt cache (#48). |142 | `experiments/02-kv-cache-reuse` | Development experiment, standalone package: measures KV-cache reuse between stateless requests (#47), which led to the server's prompt cache (#48). |
139 | `tools/host-runner` | Build, test and run on the Mac from the sandbox. |143 | `tools/host-runner` | Build, test and run on the Mac from the sandbox. |
144+| `install-rzb.sh` | Installs or upgrades rzb from the published release (`curl … \| bash`); tests in `Tests/Installer`. |
140 | `local-ci-*.sh` | The release chain: checks, build + signature + notarization, draft, upload, publication on Rickub. |145 | `local-ci-*.sh` | The release chain: checks, build + signature + notarization, draft, upload, publication on Rickub. |
141 | `scripts/` | `test.sh`, `compat.sh`, `install.sh`, `release.sh`, `check-hardened-runtime.sh`. |146 | `scripts/` | `test.sh`, `compat.sh`, `install.sh`, `release.sh`, `check-hardened-runtime.sh`. |
142 | `.tickets/` | Issues, epics and milestones (IssueSpec YAML format). |147 | `.tickets/` | Issues, epics and milestones (IssueSpec YAML format). |
added Tests/Installer/test-install-rzb.sh +160 -0
new file mode 100755
@@ -0,0 +1,160 @@
1+#!/usr/bin/env bash
2+# Tests of install-rzb.sh (ticket #65) against fake releases served on 127.0.0.1.
3+#
4+# Tests/Installer/test-install-rzb.sh
5+#
6+# Needs bash, curl, tar, python3; runs on Linux and on the Mac. The fake rzb is a shell script
7+# and is not signed, so every install passes --no-verify except the test that checks the
8+# signature is refused. RZB_INSTALL_ANY_PLATFORM=1 lifts the macOS/arm64 check, except in the
9+# platform test. Writes only into a temporary folder.
10+set -euo pipefail
11+cd "$(dirname "$0")/../.."
12+installer="$PWD/install-rzb.sh"
13+
14+work="$(mktemp -d)"
15+server_pid=""
16+cleanup() {
17+ if [[ -n "${server_pid}" ]]; then kill "${server_pid}" 2>/dev/null || true; fi
18+ rm -rf "${work}"
19+}
20+trap cleanup EXIT
21+
22+passed=0
23+failed=0
24+ok() { passed=$((passed + 1)); printf ' ✅ %s\n' "$1"; }
25+ko() { failed=$((failed + 1)); printf ' ❌ %s\n' "$1"; }
26+check() { # check "description" command…
27+ local what=$1
28+ shift
29+ if "$@" >"${work}/out" 2>&1; then ok "${what}"; else ko "${what}"; sed 's/^/ /' "${work}/out"; fi
30+}
31+refuses() { # refuses "description" "expected message" command…
32+ local what=$1 message=$2
33+ shift 2
34+ if "$@" >"${work}/out" 2>&1; then
35+ ko "${what} (it succeeded)"
36+ elif grep -qF -- "${message}" "${work}/out"; then
37+ ok "${what}"
38+ else
39+ ko "${what} (message: $(tr '\n' ' ' <"${work}/out"))"
40+ fi
41+}
42+
43+checksum() { if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$@"; else sha256sum "$@"; fi; }
44+
45+# publish VERSION [corrupt]: a release the way local-ci-02 lays it out, with a marker file named
46+# after the version (to see that an upgrade replaces the whole folder).
47+site="${work}/site"
48+publish() {
49+ local version=$1 corrupt=${2:-}
50+ local name="razorbill-${version}-macos-arm64"
51+ local stage="${work}/stage/${name}"
52+ mkdir -p "${stage}/mlx-swift_Cmlx.bundle/Contents" "${stage}/swift-nio_NIOPosix.bundle/Contents"
53+ printf '#!/bin/sh\necho %s\n' "${version}" >"${stage}/rzb"
54+ chmod 755 "${stage}/rzb"
55+ printf 'plist\n' >"${stage}/mlx-swift_Cmlx.bundle/Contents/Info.plist"
56+ touch "${stage}/only-in-${version}"
57+ local dir="${site}/releases/download/v${version}"
58+ mkdir -p "${dir}"
59+ tar -C "${work}/stage" -czf "${dir}/${name}.tar.gz" "${name}"
60+ (cd "${dir}" && checksum "${name}.tar.gz" >SHA256SUMS)
61+ if [[ -n "${corrupt}" ]]; then
62+ printf '%064d %s.tar.gz\n' 0 "${name}" >"${dir}/SHA256SUMS"
63+ fi
64+}
65+publish 1.0.0
66+publish 1.1.0
67+publish 9.9.9 corrupt
68+latest=1.1.0
69+
70+# A file server that also answers /releases/latest with a 302, like Rickub.
71+port="$(python3 -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1])')"
72+cat >"${work}/server.py" <<'PY'
73+import http.server, sys, functools
74+root, port, latest = sys.argv[1], int(sys.argv[2]), sys.argv[3]
75+class Handler(http.server.SimpleHTTPRequestHandler):
76+ def do_HEAD(self):
77+ if self.path == "/releases/latest":
78+ self.send_response(302)
79+ self.send_header("Location", f"/bots-garden/razorbill/releases/v{latest}")
80+ self.end_headers()
81+ return
82+ super().do_HEAD()
83+ def do_GET(self):
84+ if self.path == "/releases/latest":
85+ return self.do_HEAD()
86+ super().do_GET()
87+ def log_message(self, *args):
88+ pass
89+http.server.ThreadingHTTPServer(("127.0.0.1", port), functools.partial(Handler, directory=root)).serve_forever()
90+PY
91+python3 "${work}/server.py" "${site}" "${port}" "${latest}" &
92+server_pid=$!
93+export RZB_INSTALL_BASE_URL="http://127.0.0.1:${port}"
94+export RZB_INSTALL_ANY_PLATFORM=1
95+# The sandbox proxy must not see 127.0.0.1.
96+export NO_PROXY="127.0.0.1${NO_PROXY:+,${NO_PROXY}}" no_proxy="127.0.0.1${no_proxy:+,${no_proxy}}"
97+for _ in $(seq 50); do
98+ curl -fsS -o /dev/null "${RZB_INSTALL_BASE_URL}/releases/download/v1.0.0/SHA256SUMS" 2>/dev/null && break
99+ sleep 0.1
100+done
101+
102+prefix="${work}/prefix"
103+rzb() { "${prefix}/bin/rzb" "$@"; }
104+reports() { [[ "$(rzb --version)" == "$1" ]]; }
105+has() { [[ -e "${prefix}/lib/razorbill/$1" ]]; }
106+hasnt() { [[ ! -e "${prefix}/lib/razorbill/$1" ]]; }
107+
108+echo "install-rzb.sh"
109+
110+check "installs the latest release" bash "${installer}" --prefix "${prefix}" --no-verify
111+check " the launcher runs it" reports "${latest}"
112+check " the launcher carries the shared marker" grep -qF "# razorbill launcher (scripts/install.sh)" "${prefix}/bin/rzb"
113+check " the bundles are installed" has mlx-swift_Cmlx.bundle/Contents/Info.plist
114+
115+check "installs a given version (v prefix accepted)" bash "${installer}" --prefix "${prefix}" --no-verify --version v1.0.0
116+check " the launcher runs it" reports 1.0.0
117+check " the old folder is gone, not merged" hasnt "only-in-${latest}"
118+
119+check "works piped, as curl | bash runs it" bash -c "cat '${installer}' | bash -s -- --prefix '${prefix}' --no-verify --version ${latest}"
120+check " the launcher runs it" reports "${latest}"
121+
122+refuses "refuses a checksum mismatch" "checksum mismatch" \
123+ bash "${installer}" --prefix "${prefix}" --no-verify --version 9.9.9
124+check " the installed version is untouched" reports "${latest}"
125+
126+refuses "refuses a version that is not published" "cannot download" \
127+ bash "${installer}" --prefix "${prefix}" --no-verify --version 7.7.7
128+refuses "refuses something that is not a version" "not a version" \
129+ bash "${installer}" --prefix "${prefix}" --no-verify --version latest
130+refuses "refuses an unsigned rzb without --no-verify" "rzb" \
131+ bash "${installer}" --prefix "${prefix}" --version 1.0.0
132+check " the installed version is untouched" reports "${latest}"
133+
134+check "--dry-run installs nothing" bash "${installer}" --prefix "${work}/dry" --no-verify --dry-run
135+check " no folder, no launcher" test ! -e "${work}/dry"
136+
137+foreign="${work}/foreign"
138+mkdir -p "${foreign}/bin"
139+printf '#!/bin/sh\necho someone else\n' >"${foreign}/bin/rzb"
140+refuses "never overwrites an rzb it did not write" "was not installed by razorbill" \
141+ bash "${installer}" --prefix "${foreign}" --no-verify
142+refuses "never removes an rzb it did not write" "was not installed by razorbill" \
143+ bash "${installer}" --prefix "${foreign}" --uninstall
144+check " the foreign rzb is untouched" grep -q "someone else" "${foreign}/bin/rzb"
145+
146+refuses "refuses an unknown option" "unknown option" bash "${installer}" --frobnicate
147+check "--help prints the usage, piped too" bash -c "cat '${installer}' | bash -s -- --help | grep -q -- --uninstall"
148+
149+if [[ "$(uname -s)" != Darwin || "$(uname -m)" != arm64 ]]; then
150+ refuses "refuses a platform other than macOS on Apple Silicon" "razorbill" \
151+ env RZB_INSTALL_ANY_PLATFORM= bash "${installer}" --prefix "${work}/platform" --no-verify
152+fi
153+
154+check "--uninstall removes the folder and the launcher" bash "${installer}" --prefix "${prefix}" --uninstall
155+check " both are gone" test ! -e "${prefix}/bin/rzb" -a ! -e "${prefix}/lib/razorbill"
156+check "--uninstall again has nothing to remove" bash "${installer}" --prefix "${prefix}" --uninstall
157+
158+echo ""
159+echo "${passed} passed, ${failed} failed"
160+[[ "${failed}" == 0 ]]
new file mode 100755
@@ -0,0 +1,160 @@
1+#!/usr/bin/env bash
2+# Tests of install-rzb.sh (ticket #65) against fake releases served on 127.0.0.1.
3+#
4+# Tests/Installer/test-install-rzb.sh
5+#
6+# Needs bash, curl, tar, python3; runs on Linux and on the Mac. The fake rzb is a shell script
7+# and is not signed, so every install passes --no-verify except the test that checks the
8+# signature is refused. RZB_INSTALL_ANY_PLATFORM=1 lifts the macOS/arm64 check, except in the
9+# platform test. Writes only into a temporary folder.
10+set -euo pipefail
11+cd "$(dirname "$0")/../.."
12+installer="$PWD/install-rzb.sh"
13+
14+work="$(mktemp -d)"
15+server_pid=""
16+cleanup() {
17+ if [[ -n "${server_pid}" ]]; then kill "${server_pid}" 2>/dev/null || true; fi
18+ rm -rf "${work}"
19+}
20+trap cleanup EXIT
21+
22+passed=0
23+failed=0
24+ok() { passed=$((passed + 1)); printf ' ✅ %s\n' "$1"; }
25+ko() { failed=$((failed + 1)); printf ' ❌ %s\n' "$1"; }
26+check() { # check "description" command…
27+ local what=$1
28+ shift
29+ if "$@" >"${work}/out" 2>&1; then ok "${what}"; else ko "${what}"; sed 's/^/ /' "${work}/out"; fi
30+}
31+refuses() { # refuses "description" "expected message" command…
32+ local what=$1 message=$2
33+ shift 2
34+ if "$@" >"${work}/out" 2>&1; then
35+ ko "${what} (it succeeded)"
36+ elif grep -qF -- "${message}" "${work}/out"; then
37+ ok "${what}"
38+ else
39+ ko "${what} (message: $(tr '\n' ' ' <"${work}/out"))"
40+ fi
41+}
42+
43+checksum() { if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$@"; else sha256sum "$@"; fi; }
44+
45+# publish VERSION [corrupt]: a release the way local-ci-02 lays it out, with a marker file named
46+# after the version (to see that an upgrade replaces the whole folder).
47+site="${work}/site"
48+publish() {
49+ local version=$1 corrupt=${2:-}
50+ local name="razorbill-${version}-macos-arm64"
51+ local stage="${work}/stage/${name}"
52+ mkdir -p "${stage}/mlx-swift_Cmlx.bundle/Contents" "${stage}/swift-nio_NIOPosix.bundle/Contents"
53+ printf '#!/bin/sh\necho %s\n' "${version}" >"${stage}/rzb"
54+ chmod 755 "${stage}/rzb"
55+ printf 'plist\n' >"${stage}/mlx-swift_Cmlx.bundle/Contents/Info.plist"
56+ touch "${stage}/only-in-${version}"
57+ local dir="${site}/releases/download/v${version}"
58+ mkdir -p "${dir}"
59+ tar -C "${work}/stage" -czf "${dir}/${name}.tar.gz" "${name}"
60+ (cd "${dir}" && checksum "${name}.tar.gz" >SHA256SUMS)
61+ if [[ -n "${corrupt}" ]]; then
62+ printf '%064d %s.tar.gz\n' 0 "${name}" >"${dir}/SHA256SUMS"
63+ fi
64+}
65+publish 1.0.0
66+publish 1.1.0
67+publish 9.9.9 corrupt
68+latest=1.1.0
69+
70+# A file server that also answers /releases/latest with a 302, like Rickub.
71+port="$(python3 -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1])')"
72+cat >"${work}/server.py" <<'PY'
73+import http.server, sys, functools
74+root, port, latest = sys.argv[1], int(sys.argv[2]), sys.argv[3]
75+class Handler(http.server.SimpleHTTPRequestHandler):
76+ def do_HEAD(self):
77+ if self.path == "/releases/latest":
78+ self.send_response(302)
79+ self.send_header("Location", f"/bots-garden/razorbill/releases/v{latest}")
80+ self.end_headers()
81+ return
82+ super().do_HEAD()
83+ def do_GET(self):
84+ if self.path == "/releases/latest":
85+ return self.do_HEAD()
86+ super().do_GET()
87+ def log_message(self, *args):
88+ pass
89+http.server.ThreadingHTTPServer(("127.0.0.1", port), functools.partial(Handler, directory=root)).serve_forever()
90+PY
91+python3 "${work}/server.py" "${site}" "${port}" "${latest}" &
92+server_pid=$!
93+export RZB_INSTALL_BASE_URL="http://127.0.0.1:${port}"
94+export RZB_INSTALL_ANY_PLATFORM=1
95+# The sandbox proxy must not see 127.0.0.1.
96+export NO_PROXY="127.0.0.1${NO_PROXY:+,${NO_PROXY}}" no_proxy="127.0.0.1${no_proxy:+,${no_proxy}}"
97+for _ in $(seq 50); do
98+ curl -fsS -o /dev/null "${RZB_INSTALL_BASE_URL}/releases/download/v1.0.0/SHA256SUMS" 2>/dev/null && break
99+ sleep 0.1
100+done
101+
102+prefix="${work}/prefix"
103+rzb() { "${prefix}/bin/rzb" "$@"; }
104+reports() { [[ "$(rzb --version)" == "$1" ]]; }
105+has() { [[ -e "${prefix}/lib/razorbill/$1" ]]; }
106+hasnt() { [[ ! -e "${prefix}/lib/razorbill/$1" ]]; }
107+
108+echo "install-rzb.sh"
109+
110+check "installs the latest release" bash "${installer}" --prefix "${prefix}" --no-verify
111+check " the launcher runs it" reports "${latest}"
112+check " the launcher carries the shared marker" grep -qF "# razorbill launcher (scripts/install.sh)" "${prefix}/bin/rzb"
113+check " the bundles are installed" has mlx-swift_Cmlx.bundle/Contents/Info.plist
114+
115+check "installs a given version (v prefix accepted)" bash "${installer}" --prefix "${prefix}" --no-verify --version v1.0.0
116+check " the launcher runs it" reports 1.0.0
117+check " the old folder is gone, not merged" hasnt "only-in-${latest}"
118+
119+check "works piped, as curl | bash runs it" bash -c "cat '${installer}' | bash -s -- --prefix '${prefix}' --no-verify --version ${latest}"
120+check " the launcher runs it" reports "${latest}"
121+
122+refuses "refuses a checksum mismatch" "checksum mismatch" \
123+ bash "${installer}" --prefix "${prefix}" --no-verify --version 9.9.9
124+check " the installed version is untouched" reports "${latest}"
125+
126+refuses "refuses a version that is not published" "cannot download" \
127+ bash "${installer}" --prefix "${prefix}" --no-verify --version 7.7.7
128+refuses "refuses something that is not a version" "not a version" \
129+ bash "${installer}" --prefix "${prefix}" --no-verify --version latest
130+refuses "refuses an unsigned rzb without --no-verify" "rzb" \
131+ bash "${installer}" --prefix "${prefix}" --version 1.0.0
132+check " the installed version is untouched" reports "${latest}"
133+
134+check "--dry-run installs nothing" bash "${installer}" --prefix "${work}/dry" --no-verify --dry-run
135+check " no folder, no launcher" test ! -e "${work}/dry"
136+
137+foreign="${work}/foreign"
138+mkdir -p "${foreign}/bin"
139+printf '#!/bin/sh\necho someone else\n' >"${foreign}/bin/rzb"
140+refuses "never overwrites an rzb it did not write" "was not installed by razorbill" \
141+ bash "${installer}" --prefix "${foreign}" --no-verify
142+refuses "never removes an rzb it did not write" "was not installed by razorbill" \
143+ bash "${installer}" --prefix "${foreign}" --uninstall
144+check " the foreign rzb is untouched" grep -q "someone else" "${foreign}/bin/rzb"
145+
146+refuses "refuses an unknown option" "unknown option" bash "${installer}" --frobnicate
147+check "--help prints the usage, piped too" bash -c "cat '${installer}' | bash -s -- --help | grep -q -- --uninstall"
148+
149+if [[ "$(uname -s)" != Darwin || "$(uname -m)" != arm64 ]]; then
150+ refuses "refuses a platform other than macOS on Apple Silicon" "razorbill" \
151+ env RZB_INSTALL_ANY_PLATFORM= bash "${installer}" --prefix "${work}/platform" --no-verify
152+fi
153+
154+check "--uninstall removes the folder and the launcher" bash "${installer}" --prefix "${prefix}" --uninstall
155+check " both are gone" test ! -e "${prefix}/bin/rzb" -a ! -e "${prefix}/lib/razorbill"
156+check "--uninstall again has nothing to remove" bash "${installer}" --prefix "${prefix}" --uninstall
157+
158+echo ""
159+echo "${passed} passed, ${failed} failed"
160+[[ "${failed}" == 0 ]]
modified docs/en/how-to/run-the-tests.md +8 -0
@@ -45,6 +45,14 @@ It starts `rzb serve` on port 18080 with a configuration of its own, runs `Tests
4545 - **Against a server you started**: `RZB_URL=http://127.0.0.1:7920/v1 scripts/compat.sh`. It must declare the ids `chat` and `embed` (and optionally `unforced`).
4646 - Other models: `RZB_COMPAT_CHAT_SOURCE`, `RZB_COMPAT_EMBED_SOURCE`, `RZB_COMPAT_UNFORCED_SOURCE`.
4747
48+## Test the install script
49+
50+```bash
51+Tests/Installer/test-install-rzb.sh
52+```
53+
54+It serves fake releases on `127.0.0.1` (with the `/releases/latest` redirect Rickub answers) and runs `install-rzb.sh` against them: install, upgrade, a given version, piped as `curl | bash` runs it, refusals (checksum mismatch, unpublished version, unsigned `rzb`, an `rzb` it did not write, another platform), `--dry-run`, `--uninstall`. Needs bash, curl, tar and python3; runs on Linux and on the Mac, and is part of `local-ci-01-check.sh`. The real signature check is not covered (the fake `rzb` is not signed).
55+
4856 ## Run the tests of the host-runner tool
4957
5058 ```bash
@@ -45,6 +45,14 @@ It starts `rzb serve` on port 18080 with a configuration of its own, runs `Tests
45 - **Against a server you started**: `RZB_URL=http://127.0.0.1:7920/v1 scripts/compat.sh`. It must declare the ids `chat` and `embed` (and optionally `unforced`).45 - **Against a server you started**: `RZB_URL=http://127.0.0.1:7920/v1 scripts/compat.sh`. It must declare the ids `chat` and `embed` (and optionally `unforced`).
46 - Other models: `RZB_COMPAT_CHAT_SOURCE`, `RZB_COMPAT_EMBED_SOURCE`, `RZB_COMPAT_UNFORCED_SOURCE`.46 - Other models: `RZB_COMPAT_CHAT_SOURCE`, `RZB_COMPAT_EMBED_SOURCE`, `RZB_COMPAT_UNFORCED_SOURCE`.
47 47
48+## Test the install script
49+
50+```bash
51+Tests/Installer/test-install-rzb.sh
52+```
53+
54+It serves fake releases on `127.0.0.1` (with the `/releases/latest` redirect Rickub answers) and runs `install-rzb.sh` against them: install, upgrade, a given version, piped as `curl | bash` runs it, refusals (checksum mismatch, unpublished version, unsigned `rzb`, an `rzb` it did not write, another platform), `--dry-run`, `--uninstall`. Needs bash, curl, tar and python3; runs on Linux and on the Mac, and is part of `local-ci-01-check.sh`. The real signature check is not covered (the fake `rzb` is not signed).
55+
48 ## Run the tests of the host-runner tool56 ## Run the tests of the host-runner tool
49 57
50 ```bash58 ```bash
modified docs/fr/how-to/lancer-les-tests.md +8 -0
@@ -45,6 +45,14 @@ Il démarre `rzb serve` sur le port 18080 avec sa propre configuration, lance `T
4545 - **Contre un serveur que vous avez démarré** : `RZB_URL=http://127.0.0.1:7920/v1 scripts/compat.sh`. Il doit déclarer les identifiants `chat` et `embed` (et éventuellement `unforced`).
4646 - Autres modèles : `RZB_COMPAT_CHAT_SOURCE`, `RZB_COMPAT_EMBED_SOURCE`, `RZB_COMPAT_UNFORCED_SOURCE`.
4747
48+## Tester le script d'installation
49+
50+```bash
51+Tests/Installer/test-install-rzb.sh
52+```
53+
54+Il sert de fausses releases sur `127.0.0.1` (avec la redirection `/releases/latest` que répond Rickub) et lance `install-rzb.sh` dessus : installation, mise à jour, version donnée, en flux comme le lance `curl | bash`, refus (empreinte fausse, version non publiée, `rzb` non signé, `rzb` qu'il n'a pas écrit, autre plateforme), `--dry-run`, `--uninstall`. Il demande bash, curl, tar et python3 ; il tourne sous Linux et sur le Mac, et fait partie de `local-ci-01-check.sh`. La vraie vérification de signature n'est pas couverte (le faux `rzb` n'est pas signé).
55+
4856 ## Lancer les tests de l'outil host-runner
4957
5058 ```bash
@@ -45,6 +45,14 @@ Il démarre `rzb serve` sur le port 18080 avec sa propre configuration, lance `T
45 - **Contre un serveur que vous avez démarré** : `RZB_URL=http://127.0.0.1:7920/v1 scripts/compat.sh`. Il doit déclarer les identifiants `chat` et `embed` (et éventuellement `unforced`).45 - **Contre un serveur que vous avez démarré** : `RZB_URL=http://127.0.0.1:7920/v1 scripts/compat.sh`. Il doit déclarer les identifiants `chat` et `embed` (et éventuellement `unforced`).
46 - Autres modèles : `RZB_COMPAT_CHAT_SOURCE`, `RZB_COMPAT_EMBED_SOURCE`, `RZB_COMPAT_UNFORCED_SOURCE`.46 - Autres modèles : `RZB_COMPAT_CHAT_SOURCE`, `RZB_COMPAT_EMBED_SOURCE`, `RZB_COMPAT_UNFORCED_SOURCE`.
47 47
48+## Tester le script d'installation
49+
50+```bash
51+Tests/Installer/test-install-rzb.sh
52+```
53+
54+Il sert de fausses releases sur `127.0.0.1` (avec la redirection `/releases/latest` que répond Rickub) et lance `install-rzb.sh` dessus : installation, mise à jour, version donnée, en flux comme le lance `curl | bash`, refus (empreinte fausse, version non publiée, `rzb` non signé, `rzb` qu'il n'a pas écrit, autre plateforme), `--dry-run`, `--uninstall`. Il demande bash, curl, tar et python3 ; il tourne sous Linux et sur le Mac, et fait partie de `local-ci-01-check.sh`. La vraie vérification de signature n'est pas couverte (le faux `rzb` n'est pas signé).
55+
48 ## Lancer les tests de l'outil host-runner56 ## Lancer les tests de l'outil host-runner
49 57
50 ```bash58 ```bash
added install-rzb.sh +224 -0
new file mode 100755
@@ -0,0 +1,224 @@
1+#!/usr/bin/env bash
2+# install-rzb.sh — install or upgrade razorbill (rzb) from its published release. Ticket #65.
3+#
4+# curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
5+# curl -fsSL …/install-rzb.sh | bash -s -- --version 1.0.0 --prefix ~/.local
6+#
7+# Options:
8+# --version X.Y.Z install this version (default: the latest release)
9+# --prefix DIR install into DIR/lib/razorbill + the launcher DIR/bin/rzb (default /usr/local)
10+# --uninstall remove what this script (or scripts/install.sh) installed under the prefix
11+# --dry-run download and check everything, install nothing
12+# --no-verify skip the signature check (archives before 1.0.0 are not signed)
13+# -h, --help this help
14+#
15+# What it does: finds the version, downloads the archive and SHA256SUMS into a temporary folder,
16+# checks the checksum, unpacks, checks that rzb is signed by the bots-garden Developer ID, runs the
17+# unpacked `rzb --version`, then replaces <prefix>/lib/razorbill as a whole and writes the
18+# launcher <prefix>/bin/rzb. sudo is used only when the prefix is not writable. Models
19+# (~/.cache/huggingface) and settings (~/.config/razorbill) are never touched.
20+#
21+# Everything runs from main(), called on the last line: a download cut halfway runs nothing.
22+set -euo pipefail
23+
24+BASE_URL="${RZB_INSTALL_BASE_URL:-https://rickub.com/bots-garden/razorbill}"
25+# The team that signs rzb (Developer ID Application: … (SNLLBZP9V9)).
26+TEAM_ID="SNLLBZP9V9"
27+IDENTIFIER="com.bots-garden.rzb"
28+MARKER="# razorbill launcher (scripts/install.sh)"
29+
30+say() { printf '%s\n' "$*"; }
31+fail() { printf 'install-rzb: %s\n' "$*" >&2; exit 1; }
32+
33+# The help is a heredoc, not read from this file: under `curl | bash` there is no file.
34+usage() {
35+ cat <<'HELP'
36+install-rzb.sh — install or upgrade razorbill (rzb) from its published release.
37+
38+ curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
39+ curl -fsSL …/install-rzb.sh | bash -s -- --version 1.0.0 --prefix ~/.local
40+
41+ --version X.Y.Z install this version (default: the latest release)
42+ --prefix DIR DIR/lib/razorbill + the launcher DIR/bin/rzb (default /usr/local)
43+ --uninstall remove what this script (or scripts/install.sh) installed under the prefix
44+ --dry-run download and check everything, install nothing
45+ --no-verify skip the signature check (archives before 1.0.0 are not signed)
46+ -h, --help this help
47+HELP
48+}
49+
50+# check_platform refuses anything but macOS 14+ on Apple Silicon: rzb runs its models with MLX
51+# on the GPU. RZB_INSTALL_ANY_PLATFORM=1 lifts it, for the installer's own tests only.
52+check_platform() {
53+ [[ "${RZB_INSTALL_ANY_PLATFORM:-}" == 1 ]] && return 0
54+ [[ "$(uname -s)" == Darwin ]] || fail "razorbill runs on macOS only (this is $(uname -s))"
55+ [[ "$(uname -m)" == arm64 ]] || fail "razorbill needs Apple Silicon (this Mac is $(uname -m))"
56+ local major
57+ major="$(sw_vers -productVersion | cut -d. -f1)"
58+ ((major >= 14)) || fail "razorbill needs macOS 14 or later (this is $(sw_vers -productVersion))"
59+}
60+
61+# latest_version prints the version of the latest release, read from the /releases/latest
62+# redirect (the API needs a token; the redirect does not).
63+latest_version() {
64+ local location
65+ location="$(curl -fsSI -m 30 "${BASE_URL}/releases/latest" | tr -d '\r' \
66+ | awk 'tolower($1) == "location:" {print $2}' | tail -1)" \
67+ || fail "cannot reach ${BASE_URL}/releases/latest"
68+ [[ -n "${location}" ]] || fail "no release found at ${BASE_URL}/releases/latest"
69+ local tag="${location##*/}"
70+ printf '%s\n' "${tag#v}"
71+}
72+
73+checksum() {
74+ if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$@"; else sha256sum "$@"; fi
75+}
76+
77+# writable_as_user is true when the current user can create, replace and remove everything the
78+# install touches (the same rule as scripts/install.sh).
79+writable_as_user() {
80+ local path
81+ for path in "${PREFIX}/lib" "${PREFIX}/bin" "${HOME_DIR}" "${LAUNCHER}"; do
82+ while [[ ! -e "${path}" ]]; do path="$(dirname "${path}")"; done
83+ [[ -w "${path}" ]] || return 1
84+ done
85+ [[ ! -d "${HOME_DIR}" || -z "$(find "${HOME_DIR}" ! -user "$(id -u)" -print -quit)" ]]
86+}
87+
88+as_owner() {
89+ if writable_as_user; then "$@"; else sudo "$@"; fi
90+}
91+
92+# check_launcher refuses to overwrite or remove an rzb this script did not write.
93+check_launcher() {
94+ if [[ -e "${LAUNCHER}" ]] && ! grep -qF "${MARKER}" "${LAUNCHER}" 2>/dev/null; then
95+ fail "${LAUNCHER} exists and was not installed by razorbill's installers: remove it first"
96+ fi
97+}
98+
99+# verify_signature checks that rzb and its bundles are validly signed, by our team, with our
100+# identifier. Whole outputs first: with pipefail, `codesign | grep -q` can fail on SIGPIPE.
101+verify_signature() {
102+ local folder=$1
103+ command -v codesign >/dev/null 2>&1 || fail "codesign not found: cannot check the signature"
104+ codesign --verify --strict "${folder}/rzb" 2>/dev/null \
105+ || fail "rzb is not validly signed (archives before 1.0.0 are not: pass --no-verify)"
106+ local details
107+ details="$(codesign -dv --verbose=4 "${folder}/rzb" 2>&1)"
108+ grep -qx "TeamIdentifier=${TEAM_ID}" <<<"${details}" \
109+ || fail "rzb is not signed by the bots-garden team (${TEAM_ID})"
110+ grep -qx "Identifier=${IDENTIFIER}" <<<"${details}" \
111+ || fail "rzb does not carry the identifier ${IDENTIFIER}"
112+ local bundle
113+ for bundle in "${folder}"/*.bundle; do
114+ codesign --verify --strict "${bundle}" 2>/dev/null || fail "$(basename "${bundle}") is not validly signed"
115+ done
116+ say "✅ signed by the bots-garden Developer ID (${TEAM_ID})"
117+}
118+
119+# Not named `uninstall` / `install`: `install` would shadow /usr/bin/install, used below.
120+remove_rzb() {
121+ check_launcher
122+ if [[ ! -e "${LAUNCHER}" && ! -e "${HOME_DIR}" ]]; then
123+ say "nothing to remove under ${PREFIX}"
124+ return 0
125+ fi
126+ if [[ "${DRY_RUN}" == true ]]; then
127+ say "would remove ${HOME_DIR} and ${LAUNCHER}"
128+ return 0
129+ fi
130+ as_owner rm -rf "${HOME_DIR}" "${LAUNCHER}"
131+ say "removed ${HOME_DIR} and ${LAUNCHER} (models and settings kept)"
132+}
133+
134+install_rzb() {
135+ local version="${VERSION}"
136+ if [[ -z "${version}" ]]; then
137+ version="$(latest_version)"
138+ fi
139+ version="${version#v}"
140+ [[ "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] || fail "not a version: ${version}"
141+ check_launcher
142+
143+ local name="razorbill-${version}-macos-arm64"
144+ local download="${BASE_URL}/releases/download/v${version}"
145+ say "==> razorbill ${version}"
146+
147+ WORK="$(mktemp -d)"
148+ trap 'rm -rf "${WORK}"' EXIT
149+ curl -fsSL -m 600 -o "${WORK}/${name}.tar.gz" "${download}/${name}.tar.gz" \
150+ || fail "cannot download ${download}/${name}.tar.gz (is ${version} published?)"
151+ curl -fsSL -m 60 -o "${WORK}/SHA256SUMS" "${download}/SHA256SUMS" \
152+ || fail "cannot download ${download}/SHA256SUMS"
153+
154+ # Only the archive's line: the release may list other files.
155+ grep -E "^[0-9a-f]{64} ${name}\.tar\.gz$" "${WORK}/SHA256SUMS" >"${WORK}/expected" \
156+ || fail "SHA256SUMS has no line for ${name}.tar.gz"
157+ (cd "${WORK}" && checksum -c expected >/dev/null 2>&1) || fail "checksum mismatch for ${name}.tar.gz"
158+ say "✅ checksum"
159+
160+ tar -C "${WORK}" -xzf "${WORK}/${name}.tar.gz" || fail "cannot unpack ${name}.tar.gz"
161+ local folder="${WORK}/${name}"
162+ [[ -x "${folder}/rzb" ]] || fail "the archive has no ${name}/rzb"
163+ [[ -d "${folder}/mlx-swift_Cmlx.bundle" ]] || fail "the archive has no mlx-swift_Cmlx.bundle"
164+
165+ if [[ "${NO_VERIFY}" == true ]]; then
166+ say "⚠️ signature not checked (--no-verify)"
167+ else
168+ verify_signature "${folder}"
169+ fi
170+
171+ local reported
172+ reported="$("${folder}/rzb" --version 2>/dev/null)" || fail "the downloaded rzb does not start"
173+ [[ "${reported}" == "${version}" ]] || fail "the downloaded rzb reports ${reported}, expected ${version}"
174+ say "✅ rzb --version: ${reported}"
175+
176+ if [[ "${DRY_RUN}" == true ]]; then
177+ say "dry run: would install into ${HOME_DIR}, launcher ${LAUNCHER}"
178+ return 0
179+ fi
180+
181+ printf '#!/bin/sh\n%s\nexec "%s/rzb" "$@"\n' "${MARKER}" "${HOME_DIR}" >"${WORK}/launcher"
182+ # The whole folder is replaced: no bundle of an older version stays behind.
183+ as_owner mkdir -p "${PREFIX}/lib" "${PREFIX}/bin"
184+ as_owner rm -rf "${HOME_DIR}"
185+ as_owner cp -R "${folder}" "${HOME_DIR}"
186+ as_owner install -m 755 "${WORK}/launcher" "${LAUNCHER}"
187+ say "✅ installed ${HOME_DIR}, launcher ${LAUNCHER}"
188+
189+ if [[ "$(command -v rzb || true)" != "${LAUNCHER}" ]]; then
190+ say "note: \`rzb\` does not resolve to ${LAUNCHER}: put ${PREFIX}/bin first in PATH"
191+ fi
192+ say "next: rzb models pull mlx-community/Qwen3-0.6B-4bit && rzb serve"
193+}
194+
195+main() {
196+ VERSION=""
197+ PREFIX="/usr/local"
198+ ACTION=install
199+ DRY_RUN=false
200+ NO_VERIFY=false
201+ while [[ $# -gt 0 ]]; do
202+ case "$1" in
203+ --version) VERSION="${2:?--version needs a version}"; shift 2 ;;
204+ --prefix) PREFIX="${2:?--prefix needs a directory}"; shift 2 ;;
205+ --uninstall) ACTION=uninstall; shift ;;
206+ --dry-run) DRY_RUN=true; shift ;;
207+ --no-verify) NO_VERIFY=true; shift ;;
208+ -h | --help) usage; exit 0 ;;
209+ *) fail "unknown option $1 (see --help)" ;;
210+ esac
211+ done
212+ PREFIX="${PREFIX%/}"
213+ HOME_DIR="${PREFIX}/lib/razorbill"
214+ LAUNCHER="${PREFIX}/bin/rzb"
215+
216+ if [[ "${ACTION}" == uninstall ]]; then
217+ remove_rzb
218+ else
219+ check_platform
220+ install_rzb
221+ fi
222+}
223+
224+main "$@"
new file mode 100755
@@ -0,0 +1,224 @@
1+#!/usr/bin/env bash
2+# install-rzb.sh — install or upgrade razorbill (rzb) from its published release. Ticket #65.
3+#
4+# curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
5+# curl -fsSL …/install-rzb.sh | bash -s -- --version 1.0.0 --prefix ~/.local
6+#
7+# Options:
8+# --version X.Y.Z install this version (default: the latest release)
9+# --prefix DIR install into DIR/lib/razorbill + the launcher DIR/bin/rzb (default /usr/local)
10+# --uninstall remove what this script (or scripts/install.sh) installed under the prefix
11+# --dry-run download and check everything, install nothing
12+# --no-verify skip the signature check (archives before 1.0.0 are not signed)
13+# -h, --help this help
14+#
15+# What it does: finds the version, downloads the archive and SHA256SUMS into a temporary folder,
16+# checks the checksum, unpacks, checks that rzb is signed by the bots-garden Developer ID, runs the
17+# unpacked `rzb --version`, then replaces <prefix>/lib/razorbill as a whole and writes the
18+# launcher <prefix>/bin/rzb. sudo is used only when the prefix is not writable. Models
19+# (~/.cache/huggingface) and settings (~/.config/razorbill) are never touched.
20+#
21+# Everything runs from main(), called on the last line: a download cut halfway runs nothing.
22+set -euo pipefail
23+
24+BASE_URL="${RZB_INSTALL_BASE_URL:-https://rickub.com/bots-garden/razorbill}"
25+# The team that signs rzb (Developer ID Application: … (SNLLBZP9V9)).
26+TEAM_ID="SNLLBZP9V9"
27+IDENTIFIER="com.bots-garden.rzb"
28+MARKER="# razorbill launcher (scripts/install.sh)"
29+
30+say() { printf '%s\n' "$*"; }
31+fail() { printf 'install-rzb: %s\n' "$*" >&2; exit 1; }
32+
33+# The help is a heredoc, not read from this file: under `curl | bash` there is no file.
34+usage() {
35+ cat <<'HELP'
36+install-rzb.sh — install or upgrade razorbill (rzb) from its published release.
37+
38+ curl -fsSL https://rickub.com/bots-garden/razorbill/raw/main/install-rzb.sh | bash
39+ curl -fsSL …/install-rzb.sh | bash -s -- --version 1.0.0 --prefix ~/.local
40+
41+ --version X.Y.Z install this version (default: the latest release)
42+ --prefix DIR DIR/lib/razorbill + the launcher DIR/bin/rzb (default /usr/local)
43+ --uninstall remove what this script (or scripts/install.sh) installed under the prefix
44+ --dry-run download and check everything, install nothing
45+ --no-verify skip the signature check (archives before 1.0.0 are not signed)
46+ -h, --help this help
47+HELP
48+}
49+
50+# check_platform refuses anything but macOS 14+ on Apple Silicon: rzb runs its models with MLX
51+# on the GPU. RZB_INSTALL_ANY_PLATFORM=1 lifts it, for the installer's own tests only.
52+check_platform() {
53+ [[ "${RZB_INSTALL_ANY_PLATFORM:-}" == 1 ]] && return 0
54+ [[ "$(uname -s)" == Darwin ]] || fail "razorbill runs on macOS only (this is $(uname -s))"
55+ [[ "$(uname -m)" == arm64 ]] || fail "razorbill needs Apple Silicon (this Mac is $(uname -m))"
56+ local major
57+ major="$(sw_vers -productVersion | cut -d. -f1)"
58+ ((major >= 14)) || fail "razorbill needs macOS 14 or later (this is $(sw_vers -productVersion))"
59+}
60+
61+# latest_version prints the version of the latest release, read from the /releases/latest
62+# redirect (the API needs a token; the redirect does not).
63+latest_version() {
64+ local location
65+ location="$(curl -fsSI -m 30 "${BASE_URL}/releases/latest" | tr -d '\r' \
66+ | awk 'tolower($1) == "location:" {print $2}' | tail -1)" \
67+ || fail "cannot reach ${BASE_URL}/releases/latest"
68+ [[ -n "${location}" ]] || fail "no release found at ${BASE_URL}/releases/latest"
69+ local tag="${location##*/}"
70+ printf '%s\n' "${tag#v}"
71+}
72+
73+checksum() {
74+ if command -v shasum >/dev/null 2>&1; then shasum -a 256 "$@"; else sha256sum "$@"; fi
75+}
76+
77+# writable_as_user is true when the current user can create, replace and remove everything the
78+# install touches (the same rule as scripts/install.sh).
79+writable_as_user() {
80+ local path
81+ for path in "${PREFIX}/lib" "${PREFIX}/bin" "${HOME_DIR}" "${LAUNCHER}"; do
82+ while [[ ! -e "${path}" ]]; do path="$(dirname "${path}")"; done
83+ [[ -w "${path}" ]] || return 1
84+ done
85+ [[ ! -d "${HOME_DIR}" || -z "$(find "${HOME_DIR}" ! -user "$(id -u)" -print -quit)" ]]
86+}
87+
88+as_owner() {
89+ if writable_as_user; then "$@"; else sudo "$@"; fi
90+}
91+
92+# check_launcher refuses to overwrite or remove an rzb this script did not write.
93+check_launcher() {
94+ if [[ -e "${LAUNCHER}" ]] && ! grep -qF "${MARKER}" "${LAUNCHER}" 2>/dev/null; then
95+ fail "${LAUNCHER} exists and was not installed by razorbill's installers: remove it first"
96+ fi
97+}
98+
99+# verify_signature checks that rzb and its bundles are validly signed, by our team, with our
100+# identifier. Whole outputs first: with pipefail, `codesign | grep -q` can fail on SIGPIPE.
101+verify_signature() {
102+ local folder=$1
103+ command -v codesign >/dev/null 2>&1 || fail "codesign not found: cannot check the signature"
104+ codesign --verify --strict "${folder}/rzb" 2>/dev/null \
105+ || fail "rzb is not validly signed (archives before 1.0.0 are not: pass --no-verify)"
106+ local details
107+ details="$(codesign -dv --verbose=4 "${folder}/rzb" 2>&1)"
108+ grep -qx "TeamIdentifier=${TEAM_ID}" <<<"${details}" \
109+ || fail "rzb is not signed by the bots-garden team (${TEAM_ID})"
110+ grep -qx "Identifier=${IDENTIFIER}" <<<"${details}" \
111+ || fail "rzb does not carry the identifier ${IDENTIFIER}"
112+ local bundle
113+ for bundle in "${folder}"/*.bundle; do
114+ codesign --verify --strict "${bundle}" 2>/dev/null || fail "$(basename "${bundle}") is not validly signed"
115+ done
116+ say "✅ signed by the bots-garden Developer ID (${TEAM_ID})"
117+}
118+
119+# Not named `uninstall` / `install`: `install` would shadow /usr/bin/install, used below.
120+remove_rzb() {
121+ check_launcher
122+ if [[ ! -e "${LAUNCHER}" && ! -e "${HOME_DIR}" ]]; then
123+ say "nothing to remove under ${PREFIX}"
124+ return 0
125+ fi
126+ if [[ "${DRY_RUN}" == true ]]; then
127+ say "would remove ${HOME_DIR} and ${LAUNCHER}"
128+ return 0
129+ fi
130+ as_owner rm -rf "${HOME_DIR}" "${LAUNCHER}"
131+ say "removed ${HOME_DIR} and ${LAUNCHER} (models and settings kept)"
132+}
133+
134+install_rzb() {
135+ local version="${VERSION}"
136+ if [[ -z "${version}" ]]; then
137+ version="$(latest_version)"
138+ fi
139+ version="${version#v}"
140+ [[ "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] || fail "not a version: ${version}"
141+ check_launcher
142+
143+ local name="razorbill-${version}-macos-arm64"
144+ local download="${BASE_URL}/releases/download/v${version}"
145+ say "==> razorbill ${version}"
146+
147+ WORK="$(mktemp -d)"
148+ trap 'rm -rf "${WORK}"' EXIT
149+ curl -fsSL -m 600 -o "${WORK}/${name}.tar.gz" "${download}/${name}.tar.gz" \
150+ || fail "cannot download ${download}/${name}.tar.gz (is ${version} published?)"
151+ curl -fsSL -m 60 -o "${WORK}/SHA256SUMS" "${download}/SHA256SUMS" \
152+ || fail "cannot download ${download}/SHA256SUMS"
153+
154+ # Only the archive's line: the release may list other files.
155+ grep -E "^[0-9a-f]{64} ${name}\.tar\.gz$" "${WORK}/SHA256SUMS" >"${WORK}/expected" \
156+ || fail "SHA256SUMS has no line for ${name}.tar.gz"
157+ (cd "${WORK}" && checksum -c expected >/dev/null 2>&1) || fail "checksum mismatch for ${name}.tar.gz"
158+ say "✅ checksum"
159+
160+ tar -C "${WORK}" -xzf "${WORK}/${name}.tar.gz" || fail "cannot unpack ${name}.tar.gz"
161+ local folder="${WORK}/${name}"
162+ [[ -x "${folder}/rzb" ]] || fail "the archive has no ${name}/rzb"
163+ [[ -d "${folder}/mlx-swift_Cmlx.bundle" ]] || fail "the archive has no mlx-swift_Cmlx.bundle"
164+
165+ if [[ "${NO_VERIFY}" == true ]]; then
166+ say "⚠️ signature not checked (--no-verify)"
167+ else
168+ verify_signature "${folder}"
169+ fi
170+
171+ local reported
172+ reported="$("${folder}/rzb" --version 2>/dev/null)" || fail "the downloaded rzb does not start"
173+ [[ "${reported}" == "${version}" ]] || fail "the downloaded rzb reports ${reported}, expected ${version}"
174+ say "✅ rzb --version: ${reported}"
175+
176+ if [[ "${DRY_RUN}" == true ]]; then
177+ say "dry run: would install into ${HOME_DIR}, launcher ${LAUNCHER}"
178+ return 0
179+ fi
180+
181+ printf '#!/bin/sh\n%s\nexec "%s/rzb" "$@"\n' "${MARKER}" "${HOME_DIR}" >"${WORK}/launcher"
182+ # The whole folder is replaced: no bundle of an older version stays behind.
183+ as_owner mkdir -p "${PREFIX}/lib" "${PREFIX}/bin"
184+ as_owner rm -rf "${HOME_DIR}"
185+ as_owner cp -R "${folder}" "${HOME_DIR}"
186+ as_owner install -m 755 "${WORK}/launcher" "${LAUNCHER}"
187+ say "✅ installed ${HOME_DIR}, launcher ${LAUNCHER}"
188+
189+ if [[ "$(command -v rzb || true)" != "${LAUNCHER}" ]]; then
190+ say "note: \`rzb\` does not resolve to ${LAUNCHER}: put ${PREFIX}/bin first in PATH"
191+ fi
192+ say "next: rzb models pull mlx-community/Qwen3-0.6B-4bit && rzb serve"
193+}
194+
195+main() {
196+ VERSION=""
197+ PREFIX="/usr/local"
198+ ACTION=install
199+ DRY_RUN=false
200+ NO_VERIFY=false
201+ while [[ $# -gt 0 ]]; do
202+ case "$1" in
203+ --version) VERSION="${2:?--version needs a version}"; shift 2 ;;
204+ --prefix) PREFIX="${2:?--prefix needs a directory}"; shift 2 ;;
205+ --uninstall) ACTION=uninstall; shift ;;
206+ --dry-run) DRY_RUN=true; shift ;;
207+ --no-verify) NO_VERIFY=true; shift ;;
208+ -h | --help) usage; exit 0 ;;
209+ *) fail "unknown option $1 (see --help)" ;;
210+ esac
211+ done
212+ PREFIX="${PREFIX%/}"
213+ HOME_DIR="${PREFIX}/lib/razorbill"
214+ LAUNCHER="${PREFIX}/bin/rzb"
215+
216+ if [[ "${ACTION}" == uninstall ]]; then
217+ remove_rzb
218+ else
219+ check_platform
220+ install_rzb
221+ fi
222+}
223+
224+main "$@"
modified local-ci-00-common.sh +1 -1
@@ -2,7 +2,7 @@
22 # local-ci-00-common.sh — what the local-ci-*.sh steps share. Sourced, not run.
33 #
44 # The steps, in order (02 to 05 on the Mac):
5-# ./local-ci-01-check.sh swiftlint, swift-format, tests, the version
5+# ./local-ci-01-check.sh version, swiftlint, swift-format, scripts, installer, tests
66 # ./local-ci-02-build.sh the archive, in release/<TAG>/; signs and notarizes rzb
77 # when RZB_SIGN_IDENTITY is set
88 # (docs/en/how-to/package-a-release.md)
@@ -2,7 +2,7 @@
2 # local-ci-00-common.sh — what the local-ci-*.sh steps share. Sourced, not run.2 # local-ci-00-common.sh — what the local-ci-*.sh steps share. Sourced, not run.
3 #3 #
4 # The steps, in order (02 to 05 on the Mac):4 # The steps, in order (02 to 05 on the Mac):
5-# ./local-ci-01-check.sh swiftlint, swift-format, tests, the version5+# ./local-ci-01-check.sh version, swiftlint, swift-format, scripts, installer, tests
6 # ./local-ci-02-build.sh the archive, in release/<TAG>/; signs and notarizes rzb6 # ./local-ci-02-build.sh the archive, in release/<TAG>/; signs and notarizes rzb
7 # when RZB_SIGN_IDENTITY is set7 # when RZB_SIGN_IDENTITY is set
8 # (docs/en/how-to/package-a-release.md)8 # (docs/en/how-to/package-a-release.md)
modified local-ci-01-check.sh +12 -1
@@ -1,5 +1,6 @@
11 #!/usr/bin/env bash
2-# local-ci-01-check.sh — the version, swiftlint, swift-format and the tests.
2+# local-ci-01-check.sh — the version, swiftlint, swift-format, the shell scripts, the installer
3+# and the tests.
34 #
45 # On the Mac the tests are the whole suite, MLX included (xcodebuild test); on Linux, everything
56 # but MLX (scripts/test.sh decides). A release is checked on the Mac.
@@ -26,6 +27,16 @@ if [ -n "${format}" ]; then
2627 exit 1
2728 fi
2829
30+echo "==> shell scripts"
31+if command -v shellcheck >/dev/null 2>&1; then
32+ shellcheck -x local-ci-*.sh install-rzb.sh scripts/*.sh Tests/Installer/*.sh
33+else
34+ echo "⚠️ shellcheck not found (brew install shellcheck): shell scripts not linted"
35+fi
36+
37+echo "==> installer (install-rzb.sh, against fake releases)"
38+Tests/Installer/test-install-rzb.sh
39+
2940 echo "==> tests"
3041 scripts/test.sh
3142
@@ -1,5 +1,6 @@
1 #!/usr/bin/env bash1 #!/usr/bin/env bash
2-# local-ci-01-check.sh — the version, swiftlint, swift-format and the tests.2+# local-ci-01-check.sh — the version, swiftlint, swift-format, the shell scripts, the installer
3+# and the tests.
3 #4 #
4 # On the Mac the tests are the whole suite, MLX included (xcodebuild test); on Linux, everything5 # On the Mac the tests are the whole suite, MLX included (xcodebuild test); on Linux, everything
5 # but MLX (scripts/test.sh decides). A release is checked on the Mac.6 # but MLX (scripts/test.sh decides). A release is checked on the Mac.
@@ -26,6 +27,16 @@ if [ -n "${format}" ]; then
26 exit 127 exit 1
27 fi28 fi
28 29
30+echo "==> shell scripts"
31+if command -v shellcheck >/dev/null 2>&1; then
32+ shellcheck -x local-ci-*.sh install-rzb.sh scripts/*.sh Tests/Installer/*.sh
33+else
34+ echo "⚠️ shellcheck not found (brew install shellcheck): shell scripts not linted"
35+fi
36+
37+echo "==> installer (install-rzb.sh, against fake releases)"
38+Tests/Installer/test-install-rzb.sh
39+
29 echo "==> tests"40 echo "==> tests"
30 scripts/test.sh41 scripts/test.sh
31 42
modified local-ci-02-build.sh +4 -0
@@ -204,6 +204,10 @@ MLX model server with an OpenAI-compatible API, for macOS 14 or later on Apple S
204204
205205 ## Installing it
206206
207+ curl -fsSL ${web}/raw/main/install-rzb.sh | bash
208+
209+or by hand:
210+
207211 tar -xzf ${ARCHIVE}
208212 sudo mkdir -p /usr/local/lib /usr/local/bin
209213 sudo rm -rf /usr/local/lib/razorbill
@@ -204,6 +204,10 @@ MLX model server with an OpenAI-compatible API, for macOS 14 or later on Apple S
204 204
205 ## Installing it205 ## Installing it
206 206
207+ curl -fsSL ${web}/raw/main/install-rzb.sh | bash
208+
209+or by hand:
210+
207 tar -xzf ${ARCHIVE}211 tar -xzf ${ARCHIVE}
208 sudo mkdir -p /usr/local/lib /usr/local/bin212 sudo mkdir -p /usr/local/lib /usr/local/bin
209 sudo rm -rf /usr/local/lib/razorbill213 sudo rm -rf /usr/local/lib/razorbill
modified scripts/release.sh +4 -2
@@ -110,8 +110,10 @@ for target in "$out" "$archive" "$archive.sha256"; do
110110 fail "$target is not writable (left by a run with sudo?): sudo chown -R \"\$(whoami)\" $out .build"
111111 fi
112112 done
113-# No AppleDouble (._*) files from extended attributes in the archive (macOS tar).
114-COPYFILE_DISABLE=1 tar -C "$staging" -czf "$archive" "$name"
113+# No extended attributes in the archive: no AppleDouble (._*) files and no pax xattr headers
114+# (com.apple.provenance…), which tar on Linux reports as unknown keywords. The signatures do not
115+# need them: rzb's is in the executable, the bundles' in their _CodeSignature folders.
116+COPYFILE_DISABLE=1 tar --no-xattrs -C "$staging" -czf "$archive" "$name"
115117 (cd "$out" && shasum -a 256 "${name}.tar.gz" > "${name}.tar.gz.sha256")
116118
117119 # Check the archive itself, unpacked somewhere else: the bundles must travel with rzb.
@@ -110,8 +110,10 @@ for target in "$out" "$archive" "$archive.sha256"; do
110 fail "$target is not writable (left by a run with sudo?): sudo chown -R \"\$(whoami)\" $out .build"110 fail "$target is not writable (left by a run with sudo?): sudo chown -R \"\$(whoami)\" $out .build"
111 fi111 fi
112 done112 done
113-# No AppleDouble (._*) files from extended attributes in the archive (macOS tar).113+# No extended attributes in the archive: no AppleDouble (._*) files and no pax xattr headers
114-COPYFILE_DISABLE=1 tar -C "$staging" -czf "$archive" "$name"114+# (com.apple.provenance…), which tar on Linux reports as unknown keywords. The signatures do not
115+# need them: rzb's is in the executable, the bundles' in their _CodeSignature folders.
116+COPYFILE_DISABLE=1 tar --no-xattrs -C "$staging" -czf "$archive" "$name"
115 (cd "$out" && shasum -a 256 "${name}.tar.gz" > "${name}.tar.gz.sha256")117 (cd "$out" && shasum -a 256 "${name}.tar.gz" > "${name}.tar.gz.sha256")
116 118
117 # Check the archive itself, unpacked somewhere else: the bundles must travel with rzb.119 # Check the archive itself, unpacked somewhere else: the bundles must travel with rzb.