#!/bin/sh # agent-ceo-local installer, release 0.1.13. Generated by make_installer.py; do not edit. # # curl -fsSL https://agent.ceo/install-local.sh | sh # # Installs the agent.ceo Browser local runner for this Mac to ~/.local/bin/agent-ceo-local, without # sudo. The download must match the SHA-256 embedded below, or nothing is installed. The checksum # proves the file is the one release CI built for this script; the authenticity of both rests on TLS # to agent.ceo. # # Everything runs inside main, called on the last line, so a download cut short executes nothing. set -eu VERSION='0.1.13' ARM64_URL='https://agent.ceo/downloads/browser-v0.1.13/agent-ceo-local-darwin-arm64' ARM64_SHA256='d00a97a3e994ac40279668fa0fab10f36b832af422e348891b0e5ef380af90ed' AMD64_URL='https://agent.ceo/downloads/browser-v0.1.13/agent-ceo-local-darwin-amd64' AMD64_SHA256='1550f1a6a71d50f8f96148e7630948fe89773f920f73a80082c7be6c7ff6e96c' PROTO='=https' fail() { echo "agent-ceo-local installer: $*" >&2 exit 1 } # machine is the hardware architecture: a shell translated by Rosetta reports x86_64 on Apple # silicon, and sysctl.proc_translated (1 there) says so; the native arm64 build is the right one. machine() { m=$(uname -m) if [ "$m" = x86_64 ] && [ "$(sysctl -n sysctl.proc_translated 2>/dev/null || true)" = 1 ]; then m=arm64 fi echo "$m" } pick_binary() { case "$(machine)" in arm64 | aarch64) URL=$ARM64_URL SHA256=$ARM64_SHA256 ;; x86_64) URL=$AMD64_URL SHA256=$AMD64_SHA256 ;; *) fail "no agent-ceo-local build for this Mac's architecture ($(uname -m)); builds exist for arm64 and x86_64" ;; esac } download_and_verify() { curl -fsSL --proto "$PROTO" --proto-redir '=https' -o "$1" "$URL" || fail "could not download $URL; nothing was installed" sum=$(shasum -a 256 "$1") || fail "shasum failed; nothing was installed" sum=${sum%% *} [ "$sum" = "$SHA256" ] || fail "checksum mismatch for $URL: expected $SHA256, got $sum; nothing was installed" } # install_binary stages the verified file under an unpredictable name next to its target (main's # trap removes it on any failure), then renames it over the target. install_binary() { dest="$HOME/.local/bin" mkdir -p "$dest" || fail "cannot create $dest; nothing was installed" stage=$(mktemp "$dest/.agent-ceo-local.XXXXXX") || fail "cannot write in $dest; nothing was installed" cp "$1" "$stage" || fail "cannot write $stage; nothing was installed" chmod 0755 "$stage" if [ -d "$dest/agent-ceo-local" ]; then fail "$dest/agent-ceo-local is a directory (or a link to one); nothing was installed" fi mv -f "$stage" "$dest/agent-ceo-local" echo "Installed agent-ceo-local $VERSION to $dest/agent-ceo-local" case ":${PATH:-}:" in *":$dest:"*) ;; *) path_hint "$dest" ;; esac echo "Next: agent-ceo-local up (then pair the agent.ceo Browser extension with the code it prints)" } # path_hint tells the user how to put $1 on PATH, in the startup file of their login shell. path_hint() { # shellcheck disable=SC2016 # printed literally: the user's shell expands it, not this one line='export PATH="$HOME/.local/bin:$PATH"' echo "$1 is not on your PATH. Add it with:" case "${SHELL:-}" in */zsh) echo " echo '$line' >> ~/.zshrc && exec zsh" ;; */bash) echo " echo '$line' >> ~/.bash_profile && exec bash -l" ;; *) echo " $line (in your shell's startup file)" ;; esac } main() { os=$(uname -s) [ "$os" = Darwin ] || fail "agent-ceo-local runs on macOS only; this system is $os. Nothing was downloaded." pick_binary stage= tmp=$(mktemp -d "${TMPDIR:-/tmp}/agent-ceo-local.XXXXXX") trap 'rm -rf "$tmp"; [ -z "$stage" ] || rm -f "$stage"' EXIT download_and_verify "$tmp/agent-ceo-local" install_binary "$tmp/agent-ceo-local" } main "$@"