Skip to content

installer: install to ~/.local/bin, fix PATH, verify checksums - #1207

Merged
cdalar merged 1 commit into
mainfrom
installer-path-and-checksum
Oct 21, 2026
Merged

cdalar merged 1 commit into
mainfrom
installer-path-and-checksum

Conversation

@cdalar

@cdalar cdalar commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Why

onctl.sh/get.sh works with the signing-free pipeline from #1206 (asset names and checksums.txt are unchanged), but it never put onctl on PATH: it left the binary in the current directory and the docs told users to sudo install it by hand. This reworks the installer along the lines of claude.ai/install.sh.

Changes

  • No sudo. Refuses to run under sudo from a regular user's shell, same check as the Claude installer. Everything lives under $HOME.
  • Checksum-verified. Downloads the archive plus the release's checksums.txt, verifies the sha256 before extracting. Works in a temp dir cleaned up on exit.
  • Installs to ~/.local/bin (override with ONCTL_INSTALL_DIR) and appends a PATH line to .bashrc / .zshrc / config.fish once, only if the directory isn't already on PATH or in the rc file.
  • Rosetta detection: an x86_64 shell on Apple Silicon gets the arm64 build.
  • ONCTL_VERSION=<tag> installs a specific release. get-edge.sh is now a 3-line wrapper that runs get.sh with ONCTL_VERSION=edge, so there is one installer to maintain.
  • Windows is no longer handled by the script (it never put the exe on PATH anyway); it points at the zip on the releases page.
  • Completion install is unchanged apart from using the installed binary.
  • README and docs drop the manual sudo install line and describe what the installer does.

Verified locally on macOS arm64

  • zsh and bash with a scratch $HOME: binary at ~/.local/bin/onctl, one PATH line and one completion line in the rc, completion file generated
  • Re-running is idempotent (no duplicate rc lines, says the rc already has the line)
  • ONCTL_VERSION=edge installs the edge prerelease (its checksums.txt verifies)
  • A nonexistent tag fails with a clear error and exit 1
  • bash -n on both scripts

The docs site redeploys on push to main, so merging publishes the new scripts to onctl.sh.

🤖 Generated with Claude Code

onctl.sh/get.sh used to leave the binary in the current directory and
the docs told users to `sudo install` it by hand. Rework it along the
lines of claude.ai/install.sh:

- refuse sudo; everything lives under $HOME
- download the archive and checksums.txt for the release, verify the
  sha256 before extracting, work in a temp dir that is cleaned up
- install to $HOME/.local/bin (ONCTL_INSTALL_DIR to override) and add
  that directory to PATH in .bashrc/.zshrc/config.fish once, if it is
  not already there
- Rosetta detection: an x86_64 shell on Apple Silicon gets arm64
- ONCTL_VERSION=<tag> installs a specific release; get-edge.sh becomes
  a wrapper that runs get.sh with ONCTL_VERSION=edge
- Windows is no longer handled by the script (it never put the exe on
  PATH anyway); point at the zip on the releases page instead
- completion install is unchanged apart from using the installed binary

README and docs drop the manual `sudo install` step.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cdalar
cdalar enabled auto-merge (squash) October 21, 2026 13:51
@cdalar
cdalar merged commit b02af60 into main Oct 21, 2026
12 checks passed
@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.25%. Comparing base (15cae3b) to head (21639ad).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1207   +/-   ##
=======================================
  Coverage   41.25%   41.25%           
=======================================
  Files          69       69           
  Lines        7560     7560           
=======================================
  Hits         3119     3119           
  Misses       4441     4441           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址