#!/bin/sh # seedstone installer — https://seedstone.io/install.sh # # Installs the latest seedstone release on this machine: finds the release # and the archive built for this operating system and CPU, downloads it # with its checksum from the release's assets, verifies the SHA-256, and # copies the one binary into place. It starts no server, writes no # configuration, touches no shell file, and talks to no host but github.com # and the one its release assets redirect to. Read it first. # # curl -fsSL https://seedstone.io/install.sh | sh # wget -qO- https://seedstone.io/install.sh | sh # # Environment: # SEEDSTONE_VERSION a tag to install, e.g. v0.3.2 (default: the latest release) # SEEDSTONE_INSTALL_DIR where the binary goes (default: /usr/local/bin) # SEEDSTONE_BASE_URL the repository, for a mirror or a test server # (default: https://github.com/stefanobaldo/seedstone); # the latest release is read from # $SEEDSTONE_BASE_URL/releases/latest and an asset from # $SEEDSTONE_BASE_URL/releases/download// # # Exit codes: 0 installed; 1 refused (unsupported machine, missing tool, no # permission); 2 download failed; 3 checksum mismatch. Each with one sentence # on stderr naming the cause and what to do. # # POSIX sh: runs under dash, bash, zsh and BusyBox ash. Everything below is a # function, and `main` is called on the last line, so a download cut short # defines a few functions and runs nothing. DOCS="https://github.com/stefanobaldo/seedstone/blob/main/docs/install.md" # The oldest glibc the Linux binaries run on: the highest GLIBC_x.y their # symbols import, read from the release binary with `objdump -T`. The # repository's installer check reads it again from every release it # installs, so a toolchain that raises it turns that check red. GLIBC_MIN=2.34 # --- output --------------------------------------------------------------- # Colour and symbols only on a terminal, with NO_COLOR unset and TERM not # dumb: the brand's amber where the terminal advertises 24-bit colour # (COLORTERM), the sixteen-colour palette otherwise. Piped or plain, the # same lines without an escape byte, so a CI log reads as a screen. COLOR=0 setup_output() { if [ -t 1 ] && [ -z "${NO_COLOR+set}" ] && [ "${TERM:-dumb}" != dumb ]; then COLOR=1 case "${COLORTERM:-}" in truecolor | 24bit) COLOR=2 ;; esac fi } # Styles, as SGR parameters: AMBER is the brand's amber on a 24-bit # terminal and yellow elsewhere; the rest are the same everywhere. style_amber() { if [ "$COLOR" -eq 2 ]; then printf '38;2;240;160;48'; else printf '33'; fi; } style_green() { printf '32'; } style_red() { printf '31'; } style_bold() { printf '1'; } style_dim() { printf '2'; } # A span in a style, or the bare text where colour is off. paint() { #