#!/usr/bin/env bash # SPEEDBIRD one-line installer for Linux and Raspberry Pi (SpeedBird-VM / SpeedBird-PI) # # curl -fsSL https://speedbird.io/install.sh | sudo bash # curl -fsSL https://speedbird.io/install.sh | sudo bash -s -- --without-pat --no-start # # Options (passed to the SPEEDBIRD package installer): # --without-pat don't install the bundled Pat Winlink client # --no-start install but don't start speedbird.service # --offline-only use only the bundled Python wheels, never PyPI # --skip-geodata skip geodata # --tarball install from the .tar.gz bundle instead of the .deb # --dry-run download and verify only; install nothing # # Source and checksums: https://speedbird.io/downloads/ set -euo pipefail BASE="${SPEEDBIRD_BASE:-https://speedbird.io}" MANIFEST="$BASE/downloads/latest.json" c_bold=$'\e[1m'; c_or=$'\e[38;5;208m'; c_red=$'\e[31m'; c_grn=$'\e[32m'; c_off=$'\e[0m' [ -t 1 ] || { c_bold=; c_or=; c_red=; c_grn=; c_off=; } say() { printf '%s==>%s %s\n' "$c_or" "$c_off" "$*"; } ok() { printf '%s โœ“%s %s\n' "$c_grn" "$c_off" "$*"; } die() { printf '%serror:%s %s\n' "$c_red" "$c_off" "$*" >&2; exit 1; } USE_TAR=0 DRY=0 TAR_ARGS=() for a in "$@"; do case "$a" in --without-pat) export SPEEDBIRD_INSTALL_PAT=0; TAR_ARGS+=("$a") ;; --no-start) export SPEEDBIRD_NO_START=1; TAR_ARGS+=("$a") ;; --offline-only) export SPEEDBIRD_OFFLINE_ONLY=1; TAR_ARGS+=("$a") ;; --skip-geodata) export SPEEDBIRD_SKIP_GEODATA=1; TAR_ARGS+=("$a") ;; --tarball) USE_TAR=1 ;; --dry-run) DRY=1 ;; -h|--help) echo "usage: curl -fsSL $BASE/install.sh | sudo bash -s -- [--without-pat] [--no-start] [--offline-only] [--skip-geodata] [--tarball] [--dry-run]"; exit 0 ;; *) die "unknown option: $a (see --help)" ;; esac done printf '\n%s SPEEDBIRD installer%s ยท %s\n\n' "$c_bold" "$c_off" "$BASE" # ---- checks ------------------------------------------------------------- [ "$(uname -s)" = Linux ] || die "this installer is for Linux. On Windows use: irm $BASE/install.ps1 | iex" [ "$DRY" = 1 ] || [ "$(id -u)" = 0 ] || die "run as root: curl -fsSL $BASE/install.sh | sudo bash" arch="$(uname -m)" case "$arch" in x86_64|amd64) arch=amd64 ;; aarch64|arm64) arch=arm64 ;; armv7l|armv6l) die "32-bit Raspberry Pi OS isn't supported. Install Raspberry Pi OS (64-bit)." ;; *) die "unsupported CPU architecture: $arch (amd64 and arm64 are supported)" ;; esac . /etc/os-release 2>/dev/null || die "can't identify this Linux distribution (/etc/os-release missing)" distro="${PRETTY_NAME:-$ID}" case " $ID ${ID_LIKE:-} " in *" debian "*|*" ubuntu "*|*" raspbian "*) : ;; *) [ "$USE_TAR" = 1 ] || die "$distro isn't Debian-based. Supported: Debian 12+, Ubuntu 22.04+, Raspberry Pi OS 64-bit (or try --tarball)" ;; esac if [ "$ID" = ubuntu ] && [ "${VERSION_ID%%.*}" -lt 22 ] 2>/dev/null; then die "Ubuntu 22.04 or newer is required ($distro)"; fi if [ "$ID" = debian ] && [ "${VERSION_ID%%.*}" -lt 12 ] 2>/dev/null; then die "Debian 12 or newer is required ($distro)"; fi grep -qi 'raspberry pi' /proc/device-tree/model 2>/dev/null && edition=SpeedBird-PI || edition=SpeedBird-VM ok "$distro, $arch โ†’ $edition" need=() command -v curl >/dev/null || need+=(curl) command -v python3 >/dev/null || need+=(python3) command -v sha256sum >/dev/null || need+=(coreutils) if [ ${#need[@]} -gt 0 ]; then say "installing prerequisites: ${need[*]}" apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq "${need[@]}" >/dev/null fi # ---- pick the release --------------------------------------------------- say "fetching release list" manifest="$(curl -fsSL "$MANIFEST")" || die "couldn't download $MANIFEST" kind=deb; [ "$USE_TAR" = 1 ] && kind=tgz read -r name sha url version < <(printf '%s' "$manifest" | python3 -c ' import json, sys m = json.load(sys.stdin); kind = sys.argv[1] f = next((f for f in m.get("files", []) if f["kind"] == kind), None) print(*(f[k] for k in ("name", "sha256", "url", "version")) if f else "") ' "$kind") || true [ -n "${name:-}" ] || die "no $( [ "$kind" = deb ] && echo .deb || echo .tar.gz ) release is published yet. See $BASE/downloads/" ok "SPEEDBIRD $version ($name)" # ---- download + verify -------------------------------------------------- tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT chmod 755 "$tmp" # apt's _apt user must be able to read the .deb say "downloading" curl -fL --progress-bar -o "$tmp/$name" "$url" || die "download failed: $url" echo "$sha $tmp/$name" | sha256sum -c --status || die "SHA-256 mismatch for $name โ€” not installing" chmod 644 "$tmp/$name" ok "SHA-256 verified" if [ "$DRY" = 1 ]; then ok "dry run: verified $name, nothing installed"; exit 0; fi # ---- install ------------------------------------------------------------ if [ "$kind" = deb ]; then say "installing package (this can take a few minutes)" apt-get update -qq || true DEBIAN_FRONTEND=noninteractive apt-get install -y "$tmp/$name" else say "unpacking bundle" tar xzf "$tmp/$name" -C "$tmp" dir="$(find "$tmp" -mindepth 1 -maxdepth 1 -type d -name 'speedbird-*' | head -1)" [ -x "$dir/install.sh" ] || die "install.sh not found in $name" (cd "$dir" && ./install.sh "${TAR_ARGS[@]}") fi host="$(hostname -I 2>/dev/null | awk '{print $1}')" cat <}/ (self-signed certificate) 3. First contact: $BASE/docs/quickstart/ Status: systemctl status speedbird Logs: journalctl -u speedbird -f ${c_or}The web UI has no authentication yet: keep it on a trusted network.${c_off} EOF