#!/bin/sh # Copyright (c) 2026 Neural Inverse. All rights reserved. # SPDX-License-Identifier: BUSL-1.1. See LICENSE in the project root for license information. # # Sandscale CLI installer (Linux, macOS), served at https://sandscale.dev/install and attached to every release as install.sh: # # curl -fsSL https://sandscale.dev/install | sh # curl -fsSL https://sandscale.dev/install | sh -s -- --version 1.4.0 # curl -fsSL https://sandscale.dev/install | sh -s -- --yes # scripts: no questions, no sign-in # # One command and you are done: the binary goes into a folder already on your PATH that you can write without sudo # (~/.local/bin, ~/bin, /opt/homebrew/bin on Apple Silicon, /usr/local/bin), or an existing copy is replaced where it is. # Only when there is none it goes to ~/.sandscale/bin, which is added to your shell's startup file (zsh, bash, fish, sh) once, # without asking. On a terminal it then offers to sign you in (Enter is yes). # # Verification, with no option to skip it: the binary must match the release's SHA256SUMS, and SHA256SUMS must carry a valid # signature by the Sandscale release key (Ed25519, key id 579C89CF142A6D74), checked with a tool the system already has: # minisign when installed, else ssh-keygen (OpenSSH 8.1 or later: macOS, most Linux), else OpenSSL 3. A signature that does # not verify, or a signature file missing from a release that is signed, installs nothing. Where none of the tools exists # (minimal containers) the checksum is still required and the installer says the signature was not checked; pass # --require-signature to refuse that. # # Options: # --version Install release sandscale-cli-X instead of the latest release # --dir Install into this folder (also $SANDSCALE_INSTALL_DIR) # --prefix Install into /bin # --system Install to /usr/local/bin (unless --dir); the only case that may run sudo # --no-modify-path Never write a shell startup file (also SANDSCALE_NO_MODIFY_PATH=1) # --no-login Do not offer to sign in (also SANDSCALE_NO_LOGIN=1) # -y, --yes No questions: for scripts (implies --no-login) # --require-signature Refuse to install when no tool here can check the release signature # -h, --help Show help # # Environment: SANDSCALE_VERSION, SANDSCALE_INSTALL_DIR, SANDSCALE_DOWNLOAD_BASE (an https mirror of the release files), # GITHUB_TOKEN (the API lookup of the latest release), HTTPS_PROXY / https_proxy, NO_COLOR, CI. # # It sends nothing but the downloads (no telemetry) and runs sudo only with --system when the folder needs it. set -eu REPO="${SANDSCALE_REPO:-sandscale/cli}" TAG_PREFIX="sandscale-cli-" BIN_NAME="sandscale" # The Sandscale release key in its three forms (one Ed25519 key; packaging/minisign/sandscale-release.pub, # SANDSCALE_RELEASE_KEYS in the CLI). scripts/release-sandscale.mjs checks that the three agree. RELEASE_KEY="RWR0bSoUz4mcVznjg3+jnRAaL4dOWoCfQkkgXmCgs7OU355WPgBLQDLu" RELEASE_KEY_ID="579C89CF142A6D74" RELEASE_SSH_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDnjg3+jnRAaL4dOWoCfQkkgXmCgs7OU355WPgBLQDLu" RELEASE_SPKI="MCowBQYDK2VwAyEAOeODf6OdEBovh05agJ9CSSBeYKCzs5TfnlY+AEtAMu4=" SSH_NAMESPACE="sandscale-release" SSH_PRINCIPAL="release@sandscale.dev" # Releases from these versions on carry SHA256SUMS.minisig, and SHA256SUMS.sshsig with SHA256SUMS.sig; one missing from such a # release, where a tool could check it, installs nothing. MINISIG_SINCE="1.2.0" SSHSIG_SINCE="1.3.0" # A self-test: a signature by a throwaway key (not the release key) over a fixed message. A tool that cannot check it cannot # check Ed25519 signatures at all, so its silence is never taken for a bad release, and its "no" for a real one always is. SELFTEST_MESSAGE="sandscale installer self-test" SELFTEST_SSH_KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILhBcEPnQggBEpyNOuu+Y8Bs4tANJRUAAURWbed1kBK1" SELFTEST_SSHSIG="U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAguEFwQ+dCCAESnI06675jwGzi0A0lFQABRFZt53WQErUAAAARc2FuZHNjYWxlLXJlbGVhc2UAAAAAAAAABnNoYTUxMgAAAFMAAAALc3NoLWVkMjU1MTkAAABAfuzeXU81b4DDafcryCZAoy3IDqYyYy+KnVYojS8GMqT2chTZ7z77bHrkCCiJpDw2HvLlZFyyXXoDkbidxZxHCA==" SELFTEST_SPKI="MCowBQYDK2VwAyEAuEFwQ+dCCAESnI06675jwGzi0A0lFQABRFZt53WQErU=" SELFTEST_RAWSIG="8V1/LbSyhLdaZ+3HVwDjePFJfA9f+RIYwWwLLfQbEJhNMGnfgwl9v2rCNVgKw52M2KIjXZz9vFEr8jLQuMRXBQ==" # --------------------------------------------------------------------------- # Output: colour on a terminal only, never with NO_COLOR or TERM=dumb. Progress on stdout, errors on stderr. c_accent="" c_box="" c_dim="" c_bold="" c_green="" c_off="" if [ -t 1 ] && [ -z "${NO_COLOR:-}" ] && [ "${TERM:-dumb}" != dumb ]; then esc=$(printf '\033') c_accent="${esc}[38;5;179m" # Amber c_box="${esc}[38;5;251m" # Dune c_dim="${esc}[2m" c_bold="${esc}[1m" c_green="${esc}[32m" c_off="${esc}[0m" fi e_red="" e_bold="" e_off="" if [ -t 2 ] && [ -z "${NO_COLOR:-}" ] && [ "${TERM:-dumb}" != dumb ]; then esc=$(printf '\033') e_red="${esc}[31m" e_bold="${esc}[1m" e_off="${esc}[0m" fi case "${LC_ALL:-${LC_CTYPE:-${LANG:-}}}" in *UTF-8* | *utf-8* | *UTF8* | *utf8*) mark_ok="✓" ;; *) mark_ok="ok" ;; esac say() { printf '%s\n' "$*"; } # row