#!/bin/sh # Palmtop Link — one binary on the machine that stays awake. # # curl -fsSL https://priorstates.com/palmtop/link/install.sh | sh # # Puts palmtop-link in /usr/local/bin (or ~/.local/bin without root), checks it # against the published checksum, and tells you what to do next. It installs a # program and nothing else: no service, no daemon, no cron entry, nothing that # starts at boot. Read it before you pipe it anywhere — it is 40 lines. set -eu BASE="${PALMTOP_LINK_BASE:-https://priorstates.com/palmtop/link}" os=$(uname -s | tr '[:upper:]' '[:lower:]') arch=$(uname -m) case "$arch" in x86_64|amd64) arch=amd64 ;; aarch64|arm64) arch=arm64 ;; *) echo "Palmtop Link has no build for $arch — build it from source: palmtop/link" >&2; exit 1 ;; esac case "$os" in linux) name="palmtop-link-linux-$arch" ;; darwin) name="palmtop-link-macos-$arch" ;; *) echo "Palmtop Link has no build for $os — on Windows, download palmtop-link-windows-amd64.exe" >&2; exit 1 ;; esac if [ -w /usr/local/bin ] 2>/dev/null; then dir=/usr/local/bin elif [ "$(id -u)" = 0 ]; then dir=/usr/local/bin else dir="$HOME/.local/bin"; fi mkdir -p "$dir" tmp=$(mktemp -d); trap 'rm -rf "$tmp"' EXIT echo "Fetching $name…" curl -fsSL "$BASE/$name" -o "$tmp/palmtop-link" if curl -fsSL "$BASE/SHA256SUMS" -o "$tmp/SHA256SUMS" 2>/dev/null; then want=$(grep " $name\$" "$tmp/SHA256SUMS" | cut -d' ' -f1) got=$( (sha256sum "$tmp/palmtop-link" 2>/dev/null || shasum -a 256 "$tmp/palmtop-link") | cut -d' ' -f1) if [ -n "$want" ] && [ "$want" != "$got" ]; then echo "Checksum does not match what the site published — not installing." >&2; exit 1 fi echo "Checksum ok." fi chmod +x "$tmp/palmtop-link" mv "$tmp/palmtop-link" "$dir/palmtop-link" echo "Installed $dir/palmtop-link" case ":$PATH:" in *":$dir:"*) ;; *) echo "Note: $dir is not on your PATH." ;; esac cat <<'NEXT' Next, on your phone: Palmtop -> Alerts -> Add a server. Then here: palmtop-link enroll PT-XXXX-XXXX --name $(hostname) palmtop-link test NEXT