From 967d5fcd2d0c8715b4322d32d377c2c9d8f483ef Mon Sep 17 00:00:00 2001 From: Arnav Wadhwa <40817363+ArnavVWadhwa@users.noreply.github.com> Date: Fri, 28 Aug 2026 14:28:41 -0700 Subject: [PATCH] chore: drop unused provision.sh and lib/common.sh --- .github/workflows/validate.yml | 2 +- README.md | 6 +-- lib/common.sh | 81 ---------------------------------- packages.txt | 6 +-- provision.sh | 37 ---------------- 5 files changed, 6 insertions(+), 126 deletions(-) delete mode 100755 lib/common.sh delete mode 100755 provision.sh diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index d4fb37d..3ae8552 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 - run: | sudo apt-get update && sudo apt-get install -y shellcheck - shellcheck -S error build-image.sh customize.sh provision.sh lib/common.sh hardware-smoke-test.sh + shellcheck -S error build-image.sh customize.sh hardware-smoke-test.sh customize-in-container: runs-on: ubuntu-24.04-arm # native arm64 container diff --git a/README.md b/README.md index 36c1f83..94ce724 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ dependencies and installs them with `uv`. ### Shared apt packages (`packages.txt`) -`packages.txt` is the single source of truth, read by `build-image.sh` and -`provision.sh`. Current contents: +`packages.txt` is the single source of truth, read during the image build. +Current contents: - core: `git`, `curl`, `ca-certificates` - I2C/SPI: `i2c-tools` @@ -89,8 +89,6 @@ you can reach `172.17.21.2`. | `build-image.sh` | download + grow + loop-mount + chroot-customize the stock image into `.img.xz` | | `customize.sh` | the steps run inside the image chroot | | `files/dpea-eth0.nmconnection` | baked NetworkManager profile (eth0 DHCP + static) | -| `provision.sh` | apply the same config to an already-running Pi (no reflash) | -| `lib/common.sh` | shared shell helpers for `provision.sh` | | `hardware-smoke-test.sh` | on-Pi smoke test of the baked config | | `imager-launchers/` | double-click launchers that open Imager with the DPEA OS list | | `.github/workflows/build-image.yml` | build + publish the image + `os-list.json` | diff --git a/lib/common.sh b/lib/common.sh deleted file mode 100755 index 5f58650..0000000 --- a/lib/common.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env bash -# Shared DPEA Raspberry Pi provisioning helpers. -# Sourced by provision.sh to configure a running Pi. The image bakes the same -# choices at build time via customize.sh. -# -# Target: Raspberry Pi OS Trixie, 64-bit (aarch64). -# -# Layering rule: -# apt / packages.txt -> NON-Python OS libraries only (SDL2, i2c-tools, ...). -# uv / pyproject.toml -> ALL Python packages (kivy, pidev, dpeaDPi, RPi.GPIO, -# spidev, smbus2, adafruit-*). apt python3-* do NOT -# populate a uv venv, so they never substitute for a dep. - -set -euo pipefail - -# Expand a packages.txt into a bare list: strip # comments and blank lines. -pkgs_from_file() { sed -e 's/#.*//' -e '/^[[:space:]]*$/d' "$1"; } - -dpea_require_root() { [ "$(id -u)" -eq 0 ] || { echo "run with sudo" >&2; exit 1; }; } - -dpea_apt_update_upgrade() { - apt-get update - DEBIAN_FRONTEND=noninteractive apt-get -y upgrade -} - -dpea_install_packages() { - # Install every package listed in $1 (a packages.txt). - # shellcheck disable=SC2046 - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $(pkgs_from_file "$1") -} - -dpea_enable_interfaces() { - # I2C, SPI, and the serial *hardware* (not the login console). Needs a recent - # raspi-config (ships on Raspberry Pi OS). In a build chroot, edit config.txt directly. - raspi-config nonint do_i2c 0 - raspi-config nonint do_spi 0 - raspi-config nonint do_serial_hw 0 - raspi-config nonint do_serial_cons 1 -} - -dpea_config_uart() { - # Point /dev/serial0 at the PL011 UART on GPIO 14/15 (/dev/ttyAMA0) for the DPi bus. - local cfg="/boot/firmware/config.txt" - [ -f "$cfg" ] || cfg="/boot/config.txt" - grep -q '^dtoverlay=disable-bt' "$cfg" || echo 'dtoverlay=disable-bt' >> "$cfg" - if grep -qs 'Raspberry Pi 5' /proc/device-tree/model; then - grep -q '^dtparam=uart0_console' "$cfg" || echo 'dtparam=uart0_console' >> "$cfg" - fi -} - -dpea_install_uv() { - command -v uv >/dev/null 2>&1 || \ - curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh -} - -# The patched 5358 avahi as a prebuilt arm64 .deb, built by the avahi_0.8 repo's -# CI. That repo is public, so no auth. This downloads at provision time; the Pi -# never needs GitHub at exhibit runtime. -AVAHI_DEB_URL="${AVAHI_DEB_URL:-https://github.com/dpengineering/avahi_0.8/releases/latest/download/avahi-dpea_0.8_arm64.deb}" -dpea_install_avahi_5358() { - local tmp; tmp="$(mktemp -d)" - if curl -fLsS "$AVAHI_DEB_URL" -o "$tmp/avahi.deb"; then - DEBIAN_FRONTEND=noninteractive apt-get install -y "$tmp/avahi.deb" - echo 'avahi-daemon hold' | dpkg --set-selections || true - else - echo "ERROR: prebuilt 5358 avahi .deb not found at $AVAHI_DEB_URL" >&2 - echo "Check the avahi_0.8 repo's CI / latest Release." >&2 - return 1 - fi -} - -# eth0: DHCP for internet when on a real network, PLUS an always-on static for a -# direct laptop-to-Pi cable (laptop = 172.17.21.1). No gateway on the static, so -# it never competes with DHCP/wifi for the default route. -DPEA_ETH_STATIC="${DPEA_ETH_STATIC:-172.17.21.2/22}" -dpea_config_eth0() { - local con="${1:-Wired connection 1}" - nmcli connection modify "$con" ipv4.method auto - nmcli connection modify "$con" +ipv4.addresses "$DPEA_ETH_STATIC" - nmcli connection modify "$con" ipv4.may-fail yes -} diff --git a/packages.txt b/packages.txt index eab0023..6b030cc 100644 --- a/packages.txt +++ b/packages.txt @@ -5,9 +5,9 @@ # that repo's pyproject.toml. apt python3-* packages do NOT populate a uv venv, # so they never belong here. # -# Read by build-image.sh (image build) and provision.sh (a running Pi). Lines -# starting with # and blank lines are ignored. Keep this list documented in -# README.md. +# Read during the image build (build-image.sh copies it in, customize.sh installs +# it). Lines starting with # and blank lines are ignored. Keep this list +# documented in README.md. # --- core --- git diff --git a/provision.sh b/provision.sh deleted file mode 100755 index 49933eb..0000000 --- a/provision.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash -# Provision a running DPEA Raspberry Pi from stock Raspberry Pi OS 64-bit (Trixie). -# Idempotent: safe to re-run. Run with sudo. -# -# sudo ./provision.sh [--hostname arnav-pi] -# -# Use this when you are NOT flashing the prebuilt image (a one-off Pi, or to -# re-apply config). The prebuilt image already does everything here except the -# per-Pi hostname. It does not install any exhibit's Python deps: each repo owns -# those via `uv sync` (pyproject.toml). - -set -euo pipefail -HERE="$(cd "$(dirname "$0")" && pwd)" -# shellcheck source=lib/common.sh -. "$HERE/lib/common.sh" - -HOSTNAME_NEW="" -while [ $# -gt 0 ]; do - case "$1" in - --hostname) HOSTNAME_NEW="$2"; shift 2 ;; - -h|--help) grep '^#' "$0" | sed 's/^# \?//'; exit 0 ;; - *) echo "unknown arg: $1" >&2; exit 2 ;; - esac -done - -dpea_require_root -dpea_apt_update_upgrade -dpea_install_packages "$HERE/packages.txt" -dpea_enable_interfaces -dpea_config_uart -dpea_install_avahi_5358 -dpea_install_uv -dpea_config_eth0 - -[ -n "$HOSTNAME_NEW" ] && raspi-config nonint do_hostname "$HOSTNAME_NEW" - -echo "Provisioned. Reboot to apply UART / interface changes: sudo reboot"