#!/bin/sh # PinDrift phone install, for Open Minis or iSH on the iPhone it installs to. # # wget -qO- https://dl.pindrift.app/p/ | sh # # Downloads pindrift-install, refuses it unless its sha256 is the one pinned # below, and runs it on the terminal. The pipe from wget is spent on this # script, so the installer reads from /dev/tty. # # The first screen is the installer's own mark, drawn here so the download # already looks like the install (owner, 2026-11-21: "an actual install step"); # the installer then redraws the same mark with its checks under it. # # A TEMPLATE. stage.py and release.py fill in a link and a sha256 for each # build; each pair always travels together. Two builds, picked by the shell's # CPU: aarch64 for Open Minis and the iSH ARM64 TestFlight, x86 (i586, see # build.sh ish) for iSH from the App Store. An empty pair means no build for # that CPU in this release. set -eu case "$(uname -m)" in aarch64|arm64) BIN_URL='https://dl.pindrift.app/p/bin/88f9364c529036fb68b17f15580fdc33ad2a9375fb38ee482f9a3da43ae5cee6'; BIN_SHA='88f9364c529036fb68b17f15580fdc33ad2a9375fb38ee482f9a3da43ae5cee6' ;; i386|i486|i586|i686|x86) BIN_URL='https://dl.pindrift.app/p/bin/6ecdab5763a666676e1f37134eb6a76ed4456328dd9001f3218c6e927c6fe25e'; BIN_SHA='6ecdab5763a666676e1f37134eb6a76ed4456328dd9001f3218c6e927c6fe25e' ;; *) BIN_URL=''; BIN_SHA='' ;; esac DIR="$HOME/.pindrift" BIN="$DIR/pindrift-install" mkdir -p "$DIR" chmod 700 "$DIR" E=$(printf '\033') BL="$E[38;2;10;132;255m" WH="$E[38;2;255;255;255m" GR="$E[38;2;142;142;147m" RD="$E[38;2;255;69;58m" B="$E[1m" R="$E[0m" printf '%s' "$E[2J$E[3J$E[H$E[?25l" printf '\n\n' printf ' %s\n' "$BL╭───╮$R" printf ' %s %s\n' "$BL│$R $WH$B●$R $BL│$R" "$WH${B}PinDrift$R" printf ' %s %s\n' "$BL╰─┬─╯$R" "${GR}Install$R" printf ' %s\n\n\n' "$BL ╹$R" if [ -z "$BIN_URL" ] || [ -z "$BIN_SHA" ]; then printf '%s\n %s\n\n' "$E[?25h" "$RD${B}PND-4708$R no installer for this shell ($(uname -m))" exit 1 fi printf ' %s\n' "${GR}Downloading$R" if ! wget -q -O "$BIN.part" "$BIN_URL"; then rm -f "$BIN.part" printf '%s\n %s\n\n' "$E[?25h" "$RD${B}PND-4634$R the installer did not download" exit 1 fi GOT=$(sha256sum "$BIN.part" | cut -d ' ' -f 1) if [ "$GOT" != "$BIN_SHA" ]; then rm -f "$BIN.part" printf '%s\n %s\n\n' "$E[?25h" "$RD${B}PND-4641$R the installer failed its checksum" exit 1 fi chmod 700 "$BIN.part" mv -f "$BIN.part" "$BIN" # A typed install is a fresh start: no older run carries on by itself. rm -f "$DIR/resume" # NOT exec: an installer killed by a signal (an allocation failure after iSH # was frozen aborts it) prints nothing of its own, since its stderr goes to the # install log. 130 is Ctrl-C, which the installer handles itself. S=0 "$BIN" "$@" < /dev/tty || S=$? if [ "$S" -gt 130 ]; then printf '%s\n\n %s\n\n %s\n\n %s\n\n' "$E[0m$E[?25h" "$RD${B}PND-4723$R the installer stopped" \ "${BL}Close iSH fully, open it and run it again.$R" "${GR}~/.pindrift/pindrift-install --report$R" fi exit "$S"